1*da2e3ebdSchinThis directory, and its subdirectories contain the source code 2*da2e3ebdSchinfor ksh-93; the language described in the second addition of 3*da2e3ebdSchinthe book, "The KornShell Command and Programming Language," by 4*da2e3ebdSchinMorris Bolsky and David Korn which is published by Prentice Hall. 5*da2e3ebdSchinksh-93 has been compiled and run on several machines with several 6*da2e3ebdSchinoperating systems. The end of this file contains a partial list of 7*da2e3ebdSchinoperating systems and machines that ksh-93 has been known to run on. 8*da2e3ebdSchin 9*da2e3ebdSchinThe layout of files for ksh-93 has changed somewhat since ksh-88, 10*da2e3ebdSchinthe last major release. Most of the source code for ksh remains in 11*da2e3ebdSchinthe sh directory. However, the shell editing and history routines 12*da2e3ebdSchinare in the edit sub-directory. The code for shell built-ins is 13*da2e3ebdSchinin the bltins directory. The data directory contains read-only 14*da2e3ebdSchindata tables and messages that are used by the shell. The include 15*da2e3ebdSchinfiles remain in the include directory and the shlib directory 16*da2e3ebdSchinis gone. The features directory replaces the older install 17*da2e3ebdSchindirectory. The method for generating systems specific feature 18*da2e3ebdSchininformation has changed substantially. 19*da2e3ebdSchin 20*da2e3ebdSchinThe Makefile file contains several compilation options that can be set 21*da2e3ebdSchinbefore compiling ksh. Options are of the form SHOPT_option and become 22*da2e3ebdSchin#define inside the code. These options are set to their recommended 23*da2e3ebdSchinvalue and some of these may disappear as options in future releases. 24*da2e3ebdSchinA value of 0, or no value represents off, 1 represents on. 25*da2e3ebdSchinNote that == is needed, not =, because these are nmake state variables 26*da2e3ebdSchinand changing their value will cause all modules that could be affected 27*da2e3ebdSchinby this change to be recompiled. 28*da2e3ebdSchinThe options have the following defaults and meanings: 29*da2e3ebdSchin ACCT off Shell accounting. 30*da2e3ebdSchin ACCTFILE off Enable per user accounting info 31*da2e3ebdSchin APPEND on Allows var+=val string and array append. 32*da2e3ebdSchin BASH off Bash compatibility mode. It is not fully implemented 33*da2e3ebdSchin and is experimental. 34*da2e3ebdSchin BRACEPAT on C-shell type abc{d,e}f style file generation 35*da2e3ebdSchin CMDLIB_BLTIN off Makes all commands in libcmd.a builtins. The 36*da2e3ebdSchin SH_CMDLIB_DIR nmake state variable can be used to 37*da2e3ebdSchin specify a directory. 38*da2e3ebdSchin CMDLIB_DIR off Sets CMDLIB_BLTIN=1 and provides a default value 39*da2e3ebdSchin of "/opt/ast/bin" for SH_CMDLIB_DIR. 40*da2e3ebdSchin COMPOUND_ARRAY 41*da2e3ebdSchin on Allows all components of compound variables except the 42*da2e3ebdSchin first to be any string by enclosing in [...]. It also 43*da2e3ebdSchin allows components other than the last to be arrays. 44*da2e3ebdSchin This is experimental and only partially complete. 45*da2e3ebdSchin CRNL off <cr><nl> treated as <nl> in shell grammar. 46*da2e3ebdSchin DYNAMIC on Dynamic loading of builtins. (Requires dlopen() interface.) 47*da2e3ebdSchin ECHOPRINT off Make echo equivalent to print. 48*da2e3ebdSchin ESH on Compile with emacs command line editing. The original 49*da2e3ebdSchin emacs line editor code was provided by Mike Veach at IH. 50*da2e3ebdSchin FILESCAN on Experimental option that allows fast reading of files 51*da2e3ebdSchin using while < file;do ...; done and allowing fields in 52*da2e3ebdSchin each line to be accessed as positional parameters. 53*da2e3ebdSchin FS_3D off For use with 3-D file system. Enabled automatically for 54*da2e3ebdSchin sytems with dynamic linking. 55*da2e3ebdSchin KIA off Allow generation of shell cross reference database with -I. 56*da2e3ebdSchin MULTIBYTE on Multibyte character handling. Requires mblen() and 57*da2e3ebdSchin mbctowc(). 58*da2e3ebdSchin NAMESPACE on Allows namespaces. This is experimental, incomplete 59*da2e3ebdSchin and undocumented. 60*da2e3ebdSchin OLDTERMIO off Use either termios or termio at runtime. 61*da2e3ebdSchin OO on Experimental object oriented extension. This option 62*da2e3ebdSchin should disappear soon. 63*da2e3ebdSchin OPTIMIZE on Optimize loop invariants for with for and while loops. 64*da2e3ebdSchin P_SUID off If set, all real uids, greater than or equal to this 65*da2e3ebdSchin value will require the -p flag to run suid/sgid scripts. 66*da2e3ebdSchin PFSH off Compile with support for profile shell. 67*da2e3ebdSchin RAWONLY off Turn on if the vi line mode doesn't work right unless 68*da2e3ebdSchin you do a set -o viraw. 69*da2e3ebdSchin SEVENBIT off Strip the eigth bit from characters. 70*da2e3ebdSchin SPAWN off Use spawn as combined fork/exec. May improve speed on 71*da2e3ebdSchin some systems. 72*da2e3ebdSchin SUID_EXEC on Execute /etc/suid_exec for setuid, setgid script. 73*da2e3ebdSchin TIMEOUT off Set this to the number of seconds for timing out and 74*da2e3ebdSchin exiting the shell when you don't enter a command. If 75*da2e3ebdSchin non-zero, TMOUT can not be set larger than this value. 76*da2e3ebdSchin VSH on Compile with vi command line editing. The original vi 77*da2e3ebdSchin line editor code was provided by Pat Sullivan at CB. 78*da2e3ebdSchin 79*da2e3ebdSchinThe following compile options are set automatically by the feature testing: 80*da2e3ebdSchin DEVFD Set when /dev/fd is a directory that names open files. 81*da2e3ebdSchin SHELLMAGIC 82*da2e3ebdSchin Set on systems that recognize script beginning with #! specially. 83*da2e3ebdSchin VPIX Set on systems the have /usr/bin/vpix program for running MS-DOS. 84*da2e3ebdSchin 85*da2e3ebdSchin 86*da2e3ebdSchinIn most instances, you will generate ksh from a higher level directory 87*da2e3ebdSchinwhich also generates libcmd and libast libraries on which ksh depends. 88*da2e3ebdSchinHowever, it is possible to generate ksh, with by running make -f ksh.mk 89*da2e3ebdSchinin this directory. The ksh.mk file was generated from the nmake Makefile. 90*da2e3ebdSchinIf you do not have make or nmake, but do have a Version 7 UNIX compatible 91*da2e3ebdSchinshell, then you can run the script mamexec < Mamfile to build ksh. 92*da2e3ebdSchinIf you have nmake, version 2.3 or later, you can use it without the -f ksh.mk. 93*da2e3ebdSchinIn either case, ksh relies on libraries libast and libcmd which must be 94*da2e3ebdSchinbuilt first. The binary for ksh becomes the file named ./ksh which can 95*da2e3ebdSchinbe copied to where ever you install it. 96*da2e3ebdSchin 97*da2e3ebdSchinIf you use old make or the Mamfile, and you system has dynamic shared 98*da2e3ebdSchinlibraries, then you should define the variables mam_cc_static and 99*da2e3ebdSchinmam_cc_dynanamic as the compiler options that request static linking 100*da2e3ebdSchinand dynamic linking respectively. This will decrease the number of 101*da2e3ebdSchinshared libraries that ksh need and cut startup time substantially. 102*da2e3ebdSchin 103*da2e3ebdSchinThe makefile should also generate shcomp, a program that will precompile 104*da2e3ebdSchina script. ksh93 is able to recognize files in this format and process 105*da2e3ebdSchinthem as scripts. You can use shcomp to send out scripts when you 106*da2e3ebdSchindon't want to give away the original script source. 107*da2e3ebdSchin 108*da2e3ebdSchinIt is advisable that you put the line PWD=$HOME;export PWD into the 109*da2e3ebdSchin/etc/profile file to reduce initialization time for ksh. 110*da2e3ebdSchin 111*da2e3ebdSchinTo be able to run setuid/setgid shell scripts, or scripts without read 112*da2e3ebdSchinpermission, the SUID_EXEC compile option must be on, and ksh must be installed 113*da2e3ebdSchinin the /bin directory, the /usr/bin directory, the /usr/lbin directory, 114*da2e3ebdSchinor the /usr/local/bin directory and the name must end in sh. The program 115*da2e3ebdSchinsuid_exec must be installed in the /etc directory, must be owned by root, 116*da2e3ebdSchinand must be a suid program. If you must install ksh in some other directory 117*da2e3ebdSchinand want to be able to run setuid/setgid and execute only scripts, then 118*da2e3ebdSchinyou will have to change the source code file sh/suid_exec.c explicitly. 119*da2e3ebdSchinIf you do not have ksh in one of these secure locations, /bin/sh will 120*da2e3ebdSchinbe invoked with the -p options and will fail when you execute a setuid/setgid 121*da2e3ebdSchinand/or execute only script. Note, that ksh does not read the .profile 122*da2e3ebdSchinor $ENV file when it the real and effective user/group id's are not 123*da2e3ebdSchinequal. 124*da2e3ebdSchin 125*da2e3ebdSchinThe tests sub-directory contains a number of regression tests for ksh. 126*da2e3ebdSchinTo run all these tests with the shell you just built, go to the tests 127*da2e3ebdSchindirectory and run the command 128*da2e3ebdSchin SHELL=../ksh shtests 129*da2e3ebdSchin 130*da2e3ebdSchinThe file PROMO.mm is an advertisement that extolls the virtues of ksh. 131*da2e3ebdSchinThe file sh.1 contains the troff (man) description of this Shell. 132*da2e3ebdSchinThe file nval.3 contains the troff (man) description of the name-value 133*da2e3ebdSchinpair library that is needed for writing built-ins that need to 134*da2e3ebdSchinaccess shell variables. 135*da2e3ebdSchin 136*da2e3ebdSchinThe file sh.memo contains a draft troff (mm) memo describing ksh. The 137*da2e3ebdSchinfile RELEASE88 contains the changes made for ksh88. The file RELEASE93 138*da2e3ebdSchincontains the changes made in this release since ksh-88. The file 139*da2e3ebdSchinRELEASE contains bug fixes made in this release since ksh-88. The file 140*da2e3ebdSchinCOMPATIBILITY contains a list of incompatibilities with ksh-88. The 141*da2e3ebdSchinfile bltins.mm is a draft troff (mm) memo describing how to write 142*da2e3ebdSchinbuilt-in commands that can be loaded at run time. 143*da2e3ebdSchin 144*da2e3ebdSchinMost of the work for internationalization has been done with ksh93. 145*da2e3ebdSchinThe file ksh.msg is a generated file that contains error messages 146*da2e3ebdSchinthat need to be translated. In addition, the function translate() 147*da2e3ebdSchinin sh/init.c has to be completed to interface with the dictionary 148*da2e3ebdSchinlookup. The translate function takes two argument, the string 149*da2e3ebdSchinthat is to be translated and a type which is 150*da2e3ebdSchin 0 when a library string needs translation. 151*da2e3ebdSchin 1 when one of the error messages in ksh.msg needs translation. 152*da2e3ebdSchin 2 when a string in a script needs translation. You use a $ in front 153*da2e3ebdSchin of a double quoted string in a script to indicate that it 154*da2e3ebdSchin needs translation. The -D option for ksh builds the dictionary. 155*da2e3ebdSchinThe translate routine needs to return the translated message. 156*da2e3ebdSchinFor dictionaries that need to use a numeric key, it should be 157*da2e3ebdSchinpossible to use the strhash() function to generate numbers to 158*da2e3ebdSchingo along with each of the messages and to use this number both 159*da2e3ebdSchinwhen generating the dictionary and when converting strings. 160*da2e3ebdSchinIf you encounter error messages of type 1 that are not be translated via 161*da2e3ebdSchinthis translate() function send mail to the address below. 162*da2e3ebdSchin 163*da2e3ebdSchinPlease report any problems or suggestions to: 164*da2e3ebdSchin 165*da2e3ebdSchindgk@research.att.com 166*da2e3ebdSchin 167*da2e3ebdSchin 168*da2e3ebdSchinksh93 has been compiled and alpha tested on the following. An asterisk 169*da2e3ebdSchinsignifies that ksh has been installed as /bin/sh on this machine. 170*da2e3ebdSchin 171*da2e3ebdSchin* Sun OS 4.1.[123] on sparc. 172*da2e3ebdSchin Sun OS 4.1.1 on sun. 173*da2e3ebdSchin Solaris 2.[1-9] on sparc. 174*da2e3ebdSchin Solaris 2.[4-8] on X86. 175*da2e3ebdSchin HP/UX 8 on HP-9000/730. 176*da2e3ebdSchin HP/UX 9 on HP-9000/730. 177*da2e3ebdSchin HP/UX 10 on HP-9000/857. 178*da2e3ebdSchin HP/UX 11 on pa-risc. 179*da2e3ebdSchin System V Release 3 on Counterpoint C19 180*da2e3ebdSchin System V Release 4 on AT&T Intel 486. 181*da2e3ebdSchin System V Release 4 on NCR 4850 Intel 486. 182*da2e3ebdSchin IRIX Release 4.0.? System V on SGI-MIPS. 183*da2e3ebdSchin IRIX Release 5.1 System V on SGI-MIPS. 184*da2e3ebdSchin IRIX Release 6.[1-5] System V on SGI-MIPS. 185*da2e3ebdSchin System V Release 3.2 on 3B2. 186*da2e3ebdSchin UTS 5.2.6 on Amdahl 3090,5990,580. 187*da2e3ebdSchin System V Release 3.2 on i386. 188*da2e3ebdSchin SMP_DC.OSx olivetti dcosx MIServer-S 2/128. 189*da2e3ebdSchin SMP_DC.OSx Pyramid dcosx MIServer-S 2/160 r3000. 190*da2e3ebdSchin 4.3BSD on Vax 8650. 191*da2e3ebdSchin AIX release 2 on RS6000. 192*da2e3ebdSchin AIX 3.2 on RS6000. 193*da2e3ebdSchin Linux 1.X on Intel 194*da2e3ebdSchin Linux 2.X on Intel 195*da2e3ebdSchin Linux 2.X on Alpha 196*da2e3ebdSchin Linux 2.X on Alpha 197*da2e3ebdSchin Linux 2.X on OS/390 198*da2e3ebdSchin Linux 2.X on sparc 199*da2e3ebdSchin Linux 2.4 on intel itanium 64 200*da2e3ebdSchin Linux Slackware on sparc64 201*da2e3ebdSchin* Linux ARM on i-PAQ 202*da2e3ebdSchin OSF1 on DEC alpha. 203*da2e3ebdSchin OSF4 on DEC alpha. 204*da2e3ebdSchin UMIPS 4.52 on mips. 205*da2e3ebdSchin BSD-i [2-4] on X86. 206*da2e3ebdSchin OpenBSD on X86 207*da2e3ebdSchin NetBSD on X86 208*da2e3ebdSchin FreeBSD on X86 209*da2e3ebdSchin NeXT on Intel X86. 210*da2e3ebdSchin NeXT on HP. 211*da2e3ebdSchin* Windows NT using UWIN on X86 212*da2e3ebdSchin* Windows NT using UWIN on alpha 213*da2e3ebdSchin Windows NT using Cygwin on X86 214*da2e3ebdSchin Windows NT with NutCracker libraries. 215*da2e3ebdSchin Windows NT with Portage libraries. 216*da2e3ebdSchin Windows 3.1 using custom C library. 217*da2e3ebdSchin OpenEdition on MVS 218*da2e3ebdSchin Darwin OS X on PPC 219*da2e3ebdSchin MVS on OS 390 220*da2e3ebdSchin SCO Openserver 3.2 on X86 221*da2e3ebdSchin Unixware 7 on X86 222*da2e3ebdSchin 223*da2e3ebdSchinGood luck!! 224*da2e3ebdSchin 225*da2e3ebdSchinDavid Korn 226*da2e3ebdSchindgk@research.att.com 227*da2e3ebdSchin 228