This directory, and its subdirectories contain the source code for ksh-88; the language described in the book, "The KornShell Command and Programming Language," by Morris Bolsky and David Korn which is published by Prentice Hall. ksh-88 has build built on run on several machines with several operating systems. The end of this file contains a partial list of operating systems and machines that ksh-88 has been known to run on. Most of the source code for ksh is in the sh directory. Some general purpose routines are in the shlib sub-directory. The include files are in the include directory. The install directory contains programs that determine the configuration of your machine to generate the file include/sh_config.h. If you are cross compiling ksh, you may have to generate this file on the target environment, or else fill it in by hand. Also, if ksh will be compiled and linked with another library, then this library should also be specified when building the install script. The LIB variable in include/sh_config.h is there for this purpose. The OPTIONS file contains several options that can be set before compiling ksh. The OPTIONS are set to their recommended value. A value of 0 represents off, 1 represents on. The options have the following defaults and meanings: ACCT off Shell accounting. LDYNAMIC off Dynamic loading of builtins. Not available yet. ECHOPRINT off Make echo equivalent to print, overrides ECHO_N. ESH on Compile with emacs command line editing. The original emacs line editor code was provided by Mike Veach at IH. ESHPLUS off Some additional emacs features provided by Matthijs Melchior FLOAT off Floating point arithmetic. Not completely debugged. FS_3D off For use with 3-D file system. The vpath and vmap calls become built-in commands. JOBS on Job notification, job control if possible. IODELAY off Turning on will cause ksh to delay after writing long lines to terminal in edit mode. This can improve improve performance on slow terminal speeds on some systems. It can cause overhead in some systems. MULTIBYTE off Multibyte character handling. NEWTEST on New [[...]] compound command. OLDTERMIO off Use either termios or termio at runtime. OLDTEST on Old test command as built-in. POSIX off Enable some of the proposed changed for IEEE POSIX 1003.2. P_UID off If set, all real uids, greater than or equal to this value will require the -p flag to run suid/sgid scripts. PDU off Portable Distributed UNIX. /.. is a 'super-root'. RAWONLY off Turn on if the vi line mode doesn't work right unless you do a set -o viraw. RDS off Expand ~host!user. Requires distributed filesystem. SEVENBIT off Strip the eigth bit from characters. SUID_EXEC on Execute /etc/suid_exec for setuid, setgid script. TIMEOUT off Set this to the number of seconds for timing out and exiting the shell when you don't enter a command. If non-zero, TMOUT can not be set larger than this value. VSH on Compile with vi command line editing. The original vi line editor code was provided by Pat Sullivan at CB. The following compile options are set automatically by the install/config script: const Set to null string for compilers that do not support const. void Set to int for compilers that do not support void type. DEVFD Set when /dev/fd is a directory that names open files. ECHO_N Set when /bin/echo -n does not echo at all. This causes the echo builtin to handle echo like BSD echo when at run time the shell would find echo in the /bin directory. INT16 Set when size of an int is two bytes. LSTAT Set for systems that have lstat() system call for symbolic links. PDUBIN Set when PDU is on for systems the have /usr/pdu/bin/pwd program. SHELLMAGIC Set on systems that recognize script beginning with #! specially. SIG_NORESTART Set on systems where wait() and read() automatically restart when they receive signals. SOCKET Set on machines that contain the BSD socket calls. It causes opens on path names of the form /dev/tcp// and /dev/udp// to be treated as socket connection calls. UNIVERSE Set on systems that have the /bin/universe command. Causes the universe command to be a built-in. VFORK Set on systems where vfork() is much faster than fork(). This has not been fully debugged in this release. VOID Set to int when the function argument to signal returns int. VPIX Set on systems the have /usr/bin/vpix program for running MS-DOS. YELLOWP Set on systems that have library function yp_get_default_domain(). To generate the binaries, type makeshell in the top level directory. If you have 4th. generation make you can use it instead of makeshell. The file ksh.mk is a standard makefile but may not work in some environments. The install/config script is run first to generate include/sh_config.h. This file defines all the compilation options. The binary for ksh becomes the file named ./ksh which can be copied to where ever you install it. It is advisable that you put the line PWD=$HOME;export PWD into the /etc/profile file to reduce initialization time for ksh. To be able to run setuid/setgid shell scripts, or scripts without read permission, the SUID_EXEC compile option must be on, and ksh must be installed in the /bin directory, the /usr/bin directory, or the /usr/lbin directory and the name must end in sh. The program suid_exec must be installed in the /etc directory, must be owned by root, and must be a suid program. If you must install ksh in some other directory and want to be able to run setuid/setgid and execute only scripts, then you will have to change the source code file sh/suid_exec.c explicitly. If you do not have ksh in one of these secure locations, /bin/sh will be invoked with the -p options and will fail when you execute a setuid/setgid and/or execute only script. Note, that ksh does not read the .profile or $ENV file when it the real and effective user/group id's are not equal. ksh has been successfully installed as /bin/sh on several machines. ksh does not use the archaic definition of ^ as a synonym for pipe. On some early systems the scripts /usr/src/:mkcmd and /etc/shutdown used the ^ as a synonym for | and must be changed if you install this shell as /bin/sh. With Sun OS4.0, it is necessary to relink the shell so that it doesn't use the shared libraries to that it can be used for booting. Use the LDFLAGS=-Bstatic options when building ksh. Unless ksh is compiled with the SEVENBIT option on, it passes 8-bit characters transparently. As a result, programs that assume the shell will strip off the 8th bit will fail. In particular, some versions of the vi command put an 8th bit on the characters corresponding to % when invoking a shell. The best solution is to fix the vi command. On the source of vi the I have, you can make the following change to fix the 8-bit % problem: line 77, the line reads: *up++ = *fp++ | QUOTE; Changing it to read: *up++ = *fp++; Otherwise, you can build a 7-bit ksh by turning SEVENBIT on in the OPTIONS file. The tests sub-directory contains a number of regression tests for ksh. To run all these tests with the shell you just built, go to the tests directory and run the command SHELL=../ksh shtests The file PROMO is an advertisement that extolls the virtues of ksh. The file sh.1 contains the troff (man) description of this Shell. The file sh.memo contains an old troff (mm) memo describing ksh. The file RELEASE contains the changes made in this release since ksh-i(1986). The file COMPATIBILITY contains a list of incompatibilities with the S5R3 sh. The module sh/msg.c has a list of about twenty-five default aliases compiled in. Alias values starting with / become tracked aliases. A library of the code for the editing and history features can be generated with the file makelib. This library can be added to most programs to enable emacs or vi mode input. The library generated with makelib is called libedit.a. Systems that do not have syscall() in libc require a routine named rEAd() to perform the read system call. You can generate this routine by extracting the read() system call from libc and editing the binary changing read to rEAd and adding this module to the library. Please report any problems or suggestions to: David Korn ulysses!dgk Good luck!! ksh88 has been compiled and beta tested on the following. An asterisk signifies that ksh has been installed as /bin/sh on this machine. * System V Release 2, 3, & 4 on AT&T 3B's. * System V Release 2 on UNIX-PC. * System V Release 3.[12] on AT&T 6386. System V Release 2 on Vaxen. System V Release 2 on Amdahl UTS. * System V Release 3 on Counterpoint CP-19. * BSD 4.3 on Vax 8650 * BSD 4.3 on CCI. Version 9 on Vax 785. * Sun 3.5 on Sun 3's. * Sun 4.0 on Sun 3's and Sun 4's. Sun 4.0 on Sun 386-i. Unicos on Cray-2. UNIX on Masscomp 5400 in ucb universe. HP/UX 2.0 on HP-9000. Ultrix 2.0 on Microvax. Domain/IX on Apollo 3000. Custonmuix 4.1 on Alliant. UIMPS 3.1 on a MIPS 120-5 5.0 on a Pyramid in ucb universe.