brendan@cs.widener.edu (Brendan Kehoe) (03/09/91)
The result of the patches I posted will come up with perfectly compilable code .. but incorrect instructions. (I didn't triple-check it.) What follows is the right ReadMe. (Basically you have to do make link before you can do make in the stdc and posix directories.) The full patched & compilable source is also available on ftp.cs.widener.edu (192.55.239.132) in pub/unix/ksh.tar.Z. -- cut -- Notes on the Standard C / POSIX P1003.1 package This package contains header files and library routines to provide a standard C (ANSI) and POSIX enviroment for portable programs. This allows most OS dependcies to be removed from an application, making it much more readable, and isolating them in a small, standardized library. It has the disadvantage that it only works with fairly stock UNIX versions, but a different approach will be used for other systems. This package supplements the existing libraries and header files of a AT&T-derived Unix system (System V and BSD in particular). It also provides function prototypes when the compiler supports them, improving compile-time error checking and improving portability on machines where sizeof(int) == sizeof(size_t) == sizeof(void*) does not hold. A different approach will be used for the DOS, Atari St, Minix, and possibly V7: a complete replacement standard C library will be provided as a separate package. This would not be practical with BSD or NFS systems because of the conflicts with the host stdio and the replacement stdio in libc's getpwent(). Contents: stdc/*: The standard C header files and library. posix/*: The POSIX header files and library. h/*, h/sys/*: Links to the header files in stdc/ and posix/. libstdc.a: The standard C library. libposix.a: The POSIX emulation library. Building PD Ksh --------------- First, create the header files and libraries: - define _BSD, _SYSV, or _V7 in stdc/Makefile and posix/Makefile - rm stdc/stdio.h - cd stdc; make link; make - cd ../posix; make link; make Now, type: - cd ../src; make The executable will be in src/ksh. Notes on the standard C package - The files <locale.h>, <assert.h>, and <math.h> don't exist yet. - Many standard C functions are not implemented yet, including strtol strtoul atexit tempfile et al. - The string routines are by Henry Spencer. Known Portability Problems - size_t or ptrdiff_t in <stddef.h> may need to be long. - some versions of Unix may scream when make stdc tries to create a stdio.h from /usr/include/stdio.h and stdc/stdio.h_std .. if this is the case (e.g. on Xenix and some BSD/SysV mixes), you can do it by hand by simply doing: cd stdc cp stdio.h_std stdio.h edit the new stdio.h and insert /usr/include/stdio.h between the lines /* system stdio.h goes here ... %%% */ and /* ... end system stdio.h */ - FILE must be in the host stdio.h for setvbuf() to work; also it has to be stock System V or BSD, or it'll fail - You can safely "#if 0" out the body of setvbuf for PD ksh, setvbuf is used to decrease the size of buffers to speed up forks. - If the offsetof macro makes your build fail, define BAD_OFFSET in the CFLAGS variable in src/Makefile, as such: CFLAGS= blahblahblah -DBAD_OFFSET - Also previous versions would crash if you did a Ctrl-D (EOF) on the line by itself (at least on Suns); this has been fixed (at least on Suns :-)). Notes on the POSIX package - Only headers and function required by the PD KornShell are implemented. I do not intend to develop this into a full POSIX emulation package. - You should install Doug Gwyn's <dirent> package if you do not have <dirent.h> nor <sys/dir>. If you do have <dirent.h>, unlink h/dirent.h (this should be configured automatically by the makefile). -- cut -- -- Brendan Kehoe - Widener Sun Network Manager - brendan@cs.widener.edu Widener University in Chester, PA A Bloody Sun-Dec War Zone -- Brendan Kehoe - Widener Sun Network Manager - brendan@cs.widener.edu Widener University in Chester, PA A Bloody Sun-Dec War Zone