1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-15 04:32:24 +00:00
cde/src/cmd/ksh93
Martijn Dekker ede479967f resolve/remove USAGE_LICENSE macros; remove repetitive (c) strings
This takes another small step towards disentangling the build
system from the old AT&T environment. The USAGE_LICENSE macros with
author and copyright information, which was formerly generated
dynamically for each file from a database, are eliminated and the
copyright/author information is instead inserted into the AST
getopt usage strings directly.

Repetitive license/copyright information is also removed from the
getopt strings in the builtin commands (src/lib/libcmd/*.c and
src/cmd/ksh93/data/builtins.c). There's no need to include 55
identical license/copyright strings in the ksh binary; one (in the
main ksh getopt string, shown by ksh --man) ought to be enough!
This makes the ksh binary about 10k smaller.

It does mean that something like 'enum --author', 'typeset
--license' or 'shift --copyright' will now not show those notices
for those builtins, but I doubt anyone will care.
2021-01-31 11:00:49 +00:00
..
bltins resolve/remove USAGE_LICENSE macros; remove repetitive (c) strings 2021-01-31 11:00:49 +00:00
data resolve/remove USAGE_LICENSE macros; remove repetitive (c) strings 2021-01-31 11:00:49 +00:00
edit Fix various possible uses of uninitialised variables 2021-01-28 04:54:41 +00:00
features command -x: fix efficiency; always run external cmd (re: acf84e96) 2021-01-30 06:53:19 +00:00
fun Fix for no-argument use of 'cd' in .../fun/dirs 2020-06-14 10:39:48 +02:00
include command -x: fix efficiency; always run external cmd (re: acf84e96) 2021-01-30 06:53:19 +00:00
sh resolve/remove USAGE_LICENSE macros; remove repetitive (c) strings 2021-01-31 11:00:49 +00:00
tests resolve/remove USAGE_LICENSE macros; remove repetitive (c) strings 2021-01-31 11:00:49 +00:00
builtins.mm Fix a large number of typos and other problems (#110) 2020-08-07 00:50:11 +01:00
COMPATIBILITY command -x: fix efficiency; always run external cmd (re: acf84e96) 2021-01-30 06:53:19 +00:00
DESIGN Remove abandoned SHOPT_ENV experiment 2020-09-02 16:09:57 +01:00
ksh-regress.rt Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
ksh-regress.tst Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
mamexec Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
Mamfile resolve/remove USAGE_LICENSE macros; remove repetitive (c) strings 2021-01-31 11:00:49 +00:00
mamstate.c Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
nval.3 fix 24 more typos found with the help of codespell 2020-06-12 01:45:15 +02:00
OBSOLETE Fix a large number of typos and other problems (#110) 2020-08-07 00:50:11 +01:00
PROMO.mm Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
README ksh93/README: we now build on Alpine, 0 regress fails (re: e245856f) 2021-01-27 01:14:13 +00:00
RELEASE Fix a large number of typos and other problems (#110) 2020-08-07 00:50:11 +01:00
RELEASE88 Fix a large number of typos and other problems (#110) 2020-08-07 00:50:11 +01:00
RELEASE93 Fix a large number of typos and other problems (#110) 2020-08-07 00:50:11 +01:00
sh.1 command -x: fix efficiency; always run external cmd (re: acf84e96) 2021-01-30 06:53:19 +00:00
sh.memo Version: 2012-08-01-master 2016-01-11 15:54:23 -05:00
shell.3 shell.3: fix glitch; add missing SH_PRIVILEGED doc 2020-08-15 21:37:46 +01:00
SHOPT.sh Disable SHOPT_KIA (ksh -R) by default 2021-01-23 18:26:38 +00:00
TYPES Fix a large number of typos and other problems (#110) 2020-08-07 00:50:11 +01:00

This directory, and its subdirectories contain the source code
for ksh-93; the language described in the second addition of
the book, "The KornShell Command and Programming Language," by
Morris Bolsky and David Korn which is published by Prentice Hall.
ksh-93 has been compiled and run on several machines with several
operating systems.  The end of this file contains a partial list of
operating systems and machines that ksh-93 has been known to run on.

Most of the source code for ksh is in the src/cmd/ksh93/sh
directory. For information on what's where, see the file DESIGN.

A new '-o posix' shell option has been added to ksh 93u+m that makes the
ksh language more compatible with other shells by following the POSIX
standard more closely. See the manual page for details. It is enabled by
default if ksh is invoked as sh, otherwise it is disabled by default.

The Makefile file contains several compilation options that can be set
before compiling ksh.  Options are of the form SHOPT_option and become
#define inside the code.  These options are set to their recommended
value and some of these may disappear as options in future releases.
A value of 0, or no value  represents off, 1 represents on.
Note that == is needed, not =, because these are nmake state variables
and changing their value will cause all modules that could be affected
by this change to be recompiled.
The options have the following defaults and meanings:
    ACCT         off Shell accounting.
    ACCTFILE     off Enable per user accounting info.
    AUDIT	 off For auditing specific users
    AUDITFILE	 "/etc/ksh_audit"
    APPEND       on  Allows var+=val string and array append.
    BASH         off Bash compatibility mode.  It is not fully implemented
                     and is experimental.
    BRACEPAT     on  C-shell type abc{d,e}f style file generation
    CMDLIB_BLTIN off Makes all commands in libcmd.a builtins.  The
                     SH_CMDLIB_DIR nmake state variable can be used to
		     specify a directory. 
    CMDLIB_DIR   off Sets CMDLIB_BLTIN=1 and provides a default value
                     of "/opt/ast/bin" for SH_CMDLIB_DIR.
    COMPOUND_ARRAY
                 on  Allows all components of compound variables except the
                     first to be any string by enclosing in [...].  It also
                     allows components other than the last to be arrays.
                     This is experimental and only partially complete.
    CRNL         off <cr><nl> treated as <nl> in shell grammar.
    DYNAMIC      on  Dynamic loading of builtins. (Requires dlopen() interface.)
    ECHOPRINT    off Make echo equivalent to print.
    ESH          on  Compile with emacs command line editing.  The original
                     emacs line editor code was provided by Mike Veach at IH.
    FILESCAN     on  Experimental option that allows fast reading of files
                     using while < file;do ...; done and allowing fields in
                     each line to be accessed as positional parameters.
    KIA          off Allow generation of shell cross reference database with -I.
    MULTIBYTE    on  Multibyte character handling.  Requires mblen() and
                     mbctowc().
    NAMESPACE    on  Allows namespaces.  This is experimental, incomplete
                     and undocumented.
    OLDTERMIO    off Use either termios or termio at runtime.
    OO           on  Experimental object oriented extension.  This option
                     should disappear soon.
    OPTIMIZE     on  Optimize loop invariants for with for and while loops.
    P_SUID       off If set, all real uids, greater than or equal to this
                     value will require the -p flag to run suid/sgid scripts.
    PFSH         off Compile with support for profile shell.
    RAWONLY      off Turn on if the vi line mode doesn't work right unless
                     you do a set -o viraw.
    SEVENBIT     off Strip the eighth bit from characters.
    SPAWN        off Use spawn as combined fork/exec.  May improve speed on
                     some systems.
    STATS	 on  Add .sh.stats compound variable.
    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.
    TYPEDEF	 on  Enable typeset type definitions.
    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 feature testing:
    DEVFD   Set when /dev/fd is a directory that names open files.
    SHELLMAGIC
            Set on systems that recognize script beginning with #! specially.


In most instances, you will generate ksh from a higher level directory
which also generates libcmd and libast libraries on which ksh depends.
However, it is possible to generate ksh, with by running make -f ksh.mk
in this directory.  The ksh.mk file was generated from the nmake Makefile.
If you do not have make or nmake, but do have a Version 7 UNIX compatible
shell, then you can run the script mamexec < Mamfile to build ksh.
If you have nmake, version 2.3 or later, you can use it without the -f ksh.mk.
In either case, ksh relies on libraries libast and libcmd which must be
built first.  The binary for ksh becomes the file named ./ksh which can
be copied to where ever you install it.

If you use old make or the Mamfile, and you system has dynamic shared
libraries, then you should define the variables mam_cc_static and
mam_cc_dynanamic as the compiler options that request static linking
and dynamic linking respectively.  This will decrease the number of
shared libraries that ksh need and cut startup time substantially.

The makefile should also generate shcomp, a program that will precompile
a script.  ksh93 is able to recognize files in this format and process
them as scripts.  You can use shcomp to send out scripts when you
don't want to give away the original script source.

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, the /usr/lbin directory,
or the /usr/local/bin 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.

The tests sub-directory contains a number of regression tests for ksh.
To run all these tests with the shell you just built, run the command
	bin/shtests
For help and more options, type
	bin/shtests --man

The file PROMO.mm is an advertisement that extolls the virtues of ksh.
The file sh.1 contains the troff (man) description of this Shell.
The file nval.3 contains the troff (man) description of the name-value
pair library that is needed for writing built-ins that need to
access shell variables.

The file sh.memo contains a draft troff (mm) memo describing ksh.  The
file RELEASE88 contains the changes made for ksh88.  The file RELEASE93
contains the changes made in this release since ksh-88.  The file
RELEASE contains bug fixes made in this release since ksh-88.  The file
COMPATIBILITY contains a list of incompatibilities with ksh-88.  The
file bltins.mm is a draft troff (mm) memo describing how to write
built-in commands that can be loaded at run time.

Most of the work for internationalization has been done with ksh93.
The file ksh.msg is a generated file that contains error messages
that need to be translated.  In addition, the function translate()
in sh/init.c has to be completed to interface with the dictionary
lookup.  The translate function takes two argument, the string
that is to be translated and a type which is
    0 when a library string needs translation.
    1 when one of the error messages in ksh.msg needs translation.
    2 when a string in a script needs translation.  You use a $ in front
      of a double quoted string in a script to indicate that it
      needs translation.  The -D option for ksh builds the dictionary.
The translate routine needs to return the translated message.
For dictionaries that need to use a numeric key, it should be
possible to use the strhash() function to generate numbers to
go along with each of the messages and to use this number both
when generating the dictionary and when converting strings.
If you encounter error messages of type 1 that are not be translated via
this translate() function send mail to the address below.

Please report any problems or suggestions to:

https://github.com/ksh93/ksh


ksh 93u+m 1.0.0 has been compiled and alpha tested on the following.
An asterisk signifies minor regression test failures (one or two minor
things amiss), two asterisks signify moderate regression test failures
(some functionality does not work), and three asterisks signify serious
failures (crashes, and/or essential functionality does not work).

*	AIX 7.1 on RISC (PowerPC)
*	DragonFly BSD 5.8 on x86_64
	FreeBSD 12.2 on x86_64
	FreeBSD 12.2 on arm64 (thanks to hyenias for donating access to a Pi)
	GNU/Linux: Alpine 3.12.3 (musl C library) on x86_64
	GNU/Linux: CentOS 8.2 on x86_64
	GNU/Linux: Debian 10.7 on x86_64
	GNU/Linux: Gentoo 2.7 on i386
	GNU/Linux: NixOS 19.09 on x86_64
	GNU/Linux: Slackware 14.2 on x86_64
	GNU/Linux: Ubuntu 16.04 on x86_64
***	HP-UX B.11.11 on pa-risc
*	illumos: OmniOS 2020-08-19 (gcc) on x86_64
	macOS 10.14.6 (Mojave) on x86_64
***	NetBSD 8.1 and 9.0 on x86_64
*	OpenBSD 6.8 on x86_64
*	Solaris 11.4 (gcc) on x86_64
	Solaris 11.4 (Solaris Studio 12.5 cc) on x86_64
*	UnixWare 7.1.4 on x86
***	Windows 7 using Cygwin on x86

Good luck!!

The ksh 93u+m contributors
https://github.com/ksh93/ksh

Originally written by:
David Korn
dgk@research.att.com