## A.9. Workalikes on PC Platforms

The proliferation of the Korn shell has not stopped at the boundaries of Unix-dom. Many programmers who got their initial experience on Unix systems and subsequently crossed over into the PC world wished for a nice Unix-like environment (especially when faced with the horrors of the MS-DOS command line!), so it's not surprising that several Unix shell-style interfaces to small-computer operating systems have appeared, Korn shell emulations among them.

In the past several years, not just shell clones have appeared, but entire Unix "environments." Two of them use shells that we've already discussed. Two others provide their own shell reimplementations. Providing lists of major and minor differences is counterproductive. Instead, this section describes each environment in turn (in alphabetical order), along with contact and Internet download information.

### A.9.1. Cygwin

Cygnus Consulting (now Red Hat), created the cygwin environment. First creating cgywin.dll, a shared library that provides Unix system call emulation, they ported a large number of GNU utilities to various versions of Microsoft Windows. The emulation includes TCP/IP networking with the Berkeley socket API. The greatest functionality comes under Windows/NT, Windows 2000, and Windows XP, although the environment can and does work under Windows 95/98/ME, as well.

The cygwin environment uses bash for its shell, GCC for its C compiler, and the rest of the GNU utilities for its Unix toolset. A sophisticated mount command provides a mapping of the Windows `C:\path` notation to Unix filenames.

The starting point for the cygwin project is http://www.cygwin.com. The first thing to download is an installer program. Upon running it, you choose what additional packages you wish to install. Installation is entirely Internet-based; there are no official cygwin CD's, at least not from the project maintainers.

### A.9.2. DJGPP

The DJGPP suite provides 32-bit GNU tools for the MS-DOS environment. To quote the web page:

DJGPP is a complete 32-bit C/C++ development system for Intel 80386 (and higher) PCs running MS-DOS. It includes ports of many GNU development utilities. The development tools require a 80386 or newer computer to run, as do the programs they produce. In most cases, the programs it produces can be sold commercially without license or royalties.

The name comes from the initials of D.J. Delorie, who ported the GNU C++ compiler, g++ to MS-DOS, and the text initials of g++, GPP. It grew into essentially a full Unix environment on top of MS-DOS, with all the GNU tools and bash as its shell. Unlike cygwin or UWIN (see later in this chapter), you don't need a version of Windows, just a full 32-bit processor and MS-DOS. (Although, of course, you can use DJGPP from within a Windows MS-DOS window.) The web site is http://www.delorie.com/djgpp/.

### A.9.3. MKS Toolkit

Perhaps the most established Unix environment for the PC world is the MKS Toolkit from Mortice Kern Systems:

>     MKS Canada - Corporate Headquarters
>     410 Albert Street
>     Waterloo, ON  N2L 3V3
>     Canada
>     (519) 884-2251
>     (519) 884-8861 (fax)
>     (800) 265-2797 (sales)
>     http://www.mks.com

The MKS Toolkit comes in various versions depending upon the development environment and the number of developers who will be using it. It includes a shell that is POSIX compliant, along with just about all the features of the 1988 Korn shell, as well as over 300 utilities, such as awk, perl, vi, make, and so on. Their library supports over 1500 Unix APIs, making it extremely complete and easing porting to the Windows environment. More information is available at http://www.mkssoftware.com/products/tk/ds_tkpdev.asp.

### A.9.4. Thompson Automation Software Toolkit

Thompson Automation Software provides the Thompson Toolkit, which includes a shell and over 100 utilities. The toolkit is available MS-DOS 2.1 and higher, OS/2 1.2 or WARP, and for Microsoft Windows 95 and higher. The contact information is:

>     Thompson Automation Software
>     5616 SW Jefferson
>     Portland, OR 97221
>     1-800-944-0139 (U.S. and Canada)
>     1-503-224-1639 (international/local)
>     1-503-224-3230 (FAX)
>     sales@tasoft.com
>     http://www.tasoft.com/toolkit.html/

Thompson software is best known for their implementation of awk, which is both fast and reliable, with many powerful extensions to the awk language. The toolkit shell is compatible with POSIX and the 1988 version of the Korn shell.

### A.9.5. AT&T UWIN

The UWIN package is a project by David Korn and his colleagues to make a Unix environment available under Microsoft Windows. It is similar in structure to cygwin, discussed earlier. A shared library, posix.dll, provides emulation of the Unix system call APIs. The system call emulation is quite complete. An interesting twist is that the Windows registry can be accessed as a filesystem under /reg. On top of the Unix API emulation, ksh93 and over 200 Unix utilities (or rather, reimplementations) have been compiled and run. The UWIN environment relies on the native Microsoft Visual C/C++ compiler, although the GNU development tools are available for download and use with UWIN.

http://www.research.att.com/sw/tools/uwin/ is the web page for the project. It describes what is available, with links for downloading binaries, as well as information on commercial licensing of the UWIN package. Also included are links to various papers on UWIN, additional useful software, and links to other, similar packages.

The most notable advantage to the UWIN package is that its shell is the authentic ksh93. Thus, compatibility with the Unix version of ksh93 isn't an issue.

Copyright © 2003 O'Reilly & Associates. All rights reserved.