Tools for old Unix Guys (or those porting from Unix)

If you are an old Unix guy (like I am), or you are being forced to port code from Unix (like many people I know), or you just want simpler multiprocessing and IPC than Windows offers, then I have some places you should go look.

David Korn (of Korn Shell fame) has a product called U/Win. It is basically a POSIX library for Windows. It also comes with a really good set of Unix style tools. For evaluation, you can get it free. You can also license it if you plan on using it for something real. Just for personal use it is like getting the MKS toolkit for free.

Since I've written this, I've switched to Cygwin which is great and open source to boot. Cygwin has gcc and you can compile most Linux packages for Cygwin (although they've already compiled most of them for you).

U/Win uses your existing C compiler, but gives you a CC interface for it.

Here is a simple U/Win program:

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>

void main()
{
  int pipes[2];
  char msg[22];
  pipe(pipes);  /* Create a POSIX pipe */
  if (fork())
    {
    write(pipes[1],"Hello from process #2",21);
    exit(0);
    }
  memset(msg,0,22);
  read(pipes[0],msg,21);  /* read message from other side of fork */
  printf("Received: %s\n",msg);
  exit(0);
}

Another neat tool is emacs. This pretty much works like you expect now with only a few minor quirks. You can download emacs off the net, but it is pretty big.

Both U/Win and emacs will work under Windows 95, but do best with NT. If you use NT but occasionally use 95 (like me), you might find the read only NTFS file system for DOS/Windows 95 interesting.

Enjoy!