How to run MS FoxPro Unix on FreeBSD

This text is excerpted from my notes on how to make a FreeBSD system to support MS FoxPro 2.6 for Unix. This is version 2. Last revision date 17 January 2011.

Based on FreeBSD version 7.2.

1. Prepare the system
2. Install FreeBSD
3. Post installation configuration
3.1. Mtools
3.2. Terminfo
3.3. ibcs2
3.4. Printing
3.5. Samba
3.6. Telnet
3.7. AutoIt
4. Move the FoxPro files
5. Transfer the data
5.1. Add the users
6. Set up printing
7. Misc.
8. Shell scripts

1. Prepare the system.

Section snipped to save space.


2. Install FreeBSD.

Snipped to save space.

3. Post installation configuration.

3.1 mtools
The mtools packages is a handy utility to interact with dos filesystems without having to mount and unmount them.
Install mtools:
Code:
# pkg_add -r mtools
or use sysinstall
Code:
# sysinstall -> Configure -> Packages -> CD/DVD -> emulators -> mtools.
Edit the configuration file /usr/local/etc/mtools.conf . Add the line
Code:
drive u: file="/dev/da0s1"

This should make a USB stick accessible as u:. A restart MAY be necessary to get this to work. Note that USB drive use the SCSI subsystem so the names are /dev/dans1 where n is the next available drive. If you have an SCSI hard drive the number of the USB stick will be 1 (ie /dev/da1s1).

3.2 Terminfo database
Compile the port:
Code:
# cd /usr/src/lib/ncurses
# make
# make  install
Possible problems : the 'built-in' port doesn't create tic so the terminfo files aren't created. Use csup to update the ports tree:
Code:
# csup -L 2 -h cvsup.FreeBSD.org /usr/share/examples/cvsup/ports-supfile
Now compile the ncurses port.
Code:
# cd /usr/ports/devel/ncurses
Edit Makefile replacing '--with-hashed-db' with '--without-hashed-db' then compile :
Code:
# make install clean

The FreeBSD version of tic (terminfo compiler) puts the terminfo files in either /usr/share/terminfo or /usr/local/share/misc (the latter is the ports version -check). OpenServer/OpenDesktop/Xenix programs expect to find the terminfo dir at /ust/lib/terminfo. Link this directory to /usr/lib/terminfo so OpenServer programs can find it.
Code:
# ln -sf /usr/share/terminfo /usr/lib/terminfo
or
Code:
# ln -sf /usr/local/share/misc/terminfo /usr/lib/terminfo



3.3 ibcs2
ibcs2 is the emulation layer which allows binaries targeted on other systems, especially SCO systems, to run on FBSD.

Edit /boot/loader.conf Add lines
Code:
ibcs2_load=”YES”
ibcs2_coff_load=”YES”
After a reboot kldstat should show ibcs2.ko and ibcs2_coff.ko loaded.
An error message from foxpro.pr about unexpected ')' or similar indicates ibcs2 isn't loaded.

Create these directories:
Code:
# mkdir /usr/compat/ibcs2
# mkdir /usr/compat/ibcs2/dev
Create these links
Code:
# cd /usr/compat/ibcs2/dev
# ln -sf /dev/null X0R (ecs nought arr)
# ln -sf socksys nfsd
# ln -sf /dev/null socksys
Make an empty file called null
Code:
# touch null

3.4 Printing

Section sniped to save space.

3.5 Samba

Section snipped to save space.

3.6 Telnet
Download and install PuttyTel on the client PCs. Put it in a suitable folder, say d:\usr\software\puttytel. Start PuttyTel and change 'backspace' to Control-H. In 'Terminal' - 'Features' enable 'Disable application keypad mode'. In 'Window' set 'Rows' to 25. In 'Windows' - 'Translation' set character set to CP437. Now in 'Session' click on 'Default Settings' then click 'Save'.

3.7 AutoIt
Download and install AutoIt. Create an AutoIt script called parkrow.aut. Add these lines

Code:
sleep(1000)
run("d:/software/puttytel/puttytel parkrow3")
sleep(2000)
send("noggin{enter}")
sleep(3000)
send("thor{enter}")
sleep(1000)
send("cd /usr/data/usr/parkrow{enter}")
sleep(1000)
send("foxpro -eiot +pc prstart" ,1)
send("{enter}")
;
; ,1 on end of send command above sends 'raw'
; avoiding the capitalisation of 'p'
;
sleep(1000)
send("av")
4. Move the FoxPro files

On the current system create a tar file
Code:
# cd /usr/local/lib/foxpro 
# tar -cvf /tmp/fox.tar *
Move to a USB stick with mtools
Code:
# mcopy /tmp/fox.tar u:
On the new system create the directory
Code:
# mkdir /usr/local/lib/foxpro
Copy the files
Code:
# cd /usr/local/lib/foxpro 
# mcopy u:fox.tar .
Untar the files
# tar -xvf fox.tar [Enter]

Create a 'front-end' for foxpro

Code:
#! /bin/sh
# this file /usr/local/bin/foxpro
umask 000
PROGDIR=/usr/local/lib/foxpro
PATH=$PROGDIR:$PATH
export PATH
# The OpenServer value of TZ in the UK is this :
TZ=GMT0BST,M3.5.0/1,M10.5.0/1
export TZ
exec $PROGDIR/foxpro.pr "$@"

Save and then make executable
Code:
# chmod a+x /usr/local/bin/foxpro
5. Transfer the data
Either use tar and a USB stick, or, better still, use the backup file to prove the backup process works! Download the backup files nprimary.tar and nupdate.tar and copy to the root dir of a USB stick. Tranfer to /tmp:
Code:
# cd /tmp
# mcopy u:*.tar .
Now restore the tar files:
Code:
# cd / 
# tar -xvf /tmp/nprimary.tar
# tar -xvf /tmp/nupdate.tar

Enable writing to the data directories
Code:
# cd /usr/data/usr
# chmod a+rwx parkrow
# chmod a+rwx accounts

Enable writing to data and program files
Code:
# cd /usr/data
# chmod -R a+rw *



5.1 Add the users
Add users: recep1 and so on. Make sure they are invited into group 'wheel'.
<More snipping to save space>

Change the owner, group and perms for the data and program files:
Code:
# chown recep1:wheel *
# chmod a+rw *
Change the directory to writable
Code:
# cd /usr/data/usr
# chmod a+w parkrow

Make a dir for the backup files
Code:
# mkdir /usr/data/backup
# cd /usr/data
# chmod a+w backup

The console cannot be used directly, but, after the network is configured, a telnet session can be used for access from the console:
Code:
$ telnet localhost
user (console):console
password: consolepass
$ FOXTERM=ansifox; export FOXTERM
$ foxpro -eiot +pc prstart

Possible issue: Telnet not starting. Check both /etc/rc.conf for inetd_enable="YES" and /etc/inetd.conf for telnet line enabled.

6. Set up printing
Snipped to save space

7. Misc.
snipped to save space

8. Shell Scripts
This section contains shell script versions of the previous instructions, cut out-'n-keep!

Snipped to save space.

If anybody is the slightest bit interested send me an personal message and I'll send you the unexpurgated version. Further to that, I have a previous version which tackles using serial terminals. You only have to ask.
 

Attachments

  • foxpro on freebsd v2.txt
    18.7 KB · Views: 466
@wblock
Just a quirk of (my) history. I'm sure ssh works just as well, but I haven't tried it yet. Are you a FoxPro unix user or do you use ibcs2 for anything?
 
michaelrmgreen said:
@wblock
Just a quirk of (my) history. I'm sure ssh works just as well, but I haven't tried it yet. Are you a FoxPro unix user or do you use ibcs2 for anything?

I used Foxpro all the way from DOS (2.0 or 2.1?, FP that is, not DOS!) to VFP 6 to VFP 9. Never tried the Unix version, but it's nice to have the option. Still know of some users running FP 2.6 from a FreeBSD Samba server.
 
MS FoxPro Unix is awesome. I used it for years on steam terminals. There is NO direct replacement. Its such a shame that MS couldn't maintain it.
 
Back
Top