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