Name Date Size #Lines LOC

..14-Feb-2021-

bltins/H10-Dec-2021-

data/H10-Dec-2021-

edit/H14-Feb-2021-

features/H14-Feb-2021-

fun/H14-Feb-2021-

include/H10-Dec-2021-

sh/H12-Jul-2022-

tests/H10-Dec-2021-

COMPATIBILITYH A D14-Feb-20215.6 KiB137103

DESIGNH A D14-Feb-20217.8 KiB181167

MakefileH A D12-Jul-20227.7 KiB252203

MamfileH A D14-Feb-202175.2 KiB1,5261,525

OBSOLETEH A D14-Feb-20212.9 KiB153151

PROMO.mmH A D14-Feb-20215.7 KiB142140

READMEH A D14-Feb-202111.3 KiB233211

RELEASEH A D14-Feb-2021177.5 KiB3,1113,080

RELEASE88H A D14-Feb-202119.5 KiB423371

RELEASE93H A D14-Feb-202121.8 KiB456438

TYPESH A D14-Feb-20217.2 KiB183156

builtins.mmH A D14-Feb-202125 KiB649648

ksh-regress.rtH A D14-Feb-20211.1 KiB7261

ksh-regress.tstH A D14-Feb-2021934.5 KiB22,54520,108

mamexecH A D14-Feb-20215.2 KiB308303

mamstate.cH A D14-Feb-20212.4 KiB7440

nval.3H A D14-Feb-202127.2 KiB689687

sh.1H A D14-Feb-2021173.6 KiB8,1968,187

sh.memoH A D14-Feb-202194 KiB3,2493,246

shell.3H A D14-Feb-202115 KiB415410

README

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