Porting WWIV 4.23 to FreeBSD UNIX

Robert N. M. Watson

Premature Optimism
WWIV 4.23
New Files (DOS, BIOS compatibility)
Porting WWIV to UNIX in 10 Easy Steps
Known Issues

In January, 2007, I spent a weekend porting WWIV 4.23, based on a source license from 1995, to FreeBSD 6.2. These notes describe what's involved in doing this. As the WWIV 4.x source code is not open source, I cannot redistribute the patches, but I can provide supplemental DOS and BIOS compatibility source that anyone wanting to replicate this can use. I ported the basic WWIV structure, including the communications and display libraries, user system, message bases, g-files, e-mail, transfers, and so on. I made no attempt to deal with external programs, such as doors, WWIV networking, external events, and external transfer protocols. By the end of the weekend, I was able to log in locally and via FreeBSD's synthetic NULL modem device driver, read e-mail, messages, and so on. This port is hardly complete, but as proof of concepts go, it's not shabby.

Premature Optimism

Discovered while perusing posts from my BBS message boards using the FreeBSD port of WWIV:

I meant well, but never got much further than that e-mail. However, this does illustrate an early interest in FreeBSD!


No software port is complete without the a few screenshots. These images were captured using ksnapshot running on FreeBSD 7.x, with WWIV 4.23 running over the synthetic null modem device (nmdm). Click to view the full-size capture.

Star-Lit BBS: welcome screen Star-Lit BBS: login successful
Star-Lit BBS: e-mail box Star-Lit BBS: main menu
Star-Lit BBS message board

WWIV 4.23

WWIV is written in relatively portable Borland C code, but relies on the availability of a variety of system functions and libraries present in the MS DOS and Borland C programming environments. These include DOS APIs for file system access, BIOS functions for screen management, and direct hardware I/O for serial port access. To get WWIV running on FreeBSD, I had to provide support routines to emulate these services based on natively available services, such as POSIX I/O routines, ncurses, etc. There are also some C language differences that must be adapted to, and in some cases papered over.

Why not just use WWIV 5.0, the open source C++ offspring of WWIV 4? Well, I have a WWIV 4.23 install already, and am, at heart, a C programmer, not a C++ programmer. However, you can learn more about WWIV 5 on its sourceforget.net web page.

New Files (DOS, BIOS compatibility)

New files created during the port, under a BSD license:

Porting WWIV to UNIX in 10 Easy Steps

-1. Rename all source files to be all lower-case.

This is UNIX.

0. Create a makefile

The shipped makefiles are not useful as a starting point, create new ones.

1. C language changes

2. Adjust include files

Search for and remove inclusions of: alloc.h conio.h dos.h io.h mem.h; In some cases, replace paths, for example sys\stat.h to sys/stat.h.

3. Disable everything relating to printers

Search for and #ifdef out references to stdprn and sysconfig_printer. Probably this should be replaced with syslog(3) calls.

4. Disable all external programs

Do so by hook or by crook; I disabled various shell points, execution points, external chat programs, network callouts, external programs, etc, using ifdefs.

5. Build a serial port compatibility library

6. Build a BIOS and console compatibility library

7. Build a DOS compatibility library

8. Add MT_UNIX to utility.c, comment out various things that can't work.

10. Fix lots of random compiling things that aren't meaningful anymore, such as attempts to manipulate stack pointers in extrn.c.

Since we're not implementing external programs or overlays, these can basically be ignored.

Known Issues

There are so many issues it's almost silly to enumerate them, but here are a few:

Copyright 2007 Robert N. M. Watson