14887SchinThis directory, and its subdirectories contain the source code 24887Schinfor ksh-93; the language described in the second addition of 34887Schinthe book, "The KornShell Command and Programming Language," by 44887SchinMorris Bolsky and David Korn which is published by Prentice Hall. 54887Schinksh-93 has been compiled and run on several machines with several 64887Schinoperating systems. The end of this file contains a partial list of 74887Schinoperating systems and machines that ksh-93 has been known to run on. 84887Schin 94887SchinThe layout of files for ksh-93 has changed somewhat since ksh-88, 104887Schinthe last major release. Most of the source code for ksh remains in 114887Schinthe sh directory. However, the shell editing and history routines 124887Schinare in the edit sub-directory. The code for shell built-ins is 134887Schinin the bltins directory. The data directory contains read-only 144887Schindata tables and messages that are used by the shell. The include 154887Schinfiles remain in the include directory and the shlib directory 164887Schinis gone. The features directory replaces the older install 174887Schindirectory. The method for generating systems specific feature 184887Schininformation has changed substantially. 194887Schin 204887SchinThe Makefile file contains several compilation options that can be set 214887Schinbefore compiling ksh. Options are of the form SHOPT_option and become 224887Schin#define inside the code. These options are set to their recommended 234887Schinvalue and some of these may disappear as options in future releases. 244887SchinA value of 0, or no value represents off, 1 represents on. 254887SchinNote that == is needed, not =, because these are nmake state variables 264887Schinand changing their value will cause all modules that could be affected 274887Schinby this change to be recompiled. 284887SchinThe options have the following defaults and meanings: 294887Schin ACCT off Shell accounting. 30*8462SApril.Chin@Sun.COM ACCTFILE off Enable per user accounting info. 31*8462SApril.Chin@Sun.COM AUDIT off For auditing specific users 32*8462SApril.Chin@Sun.COM AUDITFILE "/etc/ksh_audit" 334887Schin APPEND on Allows var+=val string and array append. 344887Schin BASH off Bash compatibility mode. It is not fully implemented 354887Schin and is experimental. 364887Schin BRACEPAT on C-shell type abc{d,e}f style file generation 374887Schin CMDLIB_BLTIN off Makes all commands in libcmd.a builtins. The 384887Schin SH_CMDLIB_DIR nmake state variable can be used to 394887Schin specify a directory. 404887Schin CMDLIB_DIR off Sets CMDLIB_BLTIN=1 and provides a default value 414887Schin of "/opt/ast/bin" for SH_CMDLIB_DIR. 424887Schin COMPOUND_ARRAY 434887Schin on Allows all components of compound variables except the 444887Schin first to be any string by enclosing in [...]. It also 454887Schin allows components other than the last to be arrays. 464887Schin This is experimental and only partially complete. 474887Schin CRNL off <cr><nl> treated as <nl> in shell grammar. 484887Schin DYNAMIC on Dynamic loading of builtins. (Requires dlopen() interface.) 494887Schin ECHOPRINT off Make echo equivalent to print. 504887Schin ESH on Compile with emacs command line editing. The original 514887Schin emacs line editor code was provided by Mike Veach at IH. 524887Schin FILESCAN on Experimental option that allows fast reading of files 534887Schin using while < file;do ...; done and allowing fields in 544887Schin each line to be accessed as positional parameters. 554887Schin FS_3D off For use with 3-D file system. Enabled automatically for 564887Schin sytems with dynamic linking. 574887Schin KIA off Allow generation of shell cross reference database with -I. 584887Schin MULTIBYTE on Multibyte character handling. Requires mblen() and 594887Schin mbctowc(). 604887Schin NAMESPACE on Allows namespaces. This is experimental, incomplete 614887Schin and undocumented. 624887Schin OLDTERMIO off Use either termios or termio at runtime. 634887Schin OO on Experimental object oriented extension. This option 644887Schin should disappear soon. 654887Schin OPTIMIZE on Optimize loop invariants for with for and while loops. 664887Schin P_SUID off If set, all real uids, greater than or equal to this 674887Schin value will require the -p flag to run suid/sgid scripts. 684887Schin PFSH off Compile with support for profile shell. 694887Schin RAWONLY off Turn on if the vi line mode doesn't work right unless 704887Schin you do a set -o viraw. 714887Schin SEVENBIT off Strip the eigth bit from characters. 724887Schin SPAWN off Use spawn as combined fork/exec. May improve speed on 734887Schin some systems. 74*8462SApril.Chin@Sun.COM STATS on Add .sh.stats compound variable. 754887Schin SUID_EXEC on Execute /etc/suid_exec for setuid, setgid script. 764887Schin TIMEOUT off Set this to the number of seconds for timing out and 774887Schin exiting the shell when you don't enter a command. If 784887Schin non-zero, TMOUT can not be set larger than this value. 79*8462SApril.Chin@Sun.COM TYPEDEF on Enable typeset type definitions. 804887Schin VSH on Compile with vi command line editing. The original vi 814887Schin line editor code was provided by Pat Sullivan at CB. 824887Schin 834887SchinThe following compile options are set automatically by the feature testing: 844887Schin DEVFD Set when /dev/fd is a directory that names open files. 854887Schin SHELLMAGIC 864887Schin Set on systems that recognize script beginning with #! specially. 874887Schin VPIX Set on systems the have /usr/bin/vpix program for running MS-DOS. 884887Schin 894887Schin 904887SchinIn most instances, you will generate ksh from a higher level directory 914887Schinwhich also generates libcmd and libast libraries on which ksh depends. 924887SchinHowever, it is possible to generate ksh, with by running make -f ksh.mk 934887Schinin this directory. The ksh.mk file was generated from the nmake Makefile. 944887SchinIf you do not have make or nmake, but do have a Version 7 UNIX compatible 954887Schinshell, then you can run the script mamexec < Mamfile to build ksh. 964887SchinIf you have nmake, version 2.3 or later, you can use it without the -f ksh.mk. 974887SchinIn either case, ksh relies on libraries libast and libcmd which must be 984887Schinbuilt first. The binary for ksh becomes the file named ./ksh which can 994887Schinbe copied to where ever you install it. 1004887Schin 1014887SchinIf you use old make or the Mamfile, and you system has dynamic shared 1024887Schinlibraries, then you should define the variables mam_cc_static and 1034887Schinmam_cc_dynanamic as the compiler options that request static linking 1044887Schinand dynamic linking respectively. This will decrease the number of 1054887Schinshared libraries that ksh need and cut startup time substantially. 1064887Schin 1074887SchinThe makefile should also generate shcomp, a program that will precompile 1084887Schina script. ksh93 is able to recognize files in this format and process 1094887Schinthem as scripts. You can use shcomp to send out scripts when you 1104887Schindon't want to give away the original script source. 1114887Schin 1124887SchinIt is advisable that you put the line PWD=$HOME;export PWD into the 1134887Schin/etc/profile file to reduce initialization time for ksh. 1144887Schin 1154887SchinTo be able to run setuid/setgid shell scripts, or scripts without read 1164887Schinpermission, the SUID_EXEC compile option must be on, and ksh must be installed 1174887Schinin the /bin directory, the /usr/bin directory, the /usr/lbin directory, 1184887Schinor the /usr/local/bin directory and the name must end in sh. The program 1194887Schinsuid_exec must be installed in the /etc directory, must be owned by root, 1204887Schinand must be a suid program. If you must install ksh in some other directory 1214887Schinand want to be able to run setuid/setgid and execute only scripts, then 1224887Schinyou will have to change the source code file sh/suid_exec.c explicitly. 1234887SchinIf you do not have ksh in one of these secure locations, /bin/sh will 1244887Schinbe invoked with the -p options and will fail when you execute a setuid/setgid 1254887Schinand/or execute only script. Note, that ksh does not read the .profile 1264887Schinor $ENV file when it the real and effective user/group id's are not 1274887Schinequal. 1284887Schin 1294887SchinThe tests sub-directory contains a number of regression tests for ksh. 1304887SchinTo run all these tests with the shell you just built, go to the tests 1314887Schindirectory and run the command 132*8462SApril.Chin@Sun.COM SHELL=$dir/ksh $dir/ksh shtests 133*8462SApril.Chin@Sun.COMwhere dir is the directory of the ksh you want to test. 1344887Schin 1354887SchinThe file PROMO.mm is an advertisement that extolls the virtues of ksh. 1364887SchinThe file sh.1 contains the troff (man) description of this Shell. 1374887SchinThe file nval.3 contains the troff (man) description of the name-value 1384887Schinpair library that is needed for writing built-ins that need to 1394887Schinaccess shell variables. 1404887Schin 1414887SchinThe file sh.memo contains a draft troff (mm) memo describing ksh. The 1424887Schinfile RELEASE88 contains the changes made for ksh88. The file RELEASE93 1434887Schincontains the changes made in this release since ksh-88. The file 1444887SchinRELEASE contains bug fixes made in this release since ksh-88. The file 1454887SchinCOMPATIBILITY contains a list of incompatibilities with ksh-88. The 1464887Schinfile bltins.mm is a draft troff (mm) memo describing how to write 1474887Schinbuilt-in commands that can be loaded at run time. 1484887Schin 1494887SchinMost of the work for internationalization has been done with ksh93. 1504887SchinThe file ksh.msg is a generated file that contains error messages 1514887Schinthat need to be translated. In addition, the function translate() 1524887Schinin sh/init.c has to be completed to interface with the dictionary 1534887Schinlookup. The translate function takes two argument, the string 1544887Schinthat is to be translated and a type which is 1554887Schin 0 when a library string needs translation. 1564887Schin 1 when one of the error messages in ksh.msg needs translation. 1574887Schin 2 when a string in a script needs translation. You use a $ in front 1584887Schin of a double quoted string in a script to indicate that it 1594887Schin needs translation. The -D option for ksh builds the dictionary. 1604887SchinThe translate routine needs to return the translated message. 1614887SchinFor dictionaries that need to use a numeric key, it should be 1624887Schinpossible to use the strhash() function to generate numbers to 1634887Schingo along with each of the messages and to use this number both 1644887Schinwhen generating the dictionary and when converting strings. 1654887SchinIf you encounter error messages of type 1 that are not be translated via 1664887Schinthis translate() function send mail to the address below. 1674887Schin 1684887SchinPlease report any problems or suggestions to: 1694887Schin 1704887Schindgk@research.att.com 1714887Schin 1724887Schin 1734887Schinksh93 has been compiled and alpha tested on the following. An asterisk 1744887Schinsignifies that ksh has been installed as /bin/sh on this machine. 1754887Schin 1764887Schin* Sun OS 4.1.[123] on sparc. 1774887Schin Sun OS 4.1.1 on sun. 1784887Schin Solaris 2.[1-9] on sparc. 1794887Schin Solaris 2.[4-8] on X86. 1804887Schin HP/UX 8 on HP-9000/730. 1814887Schin HP/UX 9 on HP-9000/730. 1824887Schin HP/UX 10 on HP-9000/857. 1834887Schin HP/UX 11 on pa-risc. 1844887Schin System V Release 3 on Counterpoint C19 1854887Schin System V Release 4 on AT&T Intel 486. 1864887Schin System V Release 4 on NCR 4850 Intel 486. 1874887Schin IRIX Release 4.0.? System V on SGI-MIPS. 1884887Schin IRIX Release 5.1 System V on SGI-MIPS. 1894887Schin IRIX Release 6.[1-5] System V on SGI-MIPS. 1904887Schin System V Release 3.2 on 3B2. 1914887Schin UTS 5.2.6 on Amdahl 3090,5990,580. 1924887Schin System V Release 3.2 on i386. 1934887Schin SMP_DC.OSx olivetti dcosx MIServer-S 2/128. 1944887Schin SMP_DC.OSx Pyramid dcosx MIServer-S 2/160 r3000. 1954887Schin 4.3BSD on Vax 8650. 1964887Schin AIX release 2 on RS6000. 1974887Schin AIX 3.2 on RS6000. 1984887Schin Linux 1.X on Intel 1994887Schin Linux 2.X on Intel 2004887Schin Linux 2.X on Alpha 2014887Schin Linux 2.X on Alpha 2024887Schin Linux 2.X on OS/390 2034887Schin Linux 2.X on sparc 2044887Schin Linux 2.4 on intel itanium 64 2054887Schin Linux Slackware on sparc64 2064887Schin* Linux ARM on i-PAQ 2074887Schin OSF1 on DEC alpha. 2084887Schin OSF4 on DEC alpha. 2094887Schin UMIPS 4.52 on mips. 2104887Schin BSD-i [2-4] on X86. 2114887Schin OpenBSD on X86 2124887Schin NetBSD on X86 2134887Schin FreeBSD on X86 2144887Schin NeXT on Intel X86. 2154887Schin NeXT on HP. 2164887Schin* Windows NT using UWIN on X86 2174887Schin* Windows NT using UWIN on alpha 2184887Schin Windows NT using Cygwin on X86 2194887Schin Windows NT with NutCracker libraries. 2204887Schin Windows NT with Portage libraries. 2214887Schin Windows 3.1 using custom C library. 2224887Schin OpenEdition on MVS 2234887Schin Darwin OS X on PPC 2244887Schin MVS on OS 390 2254887Schin SCO Openserver 3.2 on X86 2264887Schin Unixware 7 on X86 2274887Schin 2284887SchinGood luck!! 2294887Schin 2304887SchinDavid Korn 2314887Schindgk@research.att.com 2324887Schin 233