1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-15 04:32:24 +00:00

Squashed 'cde/programs/dtksh/ksh93/' content from commit 66e1d4464

git-subtree-dir: cde/programs/dtksh/ksh93
git-subtree-split: 66e1d44642
This commit is contained in:
Jon Trulson 2021-06-26 13:39:31 -06:00
commit 12bbb66931
1269 changed files with 369117 additions and 0 deletions

19
.github/workflows/ci.yml vendored Normal file
View file

@ -0,0 +1,19 @@
name: CI
on: [push]
jobs:
Linux:
name: Linux
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Build
run: bin/package make
- name: Regression tests
run: |
export TZ=UTC
ulimit -n 1024
script -q -e -c "bin/shtests"

60
.gitignore vendored Normal file
View file

@ -0,0 +1,60 @@
# Project-specific files
arch
tgz
lcl
# Flat make libs, binaries, etc
/bin/.paths
/bin/ar
/bin/cc
/bin/crossexec
/bin/ditto
/bin/filter
/bin/hurl
/bin/iffe
/bin/ksh
/bin/mamake
/bin/mktest
/bin/ok/
/bin/proto
/bin/pty
/bin/ratz
/bin/regress
/bin/release
/bin/rt
/bin/shcomp
/bin/suid_exec
/fun/
/include/
/lib/file/
/lib/lib/
/lib/libast.a
/lib/libcmd.a
/lib/libdll.a
/lib/libshell.a
/lib/libsum.a
/lib/make/
/lib/package/gen/
/lib/probe/
/man/
# This one keeps changing its license header, causing git to show an
# uncommitted file. It's always re-copied anyway, and not for direct
# invocation, so exclude. The source file is: src/cmd/INIT/execrate.sh
bin/execrate
# Miscellaneous artefacts
*.bak
*.sav
*.old
*.orig
.*.swp
*.DS_Store
*~
.nfs*
*.tmp
*.rej
*.project
*.core
core
**/#*#

87
LICENSE.md Normal file
View file

@ -0,0 +1,87 @@
Eclipse Public License - v 1.0
THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
1. DEFINITIONS
"Contribution" means:
a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
b) in the case of each subsequent Contributor:
i) changes to the Program, and
ii) additions to the Program;
where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program.
"Contributor" means any person or entity that distributes the Program.
"Licensed Patents" mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program.
"Program" means the Contributions distributed in accordance with this Agreement.
"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
2. GRANT OF RIGHTS
a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form.
b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program.
d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement.
3. REQUIREMENTS
A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
a) it complies with the terms and conditions of this Agreement; and
b) its license agreement:
i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose;
ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits;
iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and
iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange.
When the Program is made available in source code form:
a) it must be made available under this Agreement; and
b) a copy of this Agreement must be included with each copy of the Program.
Contributors may not remove or alter any copyright notices contained within the Program.
Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution.
4. COMMERCIAL DISTRIBUTION
Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense.
For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages.
5. NO WARRANTY
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
6. DISCLAIMER OF LIABILITY
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
7. GENERAL
If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed.
All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive.
Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation.

892
NEWS Normal file
View file

@ -0,0 +1,892 @@
This documents significant changes in the 93u+m branch of AT&T ksh93.
For full details, see the git log at: https://github.com/ksh93/ksh
Any uppercase BUG_* names are modernish shell bug IDs.
2021-01-30:
- The -x option to the 'command' built-in now causes it to bypass built-ins
so that it always runs/queries an external command. See 'command --man'.
- Fixed a bug in 'command -x' that caused the minimum exit status to be 1 if
a command with many arguments was divided into several command invocations.
- The 2020-08-16 fix is improved with a compile-time feature test that
detects if and how the OS uses data alignment in the arguments list,
maximising the efficiency of 'command -x' for the system it runs on.
2021-01-24:
- Fixed a bug in 'typeset': combining the -u option with -F or -E caused the
variable to become a hexadecimal floating point in error.
- Fixed: an unquoted variable expansion evaluated in a DEBUG trap action caused
IFS field splitting to be deactivated in code executed after the trap action.
This bug was introduced in ksh 93t+ 2009-11-30.
2021-01-23:
- Fixed: when the DEBUG trap was redefined in a subshell, the DEBUG trap in
the parent environment was corrupted or the shell crashed.
When a redirection was used in a DEBUG trap action, the trap was disabled.
DEBUG traps were also incorrectly inherited by subshells and ksh functions.
All this was caused by a bug introduced in ksh 93t 2008-07-25.
2021-01-22:
- Compile-time shell options can now be edited in src/cmd/ksh93/SHOPT.sh
before building.
2021-01-20:
- Fixed: executing a DEBUG trap in a command substitution had side effects
on the exit status ($?) of non-trap commands.
This bug was introduced in ksh 93t 2008-11-04.
- The typeset builtin command now gives an informative error message if an
incompatible combination of options is given.
2021-01-19:
- Fixed a crash when using 'cd' in a virtual/non-forking subshell in a
situation where the current working directory cannot be determined.
2021-01-08:
- Fixed a crash on exceeding the maximum size of the $PS1 prompt.
The maximum size is also increased from 160 to 256 bytes.
2021-01-07:
- Fixed a crash that could occur while ksh updated ${.sh.match}.
- Any changes to the hash table (a.k.a. "tracked aliases", i.e. cached $PATH
searches) in a subshell now no longer affect the parent shell's hash table.
2021-01-05:
- Fixed a bug in 'cd' that caused 'cd ./foo' to search for 'foo' in $CDPATH.
2021-01-03:
- The invocation
$ ksh +s
caused an infinite loop and corrupted ~/.sh_history. This is now fixed so
that the '-s' option is automatically turned on if there are no non-option
command arguments, as documented in Bolsky & Korn (1995), p. 261.
2020-10-22:
- Fixed: 'typeset -F0', 'typeset -E0', and 'typeset -X0' floating point
numerics having a precision of 0 with variable assignment.
'typeset -F0 x; x=4.56' worked but not 'typeset -F0 x=4.56'.
2020-10-21:
- Fixed: More concisely correct the exporting of uppercase and lowercase
variables when only the export and change case attributes were applied.
This fix improves upon the previous 2020-09-30 modifications.
2020-10-06:
- The security of virtual/non-forking subshells that locally change the present
working directory (PWD) using 'cd' has been improved in two ways.
1. On entering a subshell, if the parent shell's PWD proves inaccessible upon
saving it, the subshell will now fork into a separate process so the
parent process never changes its PWD, avoiding the need to restore it.
2. If some attack renders the parent shell's PWD unrestorable *after* ksh
enters a virtual subshell, ksh will now error out on exiting it, as
continuing would mean running arbitrary commands in the wrong PWD.
Hopefully this is an acceptable compromise between performance and security.
The proper fix would be to always fork a subshell when changing the working
directory within it, but the resulting slowdown would likely be unpopular.
2020-09-30:
- Fixed: 'typeset -xu' and 'typeset -xl' (export + change case) failed to
change the case of a variable's value in certain conditions.
- A ksh 93u+ regression was fixed in the combination of ERR trap handling and
the 'pipefail' option. A pipeline now triggers the ERR trap correctly again
if the 'pipefail' option is active and any of the pipeline elements return a
nonzero exit status. Similarly, if both the 'errexit' and 'pipefail' options
are active, ksh now correctly exits if any pipeline element returns nonzero.
- Autoloading a function no longer causes the calling script's $LINENO to be
off by the number of lines in the function definition file that was loaded.
This also corrects line numbers in warnings and error messages.
2020-09-28:
- While executing a ksh-style function, ksh 93u+ ignored all signals for which
the function had not set a local trap, except for SIGINT and SIGQUIT. This
was contrary to the manual, which states that a "trap condition that is not
caught or ignored by the function causes the function to terminate and the
condition to be passed on to the caller". This has now been fixed in 93u+m to
match the documentation, so that e.g. global traps work as expected again.
2020-09-27:
- The shell's lexical analysis of a 'case' statement within a do...done block
within a command substitution of the form $(...) has been fixed so that code
like the following no longer throws a spurious syntax error:
x=$(for i in 1; do case $i in word) true;; esac; done)
Previously, this required a leading parenthesis before 'word', although the
syntax error claimed that the ';;' was unexpected.
2020-09-26:
- 'whence -f' now completely ignores the existence of functions, as documented.
- ksh now does not import environment variables whose names are not valid in
the shell language, as it would be impossible to change or unset them.
However, they stay in the environment to be passed to child processes.
2020-09-25:
- whence -v/-a now reports the path to the file that an "undefined" (i.e.
autoloadable) function will be loaded from when invoked, if found in $FPATH.
- When ksh invoked a shell script that does not have a leading
#!/hashbang/path, 'ps' and /proc/<PID>/cmdline showed corrupted output if
the new script's command line was shorter than that of the invoking script.
This has been fixed by wiping the arguments buffer correctly.
2020-09-24:
- An omission made it impossible to turn off brace expansion within command
substitutions (`...`, $(...) or ${ ...; }) as the code for parsing these
did not check the -B/braceexpand option. This check has now been added.
2020-09-23:
- Fixed a crash that could occur when running a pipeline containing
backtick-style command substitutions with job control enabled.
- Fixed a crash that occurred when using 'typeset -u' or 'typeset -l' on a
special variable such as PATH, ENV or SHELL.
2020-09-21:
- A bug was fixed that caused command substitutions embedded in here-documents
to lose the output of the commands they ran. This bug occurred when ksh was
compiled with the SHOPT_SPAWN compile-time option.
- Bugfix: var=$(< file) now reads the file even if the standard inout, standard
output and/or standard error file descriptors are closed.
2020-09-20:
- Bugfix: when whence -v/-a found an "undefined" (i.e. autoloadable) function
in $FPATH, it actually loaded the function as a side effect of reporting on
its existence. Now it only reports, as documented.
- 'whence' will now canonicalise paths properly, resolving '.' and '..'
elements in paths given to it. It also no longer prefixes a spurious
double slash when doing something like 'cd / && whence bin/echo'.
2020-09-18:
- Setting the 'posix' option now turns off the 'braceexpand' option, as brace
expansion is not specified by POSIX and potentially incompatible with sh
scripts. In addition, 'set -o posix' now turns on the 'letoctal' option
instead of controlling that behaviour directly. 'set +o posix' does the
reverse of these.
2020-09-17:
- In the vi and emacs line editors, repeat count parameters can now also be
used for the arrow keys and the forward-delete key. E.g., in emacs mode,
<ESC> 7 <left-arrow> will now move the cursor seven positions to the left.
In vi control mode, this would be entered as: 7 <left-arrow>.
- When a background job on an interactive shell received SIGINT or SIGPIPE, the
job termination message was empty. It now shows "Interrupt" or "Broken Pipe".
- The -m (-o monitor) option is no longer ignored when specified on the shell
invocation command line.
- A script that is interrupted with Ctrl+C now terminates its background jobs
as expected, unless the -m (-o monitor) option was turned on.
2020-09-14:
- Corrected rounding of floating point values by ksh's printf %f formatting
operator. Fix contributed by @hyenias.
- The forward-delete key now works as expected in emacs and vi editing modes.
2020-09-11:
- The 'command' regular builtin utility (which runs a simple command, removing
special properties) has been made fully POSIX compliant.
1. The 'command' name can now result from an expansion (fixing BUG_CMDEXPAN),
e.g. 'c=command; "$c" ls' and 'set -- command ls; "$@"' now work.
2. If and only if the POSIX mode (the new -o posix shell option) is active,
then the 'command' utility now disables not only "special" but also
"declaration" properties of builtin commands that it invokes, meaning:
a. arguments that start with a variable name followed by '=' are
always treated as regular words subject to normal shell syntax;
b. 'command' can now stop the shell from exiting if a command that it
invokes tries to modify a readonly variable (fixing BUG_CMDSPEXIT).
- The 'history' (== 'hist -l') and 'r' (== 'hist -s') interactive shell
history commands have reverted to preset aliases and are now only loaded if
the shell is interactive and not initialised in POSIX mode. This avoids
unneeded conflicts with external commands by these names, particularly 'r'.
2020-09-09:
- Fixed BUG_LOOPRET2 and related bugs. The 'exit' and 'return' commands without
an argument now correctly default to passing down the exit status of the
last-run command. Tests like the following, in which the last-run command is
'false', now correctly output 1 instead of 0:
fn() { return || true; }; false; fn; echo "$?"
fn() { while return; do true; done; }; false; fn; echo "$?"
fn() { for i in 1; do return; done; }; false; fn; echo "$?"
fn() { case 1 in 1) return ;; esac; }; false; fn; echo "$?"
fn() { { return; } 2>&1; }; false; fn; echo "$?"
2020-09-05:
- Fixed erroneous syntax errors in parameter expansions such as ${var:-wor)d}
or ${var+w(ord}. The parentheses now correctly lose their normal grammatical
meaning within the braces. Fix by Eric Scrivner backported from ksh2020.
2020-09-04:
- Fixed a bug that caused a syntax error to be thrown if the special parameter
expansions ${!} and ${$} (including braces) were used within a here-document.
Bug reported by @Saikiran-m on GitHub.
2020-09-01:
- The bash-style '&>file' redirection shorthand (for '>file 2>&1') is now
always recognised and not only when running rc/profile init scripts. It no
longer issues a warning. This brings ksh93 in line with mksh, bash and zsh.
- A long-form shell option '-o posix' has been added, which implements a
mode for better compatibility with the POSIX standard. It is automatically
turned on if ksh is invoked under the name 'sh'.
For now, it:
* disables the &> redirection shorthand
* causes the 'let' arithmetic command to recognise octal numbers by
leading zeros regardless of the setting of the 'letoctal' option
* causes file descriptors > 2 to be left open when invoking another program
* makes the <> redirection operator default to stdin instead of stdout
(this keeps the 2020-05-13 BUG_REDIRIO fix for the POSIX mode while
restoring traditional ksh93 behaviour for backwards compatibility)
* disables a noncompliant 'test -t' == 'test -t 1' compatibility hack
* disables passing an exported variable's attributes (such as integer or
readonly) to a new ksh process through the environment
2020-08-19:
- Sped up the 'read' command on most systems by 15-25%. Fixed a hanging bug
on reading from a FIFO that could occur on macOS.
2020-08-17:
- 'command -p' incorrectly used the hash table entry (a.k.a. tracked alias)
for a command if its path was previously hashed. It has now been fixed so
it never consults the hash table.
2020-08-16:
- Fixed 'command -x' on macOS, Linux and Solaris by accounting for a 16-byte
argument alignment. If execution does fail, it now aborts with an internal
error message instead of entering an infinite retry loop.
2020-08-13:
- Fixed memory leaks and a crashing bug that occurred when defining and
running functions in subshells.
2020-08-11:
- Fixed an intermittent crash upon running a large number of subshells.
2020-08-10:
- A number of fixes have been applied to the printf formatting directives
%H and %#H (as well as the undocumented equivalents %(html)q and %(url)q):
1. Both formatters have been made multibyte/UTF-8 aware, and no longer
delete multibyte characters. Invalid UTF-8 byte sequences are rendered
as ASCII question marks.
2. %H no longer wrongly changes spaces to non-breaking spaces (&nbsp;).
3. %H now converts the single quote (') to '%#39;' instead of '&apos;'
which is not a valid entity in all HTML versions.
4. %#H failed to encode some reserved characters (e.g. '?') while encoding
some unreserved ones (e.g. '~'). It now percent-encodes all characters
except those 'unreserved' as per RFC3986 (ASCII alphanumeric plus -._~).
- Fixed a crash that occurred intermittently after running an external
command from a command substitution expanded from the $PS1 shell prompt.
2020-08-09:
- File name generation (a.k.a. pathname expansion, a.k.a. globbing) now
never matches the special navigational names '.' (current directory) and
'..' (parent directory). This change makes a pattern like .* useful; it
now matches all hidden files (dotfiles) in the current directory, without
the harmful inclusion of '.' and '..'.
2020-08-08:
- Argument checking in the 'redirect' builtin command (see 2020-06-11) has
been improved to error out before executing redirections. For example, an
error like 'redirect ls >foo.txt' now will not create 'foo.txt' and will
not leave your standard output permanently redirected to it.
2020-08-06:
- Added the '${.sh.pid}' variable as an alternative to Bash's '$BASHPID'.
This variable is set to the current shell's PID, unlike '$$' (which is
set to the parent shell's PID). In virtual subshells '${.sh.pid}' is not
changed from its previous value, while in forked subshells '${.sh.pid}'
is set to the subshell's process ID.
2020-08-05:
- Fixed a bug in functions that caused ksh to crash when an array with an
unset method was turned into a multidimensional array.
- Fixed a bug that caused scripts to continue running after over-shifting
in a function when the function call had a redirection.
- When generating shellquoted strings (such as with 'printf %q'), the
hexadecimal value of a quoted unprintable character was not protected with
square braces, e.g. 0x12 followed by '3' would be quoted as '\x123', which
is a different value. Such strings are now quoted like '\x[12]3' if the
next character is a hexadecimal digit.
2020-07-31:
- Fixed a bug that caused multidimensional associative arrays to be created
with an extra array member.
- Fixed a bug that caused the expansions of positional parameters $1 - $9,
as well as special parameters such as $? and $-, to corrupt any multibyte
characters immediately following the expansion if a UTF-8 locale is active.
2020-07-29:
- On a ksh compiled to use fork(2) to run external commands, a bug has been
fixed that caused signals (such as SIGINT, Ctrl+C) to be ignored within a
non-forked subshell after running an external command within that subshell.
2020-07-25:
- Fixed BUG_MULTIBIFS: Multibyte characters can now be used as IFS
delimiters. "$*" was incorrectly joining positional parameters on
the first byte of a multibyte character. This was due to truncation
based on the incorrect assumption the IFS would never be larger
than a single byte.
- Fixed a bug that caused the sleep builtin to continue after being given
an unrecognized option. 'sleep -: 1' will now show a usage message and
exit instead of sleep for one second.
- Fixed a bug that caused the 'typeset' variable attributes -a, -A, -l, and
-u to leak out of a subshell if they were set without assigning a value.
2020-07-23:
- Fixed an infinite loop that could occur when ksh is the system's /bin/sh.
- A command substitution that is run on the same line as a here-document
will no longer cause a syntax error.
2020-07-22:
- Fixed two race conditions when running external commands on
interactive shells with job control active.
2020-07-20:
- If a shell function and a built-in command by the same name exist,
'whence -a' and 'type -a' now report both.
- Fixed a bug that caused file descriptors opened with 'redirect' or 'exec'
to survive a subshell environment after exiting it.
2020-07-19:
- Fixed a crash that occurred in the '.' command when using kshdb.
- Fixed a crash that occurred when attempting to use redirection with an
invalid file descriptor.
2020-07-16:
- The 'history' and 'r' default aliases have been made regular built-ins,
leaving zero default aliases.
- Fixed a bug that caused 'sleep -s' to have no effect with intervals longer
than 30 seconds.
- The accuracy of the sleep builtin has been improved. It no longer ignores
microseconds and doesn't add extra milliseconds when the interval is less
than 31 seconds.
2020-07-15:
- The 'autoload', 'compound', 'float', 'functions', 'integer' and 'nameref'
default aliases have been converted into regular built-in commands, so
that 'unalias -a' does not remove them. Shell functions can now use
these names, which improves compatibility with POSIX shell scripts.
- The End key escape sequence '^[[F' is now handled in the emacs and vi editing
modes. The End key moves the cursor to the end of the line (in contrast to
the Home key doing the opposite).
2020-07-14:
- Fixed a bug that caused 'set -b' to have no effect.
- Following the 'time' keyword, the 'times' builtin command now also
supports millisecond precision.
2020-07-13:
- Fixed a fork bomb that could occur when the vi editor was sent SIGTSTP
while running in a ksh script.
- Appending a lone percent to the end of a format specifier no longer
causes a syntax error. The extra percent will be treated as a literal
'%', like in Bash and zsh.
- The 'time' keyword now has proper support for millisecond precision.
Although this feature was previously documented, the 'time' keyword
only supported up to centisecond precision, which caused a command
like the one below to return '0.000' on certain operating systems:
$ TIMEFORMAT='%3R'; time sleep .003
- The 'time' keyword now zero-pads seconds less than ten (like mksh).
2020-07-10:
- Fixed a bug that caused types created with 'typeset -T' to throw an error
when used if the type name started with a lowercase 'a'.
- A potential crash due to memory corruption when using many file
descriptors has been fixed.
2020-07-09:
- Fixed a crash on syntax error when sourcing/dotting multiple files.
- Fixed a crash when listing indexed arrays.
- Fixed a memory leak when restoring PATH when temporarily setting PATH
for a command (e.g. PATH=/foo/bar command ...) or in a virtual subshell.
- Combining ((...)) with redirections no longer causes a syntax error
due to the parser handling '>' incorrectly.
- Fixed a bug that corrupted KIA/CQL cross-reference databases created using
ksh's -R option; shell warnings were wrongly included in the database file.
- The shell's quoting algorithm (used in xtrace, printf %q, and more) has been
fixed for UTF-8 (Unicode) locales; it no longer needlessly and inconsistently
encodes normal printable UTF-8 characters into hexadecimal \u[xxxx] codes.
2020-07-07:
- Four of the date formats accepted by 'printf %()T' have had their
functionality altered to the common behavior of date(1):
- '%k' and '%l' print the current hour with blank padding, the former
based on a 24-hour clock and the latter a twelve hour clock. These
are common extensions present on Linux and *BSD.
- '%f' prints a date with the format string '%Y.%m.%d-%H:%M:%S' (BusyBox).
- '%q' prints the quarter of the year (GNU).
2020-07-06:
- 'notty' is now written to the ksh auditing file instead of '(null)' if
the user's tty could not be determined.
- Unsetting an associative array no longer causes a memory leak to occur.
2020-07-05:
- In UTF-8 locales, fix corruption of the shell's internal string quoting
algorithm (as used by xtrace, 'printf %q', and more) that occurred when
the processing of a multibyte character was interrupted.
2020-07-03:
- Backslashes are no longer escaped in the raw Bourne Shell-like editing
mode in multibyte locales, i.e. backslashes are no longer treated like
Control-V if the emacs and vi modes are disabled.
- Deleting a backslash in vi mode with Control-H or Backspace now only
escapes a backslash if it was the previous input. This means erasing a
string such as 'ab\\\' will only cause the first backslash to escape a
Backspace as '^?', like in emacs mode.
- An odd interaction with Backspace when the last character of a separate
buffer created with Shift-C was '\' has been fixed. '^?' will no longer
be output repeatedly when attempting to erase a separate buffer with
a Backspace. Note that buffers created with Shift-C are not meant to be
erasable:
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/vi.html#tag_20_152_13_49
- The 'kill' builtin now supports the SIGINFO signal (on operating systems
with support for SIGINFO).
2020-07-02:
- Fixed a crash that occurred if a directory named '.paths' existed in any
directory listed in $PATH. The fix was to only read '.paths' if it is a
regular file or a symlink to a regular file.
2020-06-30:
- 'read -u' will no longer crash with a memory fault when given an out of
range or negative file descriptor.
- The '=~' operator no longer raises an error if a regular expression
combines the '{x}' quantifier with a sub-expression.
2020-06-28:
- Variables created with 'typeset -RF' no longer cause a memory fault
when accessed.
- Unsetting an array that was turned into a compound variable will no
longer cause silent memory corruption.
- Variables created with 'readonly' in functions are now set to the
specified value instead of nothing. Note that 'readonly' does not
create a function-local scope, unlike 'typeset -r' which does.
2020-06-26:
- Changing to a directory that has a name starting with a '.' will no
longer fail if preceded by '../' (i.e. 'cd ../.local' will now work).
2020-06-24:
- Fixed buggy tab completion of tilde-expanded paths such as
~/some in 'vi' mode.
- In the raw/default Bourne Shell-like editing mode that occurs when neither
the 'emacs' nor the 'vi' shell option is active:
* tab completion is now correctly disabled, instead of enabled and broken;
* entering tab characters now moves the cursor the correct amount.
2020-06-23:
- Fixed a bug that caused combining process substitution with redirection
to create a bizarre file in the user's current working directory.
- Using process substitution while the shell is interactive no longer
causes the process ID of the asynchronous process to be printed.
2020-06-22:
- The 'stop' and 'suspend' default aliases have been converted into regular
built-in commands, so that 'unalias -a' does not remove them, 'suspend'
can do a couple of sanity checks, and something like
cmd=stop; $cmd $!
will now work. See 'stop --man' and 'suspend --man' for more information.
- Fixed a bug that caused the kill and stop commands to segfault when given
a non-existent job.
- Nested functions no longer ignore variable assignments that were prefixed
to their parent function, i.e. 'VAR=foo func' will now set $VAR to 'foo'
in the scope of any nested function 'func' runs.
2020-06-20:
- Fixed a bug that caused setting the following variables as readonly in
a virtual subshell to affect the environment outside of the subshell:
$_
${.sh.name}
${.sh.subscript}
${.sh.level}
$RANDOM
$LINENO
- Fixed two bugs that caused `unset .sh.lineno` to always produce a memory
fault and `(unset .sh.level)` to memory fault when run in nested
functions.
2020-06-18:
- A two decade old bug that caused 'whence -a' to base the path of
tracked aliases on the user's current working directory has been
fixed. Now the real path to tracked aliases is shown when '-a' is
passed to the whence command.
2020-06-17:
- A bug in 'unset -f' was fixed that prevented shell functions from
unsetting themselves while they were running. A POSIX function no longer
crashes when doing so, and a KornShell-style function no longer silently
ignores an 'unset -f' on itself. A function of either form now continues
running after unsetting itself, and is removed at the end of the run.
2020-06-16:
- Passing the '-d' flag to the read builtin will no longer cause the '-r'
flag to be discarded when 'read -r -d' is run.
- Fix BUG_CMDSPASGN: preceding a "special builtin"[*] with 'command' now
prevents preceding invocation-local variable assignments from becoming global.
[*] https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_14
2020-06-15:
- The 'source' alias has been converted into a regular built-in command.
- Functions that set variables in a virtual subshell will no longer affect
variables of the same name outside of the virtual subshell's environment.
- Terse usage messages written by builtin commands now point the user to
the --help and --man options for more information.
2020-06-14:
- 'read -S' is now able to correctly handle strings with double quotes
nested inside of double quotes.
2020-06-13:
- Fixed a timezone name determination bug on FreeBSD that caused the
output from `LC_ALL=C printf '%T' now` to print the wrong time zone name.
2020-06-11:
- Fixed a bug that caused running 'builtin -d' on a special builtin to
delete it. The man page for the 'builtin' command documents that special
builtins cannot be deleted.
- POSIX compliance fix: It is now possible to set shell functions named
'alias' or 'unalias', overriding the commands by the same names. In
technical terms, they are now regular builtins, not special builtins.
- The redirect='command exec' alias has been converted to a regular
'redirect' builtin command that only accepts I/O redirections, which
persist as in 'exec'. This means that:
* 'unlias -a' no longer removes the 'redirect' command;
* users no longer accidentally get logged out of their shells if
they type something intuitive but wrong, like 'redirect ls >file'.
- The undocumented 'login' and 'newgrp' builtin commands have been removed.
These replaced your shell session with the external commands by the same
name, as in 'exec'. If an error occurred (e.g. due to a typo), you would
end up immediately logged out.
If you do want this behaviour, you can restore it by setting:
alias login='exec login'
alias newgrp='exec newgrp'
2020-06-10:
- The 'hash' utility is now a regular builtin instead of an alias to
'alias -t --'. The functionality of the old command has been removed
from the alias builtin.
- 'set +r' is no longer able to unset the restricted option. This change
makes the behavior of 'set +r' identical to 'set +o restricted'.
2020-06-09:
- The 'unalias' builtin will now return a non-zero status if it tries
to remove a previously set alias that is not currently set.
2020-06-08:
- Fix an issue with the up arrow key in Emacs editing mode.
Emacs editing mode is bugged in ksh93u+ and ksh2020. Let's
say you were to run the following commands after starting
a fresh instance of ksh:
$ alias foo='true'
$ unalias foo
If you type 'a' and then press the up arrow on your keyboard,
ksh will complete 'a' to `alias foo='true'` by doing a reverse
search for the last command that starts with 'a'.
Run the alias command again, then type 'u' and press the up
arrow key again. If ksh is in Vi mode, you will get `unalias foo`,
but in Emacs mode you will get `alias foo='true'` again.
All subsequent commands were ignored as ksh was saving the first
command and only based later searches off of it.
- If 'set -u'/'set -o nounset' is active, then the shell now errors out if a
nonexistent positional parameter such as $1, $2, ... is accessed, as other
shells do and POSIX requires. (This does *not* apply to "$@" and "$*".)
- If 'set -u'/'set -o nounset' is active, then the shell now errors out if $!
is accessed before the shell has launched any background process.
- Removed support for an obscure early 1990s Bell Labs file system research
project called 3DFS, which has not existed for decades. This removes:
- an obnoxious default alias 2d='set -f;_2d' that turned off your file name
wildcard expansion and then tried to run a nonexistent '_2d' command
- undocumented builtins 'vmap' and 'vpath' that only printed error messages
- a non-functional -V unary operator for the test and [[ commands
- If the last program run by a ksh script exits with a signal (e.g. crashed),
ksh itself now exits normally instead of repeating that same signal.
In addition, using 'exit x' for x > 256 no longer makes ksh issue a signal.
2020-06-06:
- The 'times' command is now a builtin command that conforms to POSIX
instead of an alias for the 'time' command. It displays the accumulated
user and system CPU times, one line with the times used by the shell and
another with those used by all of the shell's child processes.
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_27
- The default aliases command='command ' and nohup='nohup ' have been
removed because they caused breakage in an attempt to circumvent other
breakage which is being fixed. In the unlikely even that anyone still
needs alias substitution to continue on the command argument following
'command' or 'nohup', it's easy to set these aliases yourself.
2020-06-05:
- Fix a bug that caused special variables such as PATH, LANG, LC_ALL,
etc. to lose their effect after being unset in a subshell. For example:
(unset PATH; PATH=/dev/null; ls); : wrongly ran 'ls'
(unset LC_ALL; LC_ALL=badlocale); : failed to print a diagnostic
This also fixes BUG_KUNSETIFS: unsetting IFS in a subshell failed if IFS
was set to the empty value in the parent shell.
- Fix crashes on some systems, including at least a crash in 'print -v' on
macOS, by eliminating an invalid/undefined use of memccpy() on overlapping
buffers in the commonly used sfputr() function.
- Fix the ${.sh.subshell} level counter; it is no longer reset to zero when a
non-forked subshell happens to fork into a separate process for some reason
(an internal implementation detail that should be unnoticeable to scripts).
2020-06-04:
- Fix BUG_KBGPID: the $! special parameter was not set if a background job
(somecommand &) or co-process (somecommand |&) was launched as the only
command within a braces block with an attached redirection, for example:
{
somecommand &
} >&2
With the bug, $! was unchanged; now it contains the PID of somecommand.
2020-05-31:
- Fix a bug in autoloading functions. Directories in the path search list
which should be skipped (e.g. because they don't exist) did not interact
correctly with autoloaded functions, so that a function to autoload was
not always found correctly.
Details: https://github.com/att/ast/issues/1454
2020-05-30:
- Fix POSIX compliance of 'test'/'[' exit status on error. The command now
returns status 2 instead of 1 when given an invalid number or arithmetic
expression, e.g.:
[ 123 -eq 123x ]; echo $?
now outputs 2 instead of 1.
2020-05-29:
- Fix BUG_FNSUBSH: functions can now be correctly redefined and unset in
subshell environments (such as ( ... ), $(command substitutions), etc).
Before this fix, this was silently ignored, causing the function by the
same name from the parent shell environment to be executed instead.
fn() { echo mainsh; }
(fn() { echo subsh; }; fn); fn
This now correctly outputs "subsh mainsh" instead of "mainsh mainsh".
ls() { echo "ls executed"; }
(unset -f ls; ls); ls
This now correctly lists your directory and then prints "ls executed",
instead of printing "ls executed" twice.
- Fix a similar bug with aliases. These can now be correctly unset
in subshell environments.
2020-05-21:
- Fix truncating of files with the combined redirections '<>;file' and
'<#pattern'. The bug was caused by out-of-sync streams.
Details and discussion: https://github.com/att/ast/issues/61
- Patched code injection vulnerability CVE-2019-14868. As a result, you can
no longer use expressions in imported numeric environment variables; only
integer literals are allowed.
2020-05-20:
- Fix BUG_ISSETLOOP. Expansions like ${var+set} remained static when used
within a 'for', 'while' or 'until' loop; the expansions din't change along
with the state of the variable, so they could not be used to check whether a
variable is set within a loop if the state of that variable changed in the
course of the loop.
- Fix BUG_IFSISSET. ${IFS+s} always yielded 's', and [[ -v IFS ]] always
yielded true, even if IFS is unset. This applied to IFS only.
2020-05-19:
- Fix 'command -p'. The -p option causes the operating system's standard
utilities path (as output by 'getconf PATH') to be searched instead of $PATH.
Before this fix, this was broken on non-interactive shells as the internal
variable holding the default PATH value was not correctly initialised.
2020-05-16:
- Fix 'test -t 1', '[ -t 1 ]', '[[ -t 1 ]]' in command substitutions.
Standard output (file descriptor 1) tested as being on a terminal within a
command substitution, which makes no sense as the command substitution is
supposed to be catching standard output.
v=$(echo begincomsub
[ -t 1 ] && echo oops
echo endcomsub)
echo "$v"
This now does not output "oops".
2020-05-14:
- Fix syncing history when print -s -f is used. For example, the
following now correctly adds a 'cd' command to the history:
print -s -f 'cd -- %q\n' "$PWD"
Ref.: https://github.com/att/ast/issues/425
https://github.com/att/ast/pull/442
- Fix BUG_PUTIOERR: Output builtins now correctly detect
input/output errors. This allows scripts to check for a nonzero exit
status on the 'print', 'printf' and 'echo' builtins and prevent possible
infinite loops if SIGPIPE is ignored.
- Add a convenient bin/run_ksh_tests script to the source tree that
sets up the necessary environment and runs the ksh regression tests.
2020-05-13:
- Fix BUG_CASELIT: an undocumented 'case' pattern matching misbehaviour that
goes back to the original Bourne shell, but wasn't discovered until 2018.
If a pattern doesn't match as a pattern, it was tried again as a literal
string. This broke common validation use cases, e.g.:
n='[0-9]'
case $n in
( [0-9] ) echo "$n is a number" ;;
esac
would output "[0-9] is a number" as the literal string fallback matches the
pattern. As this misbehaviour was never documented anywhere (not for Bourne,
ksh88, or ksh93), and it was never replicated in other shells (not even in
ksh88 clones pdksh and mksh), it is unlikely any scripts rely on it.
Of course, a literal string fallback, should it be needed, is trivial to
implement correctly without this breakage:
case $n in
( [0-9] | "[0-9]") echo "$n is a number or the number pattern" ;;
esac
Ref.: https://github.com/att/ast/issues/476
- Fix BUG_REDIRIO: ksh used to redirect standard output by default when no
file descriptor was specified with the rarely used '<>' reading/writing
redirection operator. It now redirects standard input by default, as POSIX
specifies and as all other POSIX shells do. To redirect standard output
for reading and writing, you now need '1<>'.
Ref.: https://github.com/att/ast/issues/75
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_07_07

211
README.md Normal file
View file

@ -0,0 +1,211 @@
![](https://github.com/ksh93/ksh/workflows/CI/badge.svg)
# KornShell 93u+m
This repository is used to develop bugfixes
to the last stable release (93u+ 2012-08-01) of
[ksh93](http://www.kornshell.com/),
formerly developed by AT&T Software Technology (AST).
The sources in this repository were forked from the
Github [AST repository](https://github.com/att/ast)
which is no longer under active development.
For user-visible fixes, see [NEWS](https://github.com/ksh93/ksh/blame/master/NEWS)
and click on commit messages for full details.
For all fixes, see [the commit log](https://github.com/ksh93/ksh/commits/).
To see what's left to fix, see [the issue tracker](https://github.com/ksh93/ksh/issues).
## Policy
1. No new features; bug fixes only (but see items 3 and 4).
Feature development is for a future separate branch.
2. No major rewrites. No refactoring code that is not fully understood.
3. No changes in documented behaviour, except if required for compliance with the
[POSIX shell language standard](https://pubs.opengroup.org/onlinepubs/9699919799/utilities/contents.html)
which David Korn [intended](http://www.kornshell.com/info/) for ksh to follow.
4. No 100% bug compatibility. Broken and undocumented behaviour gets fixed.
5. No bureaucracy, no formalities. Just fix it, or report it: create issues,
send pull requests. Every interested party is invited to contribute.
6. To help increase everyone's understanding of this code base, fixes and
significant changes should be fully documented in commit messages.
7. Code style varies somewhat in this historic code base.
Your changes should match the style of the code surrounding it.
Indent with tabs, assuming an 8-space tab width.
Comments always use `/*`...`*/`.
8. Good judgment may override this policy.
## Why?
Between 2017 and 2020 there was an ultimately unsuccessful
[attempt](https://github.com/att/ast/tree/2020.0.1)
to breathe new life into the KornShell by extensively refactoring the last
unstable AST beta version (93v-).
While that ksh2020 branch is now abandoned and still has many critical bugs,
it also had a lot of bugs fixed. More importantly, the AST issue tracker
now contains a lot of documentation on how to fix those bugs, which made
it possible to backport many of them to the last stable release instead.
This ksh 93u+m reboot now incorporates many of these bugfixes, as well as
many patches from Red Hat, Solaris, as well as new fixes from the community.
Though there are many bugs left to fix, we are confident at this point that
93u+m is already the least buggy branch of ksh93 ever released.
## Build
To build ksh with a custom configuration of features, edit
[`src/cmd/ksh93/SHOPT.sh`](https://github.com/ksh93/ksh/blob/master/src/cmd/ksh93/SHOPT.sh).
Then `cd` to the top directory and run:
```sh
bin/package make
```
The compiled binaries are stored in the `arch` directory, in a subdirectory
that corresponds to your architecture. The command `bin/package host type`
outputs the name of this subdirectory.
If you have trouble or want to tune the binaries, you may pass additional
compiler and linker flags. It is usually best to export these as environment
variables *before* running `bin/package` as they could change the name of
the build subdirectory of the `arch` directory, so exporting them is a
convenient way to keep them consistent between build and test commands.
**Note that this system uses `CCFLAGS` instead of the usual `CFLAGS`.**
An example that makes Solaris Studio cc produce a 64-bit binary:
```sh
export CCFLAGS="-xc99 -m64 -O" LDFLAGS="-m64"
bin/package make
```
Alternatively you can append these to the command, and they will only be
used for that command. You can also specify an alternative shell in which
to run the build scripts this way. For example:
```sh
bin/package make SHELL=/bin/bash CCFLAGS="-O2 -I/opt/local/include" LDFLAGS="-L/opt/local/lib"
```
For more information run
```sh
bin/package help
```
Many other commands in this repo self-document via the `--help`, `--man` and
`--html` options; those that do have no separate manual page.
### Test
After compiling, you can run the regression tests.
Start by reading the information printed by:
```sh
bin/shtests --man
```
### Install
Automated installation is not supported.
To install manually:
```sh
cp arch/$(bin/package host type)/bin/ksh /usr/local/bin/
cp src/cmd/ksh93/sh.1 /usr/local/share/man/man1/ksh.1
```
(adapting the destination directories as required).
## What is ksh93?
The following is the official AT&T description from 1993 that came with the
ast-open distribution. The text is original, but hyperlinks were added here.
----
KSH-93 is the most recent version of the KornShell Language described in
"The KornShell Command and Programming Language," by Morris Bolsky and David
Korn of AT&T Bell Laboratories, ISBN 0-13-182700-6. The KornShell is a shell
programming language, which is upward compatible with "sh" (the Bourne
Shell), and is intended to conform to the IEEE P1003.2/ISO 9945.2
[Shell and Utilities standard](https://pubs.opengroup.org/onlinepubs/9699919799/utilities/contents.html).
KSH-93 provides an enhanced programming environment in addition to the major
command-entry features of the BSD shell "csh". With KSH-93, medium-sized
programming tasks can be performed at shell-level without a significant loss
in performance. In addition, "sh" scripts can be run on KSH-93 without
modification.
The code should conform to the
[IEEE POSIX 1003.1 standard](http://www.opengroup.org/austin/papers/posix_faq.html)
and to the proposed ANSI-C standard so that it should be portable to all
such systems. Like the previous version, KSH-88, it is designed to accept
eight bit character sets transparently, thereby making it internationally
compatible. It can support multi-byte characters sets with some
characteristics of the character set given at run time.
KSH-93 provides the following features, many of which were also inherent in
KSH-88:
* Enhanced Command Re-entry Capability: The KSH-93 history function records
commands entered at any shell level and stores them, up to a
user-specified limit, even after you log off. This allows you to re-enter
long commands with a few keystrokes - even those commands you entered
yesterday. The history file allows for eight bit characters in commands
and supports essentially unlimited size histories.
* In-line Editing: In "sh", the only way to fix mistyped commands is to
backspace or retype the line. KSH-93 allows you to edit a command line
using a choice of EMACS-TC or "vi" functions. You can use the in-line
editors to complete filenames as you type them. You may also use this
editing feature when entering command lines from your history file. A user
can capture keystrokes and rebind keys to customize the editing interface.
* Extended I/O Capabilities: KSH-93 provides several I/O capabilities not
available in "sh", including the ability to:
* specify a file descriptor for input and output
* start up and run co-processes
* produce a prompt at the terminal before a read
* easily format and interpret responses to a menu
* echo lines exactly as output without escape processing
* format output using printf formats.
* read and echo lines ending in "\\".
* Improved performance: KSH-93 executes many scripts faster than the System
V Bourne shell. A major reason for this is that many of the standard
utilities are built-in. To reduce the time to initiate a command, KSH-93
allows commands to be added as built-ins at run time on systems that
support dynamic loading such as System V Release 4.
* Arithmetic: KSH-93 allows you to do integer arithmetic in any base from
two to sixty-four. You can also do double precision floating point
arithmetic. Almost the complete set of C language operators are available
with the same syntax and precedence. Arithmetic expressions can be used to
as an argument expansion or as a separate command. In addition there is an
arithmetic for command that works like the for statement in C.
* Arrays: KSH-93 supports both indexed and associative arrays. The subscript
for an indexed array is an arithmetic expression, whereas, the subscript
for an associative array is a string.
* Shell Functions and Aliases: Two mechanisms - functions and aliases - can
be used to assign a user-selected identifier to an existing command or
shell script. Functions allow local variables and provide scoping for
exception handling. Functions can be searched for and loaded on first
reference the way scripts are.
* Substring Capabilities: KSH-93 allows you to create a substring of any
given string either by specifying the starting offset and length, or by
stripping off leading or trailing substrings during parameter
substitution. You can also specify attributes, such as upper and lower
case, field width, and justification to shell variables.
* More pattern matching capabilities: KSH-93 allows you to specify extended
regular expressions for file and string matches.
* KSH-93 uses a hierarchal name space for variables. Compound variables can
be defined and variables can be passed by reference. In addition, each
variable can have one or more disciplines associated with it to intercept
assignments and references.
* Improved debugging: KSH-93 can generate line numbers on execution traces.
Also, I/O redirections are now traced. There is a DEBUG trap that gets
evaluated before each command so that errors can be localized.
* Job Control: On systems that support job control, including System V
Release 4, KSH-93 provides a job-control mechanism almost identical to
that of the BSD "csh", version 4.1. This feature allows you to stop and
restart programs, and to move programs between the foreground and the
background.
* Added security: KSH-93 can execute scripts which do not have read
permission and scripts which have the setuid and/or setgid set when
invoked by name, rather than as an argument to the shell. It is possible
to log or control the execution of setuid and/or setgid scripts. The
noclobber option prevents you from accidentally erasing a file by
redirecting to an existing file.
* KSH-93 can be extended by adding built-in commands at run time. In
addition, KSH-93 can be used as a library that can be embedded into an
application to allow scripting.
Documentation for KSH-93 consists of an "Introduction to KSH-93",
"Compatibility with the Bourne Shell" and a manual page and a README file.
In addition, the "New KornShell Command and Programming Language" book is
available from Prentice Hall.

36
TODO Normal file
View file

@ -0,0 +1,36 @@
TODO for AT&T ksh93, 93u+m bugfix branch
See the issue tracker:
https://github.com/ksh93/ksh/issues
______
Fix regression test failures:
- There are many regression test failures on NetBSD.
______
Fix build system:
- ksh does not currently build on QNX.
______
Fix currently known bugs affecting shell scripting. These are identified by
their modernish IDs. For exact details, see code/comments in:
https://github.com/modernish/modernish/tree/0.16/lib/modernish/cap/
- BUG_BRACQUOT: shell quoting within bracket patterns has no effect. This
bug means the '-' retains it special meaning of 'character range', and an
initial ! (and, on some shells, ^) retains the meaning of negation, even
in quoted strings within bracket patterns, including quoted variables.
- BUG_CSUBSTDO: If standard output (file descriptor 1) is closed before
entering a $(command substitution), and any other file descriptors are
redirected within the command substitution, commands such as 'echo' will
not work within the command substitution, acting as if standard output is
still closed.
- BUG_IFSGLOBS: In glob pattern matching (as in case or parameter
substitution with # and %), if IFS starts with ? or * and the "$*"
parameter expansion inserts any IFS separator characters, those characters
are erroneously interpreted as wildcards when quoted "$*" is used as the
glob pattern.

33
bin/Mamfile_indent Executable file
View file

@ -0,0 +1,33 @@
#!/usr/bin/env sh
IFS=''; set -fCu # safe mode: no split/glob = no quoting headaches
let() { return $((!($1))); }
# Automatically (re-)indent make...done blocks in a Mamfile.
# Usage: Mamfile_indent <Mamfile >Mamfile.new
#
# Should work on all current POSIX compliant shells.
# By Martijn Dekker <martijn@inlv.org>, 2021. Public domain.
# Spacing per indentation level. Edit to change style.
indent=' ' # one tab
# Remove existing indentation, add new indentation.
indentlvl=0
sed 's/^[[:space:]]*//' \
| while read -r line
do case $line in
'') continue ;;
done*) let "indentlvl -= 1" ;;
esac
spc=
i=0
while let "(i += 1) <= indentlvl"
do spc=$indent$spc
done
printf '%s\n' $spc$line
case $line in
make*) let "indentlvl += 1" ;;
esac
done

42
bin/ignore Executable file
View file

@ -0,0 +1,42 @@
########################################################################
# #
# This software is part of the ast package #
# Copyright (c) 1994-2011 AT&T Intellectual Property #
# and is licensed under the #
# Eclipse Public License, Version 1.0 #
# by AT&T Intellectual Property #
# #
# A copy of the License is available at #
# http://www.eclipse.org/org/documents/epl-v10.html #
# (with md5 checksum b35adb5213ca9657e911e9befb180842) #
# #
# Information and Software Systems Research #
# AT&T Research #
# Florham Park NJ #
# #
# Glenn Fowler <gsf@research.att.com> #
# #
########################################################################
# non-ksh script for the nmake ignore prefix
# @(#)ignore (AT&T Research) 1992-08-11
(command set -o posix) 2>/dev/null && set -o posix
modern_export=`v=; export v=ok 2>/dev/null; echo "$v"`
while :
do case $# in
0) exit 0 ;;
esac
case $1 in
*=*) case $modern_export in
ok) export "$1" ;;
*) `echo $1 | sed "s/\\([^=]*\\)=\\(.*\\)/eval \\1='\\2'; export \\1/"` ;;
esac
shift
;;
*) break
;;
esac
done
"$@"
exit 0

273
bin/mamprobe Executable file
View file

@ -0,0 +1,273 @@
########################################################################
# #
# This software is part of the ast package #
# Copyright (c) 1994-2011 AT&T Intellectual Property #
# and is licensed under the #
# Eclipse Public License, Version 1.0 #
# by AT&T Intellectual Property #
# #
# A copy of the License is available at #
# http://www.eclipse.org/org/documents/epl-v10.html #
# (with md5 checksum b35adb5213ca9657e911e9befb180842) #
# #
# Information and Software Systems Research #
# AT&T Research #
# Florham Park NJ #
# #
# Glenn Fowler <gsf@research.att.com> #
# #
########################################################################
### this script contains archaic constructs that work with all sh variants ###
# mamprobe - generate MAM cc probe info
# Glenn Fowler <gsf@research.att.com>
(command set -o posix) 2>/dev/null && set -o posix
command=mamprobe
bins=`
(
userPATH=$PATH
PATH=/run/current-system/sw/bin:/usr/xpg7/bin:/usr/xpg6/bin:/usr/xpg4/bin:/bin:/usr/bin:$PATH
getconf PATH 2>/dev/null && echo "$userPATH" || echo /bin:/usr/bin:/sbin:/usr/sbin:"$userPATH"
) | sed 's/:/ /g'
` || exit
# check the options
opt=
case `(getopts '[-][123:xyz]' opt --xyz; echo 0$opt) 2>/dev/null` in
0123) USAGE=$'
[-?
@(#)$Id: mamprobe (AT&T Labs Research) 2011-02-11 $
]
[+NAME?mamprobe - generate MAM cc probe info]
[+DESCRIPTION?\bmamprobe\b generates MAM (make abstract machine) \bcc\b(1)
probe information for use by \bmamake\b(1). \acc-path\a is the
absolute path of the probed compiler and \ainfo-file\a is where
the information is placed. \ainfo-file\a is usually
\b$INSTALLROOT/lib/probe/C/mam/\b\ahash\a, where \ahash\a is a hash
of \acc-path\a. Any \ainfo-file\a directories are created if needed.
If \ainfo-file\a is \b-\b then the probe information is written to
the standard output.]
[+?\bmamprobe\b and \bmamake\b are used in the bootstrap phase of
\bpackage\b(1) installation before \bnmake\b(1) is built. The
probed variable names are the \bnmake\b(1) names with a \bmam_\b
prefix, \bCC\b converted to \bcc\b, and \b.\b converted to \b_\b.
Additional variables are:]{
[+_hosttype_?the \bpackage\b(1) host type]
[+mam_cc_L?\b-L\b\adir\a supported]
[+STDCAT?command to execute for \bcat\b(1); prefixed by
\bexecrate\b(1) on \b.exe\b challenged systems]
[+STDCHMOD?command to execute for \bchmod\b(1); prefixed by
\bexecrate\b(1) on \b.exe\b challenged systems]
[+STDCMP?command to execute for \bcmp\b(1); prefixed by
\bexecrate\b(1) on \b.exe\b challenged systems]
[+STDCP?command to execute for \bcp\b(1); prefixed by
\bexecrate\b(1) on \b.exe\b challenged systems]
[+STDED?command to execute for \bed\b(1) or \bex\b(1)]
[+STDEDFLAGS?flags for \bSTDED\b]
[+STDLN?command to execute for \bln\b(1); prefixed by
\bexecrate\b(1) on \b.exe\b challenged systems]
[+STDMV?command to execute for \bmv\b(1); prefixed by
\bexecrate\b(1) on \b.exe\b challenged systems]
[+STDRM?command to execute for \brm\b(1); prefixed by
\bexecrate\b(1) on \b.exe\b challenged systems]
}
[d:debug?Enable probe script debug trace.]
info-file cc-path
[+SEE ALSO?\bexecrate\b(1), \bpackage\b(1), \bmamake\b(1), \bnmake\b(1),
\bprobe\b(1)]
'
while getopts -a "$command" "$USAGE" OPT
do case $OPT in
d) opt=-d ;;
esac
done
shift `expr $OPTIND - 1`
;;
*) while :
do case $# in
0) break ;;
esac
case $1 in
--) shift
break
;;
-) break
;;
-d) opt=-d
;;
-*) echo $command: $1: unknown option >&2
;;
*) break
;;
esac
set ''
break
done
;;
esac
# check the args
case $1 in
-) ;;
/*) ;;
*) set '' ;;
esac
case $2 in
/*) ;;
*) set '' ;;
esac
case $# in
0|1) echo "Usage: $command info-file cc-path" >&2; exit 2 ;;
esac
info=$1
shift
cc=$*
# find the make probe script
ifs=${IFS-'
'}
IFS=:
set $PATH
IFS=$ifs
script=lib/probe/C/make/probe
while :
do case $# in
0) echo "$0: ../$script: probe script not found on PATH" >&2
exit 1
;;
esac
case $1 in
'') continue ;;
esac
makeprobe=`echo $1 | sed 's,[^/]*$,'$script,`
if test -x $makeprobe
then break
fi
shift
done
# create the info dir if necessary
case $info in
/*) i=X$info
ifs=${IFS-'
'}
IFS=/
set $i
IFS=$ifs
while :
do i=$1
shift
case $i in
X) break ;;
esac
done
case $info in
//*) path=/ ;;
*) path= ;;
esac
while :
do case $# in
0|1) break ;;
esac
comp=$1
shift
case $comp in
'') continue ;;
esac
path=$path/$comp
if test ! -d $path
then mkdir $path || exit
fi
done
;;
esac
# generate info in a tmp file and rename when finished
case $info in
-) ;;
*) tmp=${TMPDIR:-/tmp}/mam$$
trap "exec >/dev/null; rm -f $tmp" 0 1 2 3 15
exec > $tmp
echo "probing C language processor $cc for mam information" >&2
;;
esac
echo "note generated by $0 for $cc"
(
set '' $opt $cc
shift
. $makeprobe "$@"
case " $CC_DIALECT " in
*" -L "*) echo "CC.L = 1" ;;
esac
) | sed \
-e '/^CC\./!d' \
-e 's/^CC./setv mam_cc_/' \
-e 's/^\([^=.]*\)\./\1_/' \
-e 's/^\([^=.]*\)\./\1_/' \
-e 's/ =//' \
-e 's/\$("\([^"]*\)")/\1/g' \
-e 's/\$(\([^)]*\))/${\1}/g' \
-e 's/\${CC\./${mam_cc_}/g'
echo 'setv _hosttype_ ${mam_cc_HOSTTYPE}'
# STD* are standard commands/flags with possible execrate(1)
if (
ed <<!
q
!
) < /dev/null > /dev/null 2>&1
then STDED=ed
else STDED=ex
fi
STDEDFLAGS=-
set STDCAT cat STDCHMOD chmod STDCMP cmp STDCP cp STDLN ln STDMV mv STDRM rm
while :
do case $# in
0|1) break ;;
esac
p=$2
for d in $bins
do if test -x $d/$p
then p=$d/$p
break
fi
done
eval $1=\$p
shift
shift
done
if execrate
then for n in STDCAT STDCHMOD STDCMP STDCP STDLN STDMV STDRM
do eval $n=\"execrate \$$n\"
done
fi
for n in STDCAT STDCHMOD STDCMP STDCP STDED STDEDFLAGS STDLN STDMV STDRM
do eval echo setv \$n \$$n
done
# all done
case $info in
-) ;;
*) exec >/dev/null
test -f "$info" && rm -f "$info"
cp "$tmp" "$info"
chmod -w "$info"
;;
esac

7429
bin/package Executable file

File diff suppressed because it is too large Load diff

54
bin/shtests Executable file
View file

@ -0,0 +1,54 @@
#! /bin/sh
# Wrapper script to run the ksh93 regression tests without requiring nmake.
# By Martijn Dekker <martijn@inlv.org> 2020-05-14
# Public domain. http://creativecommons.org/publicdomain/zero/1.0/
#
# The manual: bin/shtests --man
# Brief help: bin/shtests --help
#
# By default, this runs your compiled arch/*/bin/ksh.
#
# Note: The test suite actually uses $SHELL to indicate the shell to test. But
# we cannot use the $SHELL environment value on entry to this wrapper script,
# as that is already used for the user's default login shell on most systems.
# Process and remove any assignment-argument indicating the shell to test
for arg do
case $arg in
( SHELL=* | KSH=* )
KSH=${arg#*=} ;;
( * ) set -- "$@" "$1" ;;
esac
shift
done
# Find root dir of ksh source
mydir=$(dirname "$0") \
&& mydir=$(CDPATH='' cd -P -- "$mydir/.." && printf '%sX' "$PWD") \
&& mydir=${mydir%X} \
|| exit
myarch=$("$mydir/bin/package" host type) || exit
# Check if there is a ksh to test.
case ${KSH+set} in
( '' ) KSH=$mydir/arch/$myarch/bin/ksh ;;
esac
if ! test -x "$KSH" || ! test -f "$KSH"; then
printf '%s: shell not found: %s\n' "${0##*/}" "$KSH" >&2
printf 'Specify a shell like: KSH=path/to/ksh bin/shtests\n' >&2
exit 1
fi
# Ensure absolute path to ksh
KSH=$(CDPATH='' cd -P -- "$(dirname "$KSH")" \
&& printf '%s/%sX' "$PWD" "${KSH##*/}") \
&& KSH=${KSH%X}
# Run the test suite
CDPATH='' cd -P -- "$mydir/src/cmd/ksh93/tests" || exit
SHELL=$KSH
INSTALLROOT=${INSTALLROOT:-$mydir/arch/$myarch}
export SHELL INSTALLROOT
unset -v KSH
printf '#### Regression-testing %s ####\n' "$SHELL"
exec "$SHELL" shtests "$@"

41
bin/silent Executable file
View file

@ -0,0 +1,41 @@
########################################################################
# #
# This software is part of the ast package #
# Copyright (c) 1994-2011 AT&T Intellectual Property #
# and is licensed under the #
# Eclipse Public License, Version 1.0 #
# by AT&T Intellectual Property #
# #
# A copy of the License is available at #
# http://www.eclipse.org/org/documents/epl-v10.html #
# (with md5 checksum b35adb5213ca9657e911e9befb180842) #
# #
# Information and Software Systems Research #
# AT&T Research #
# Florham Park NJ #
# #
# Glenn Fowler <gsf@research.att.com> #
# #
########################################################################
# non-ksh stub for the nmake silent prefix
# @(#)silent (AT&T Research) 1992-08-11
(command set -o posix) 2>/dev/null && set -o posix
modern_export=`v=; export v=ok 2>/dev/null; echo "$v"`
while :
do case $# in
0) exit 0 ;;
esac
case $1 in
*=*) case $modern_export in
ok) export "$1" ;;
*) `echo $1 | sed "s/\\([^=]*\\)=\\(.*\\)/eval \\1='\\2'; export \\1/"` ;;
esac
shift
;;
*) break
;;
esac
done
"$@"

6
docs/index.html Normal file
View file

@ -0,0 +1,6 @@
<html>
<head><title>AST Software</title></head>
<body>
<a href='ksh/index.html'>The KornShell</a><br>
</body>
</html>

710
docs/ksh/builtins.html Normal file
View file

@ -0,0 +1,710 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<META name="generator" content="mm2html (AT&amp;T Research) 2012-01-11">
<TITLE> www/ksh/builtins.mm mm document </TITLE>
<META name="author" content="gsf+dgk+kpv">
<STYLE type="text/css">
div.FI { padding-left:2em; text-indent:0em; }
div.HI { padding-left:4em; text-indent:-2em; }
dt { float:left; clear:both; }
dd { margin-left:3em; }
</STYLE>
</HEAD>
<BODY bgcolor=white link=slateblue vlink=teal >
<TABLE border=0 align=center width=96%>
<TBODY><TR><TD valign=top align=left>
<!--INDEX--><!--/INDEX-->
<P>
<CENTER>
<H3><CENTER><FONT color=red><FONT face=courier>Guidelines for writing <TT>ksh-93</TT> built-in commands</FONT></FONT></CENTER></H3>
<BR>David G. Korn
<P><I></I>
</CENTER>
<P>
<CENTER><FONT color=red><FONT face=courier><H3 align=center><A name="Abstract">Abstract</A></H3></FONT></FONT></CENTER>
One of the features of <TT>ksh93</TT>, the latest version of <TT>ksh</TT>,
is the ability to add built-in commands at run time.
This feature only works on operating systems that have the ability
to load and link code into the current process at run time.
Some examples of the systems that have this feature
are Linux, System V Release 4, Solaris, Sun OS, HP-UX Release 8 and above,
AIX 3.2 and above, and Microsoft Windows systems.
<P>
This memo describes how to write and compile programs
that can be loaded into <TT>ksh</TT> at run time as built-in
commands.
<P>
<P><HR><CENTER><FONT color=red><FONT face=courier><H3><A name="INTRODUCTION">INTRODUCTION</A></H3></FONT></FONT></CENTER>
A built-in command is executed without creating a separate process.
Instead, the command is invoked as a C function by <TT>ksh</TT>.
If this function has no side effects in the shell process,
then the behavior of this built-in is identical to that of
the equivalent stand-alone command. The primary difference
in this case is performance. The overhead of process creation
is eliminated. For commands of short duration, the effect
can be dramatic. For example, on SUN OS 4.1, the time to
run <TT>wc</TT> on a small file of about 1000 bytes, runs
about 50 times faster as a built-in command.
<P>
In addition, built-in commands may have side effects on the
shell environment.
This is usually done to extend the application domain for
shell programming. For example, there is a group of X-windows extension
built-ins that make heavy use of the shell variable namespace.
These built-ins are added at run time and
result in a windowing shell that can be used to write
X-windows applications.
<P>
While there are definite advantages to adding built-in
commands, there are some disadvantages as well.
Since the built-in command and <TT>ksh</TT> share the same
address space, a coding error in the built-in program
may affect the behavior of <TT>ksh</TT>; perhaps causing
it to core dump or hang.
Debugging is also more complex since your code is now
a part of a larger entity.
The isolation provided by a separate process
guarantees that all resources used by the command
will be freed when the command completes.
Resources used by a built-in must be meticulously maintained and freed.
Also, since the address space of <TT>ksh</TT> will be larger when built-in are loaded,
it may increase the time it takes <TT>ksh</TT> to fork() and
exec() non-built-in commands.
It makes no sense to add a built-in command that takes
a long time to run or that is run only once, since the performance
benefits will be negligible.
Built-ins that have side effects in the current shell
environment have the disadvantage of increasing the
coupling between the built-in and <TT>ksh</TT>, making
the overall system less modular and more monolithic.
<P>
Despite these drawbacks, in many cases extending
<TT>ksh</TT> by adding built-in
commands makes sense and allows reuse of the shell
scripting ability in an application specific domain.
This memo describes how to write <TT>ksh</TT> extensions.
<P>
<P><HR><CENTER><FONT color=red><FONT face=courier><H3><A name="WRITING BUILT-IN COMMANDS">WRITING BUILT-IN COMMANDS</A></H3></FONT></FONT></CENTER>
There is a development kit available for writing <TT>ksh</TT>
built-ins as part of the AST (AT&amp;T Software Technology) Toolkit.
The development kit has three directories,
<TT>include</TT>, <TT>lib</TT>, and <TT>bin</TT>.
It is best to set the value of the environment variable
<TT>PACKAGE_ast</TT> to the pathname of the directory
containing the development kit.
The <TT>include</TT> directory contains a sub-directory
named <TT>ast</TT> that contains interface prototypes
for functions that you can call from built-ins. The <TT>lib</TT>
directory contains the <TT>ast</TT> library
and a library named <TT>cmd</TT> that contains a version
of several of the standard POSIX<FONT SIZE=-6>[1]</FONT>
utilities that can be made run time built-ins.
The <TT>lib/ksh</TT> directory contains shared libraries
that implement other <TT>ksh</TT> built-ins.
The <TT>bin</TT> directory contains build tools such as <TT>nmake</TT><FONT SIZE=-6>[2]</FONT>.
To add built-ins at runtime, it is necessary to build a shared library
containing one or more built-ins that you wish to add.
The built-ins are then added by running <TT>builtin &#45;f</TT> <EM>shared_lib</EM>.
Since the procedure for building share libraries is system dependent,
it is best to use
<TT>nmake</TT>
using the sample nmake makefile below as a prototype.
The AST Toolkit also contains some examples of built-in libraries under
the <TT>src/cmd/kshlib</TT> directory.
<P>
There are two ways to code adding built-ins. One method is to replace
the function <TT>main</TT> with a function
<TT>b_</TT><EM>name</EM>, where <EM>name</EM> is the name
of the built-in you wish to define.
A built-in command has a calling convention similar to
the <TT>main</TT> function of a program,
<TT>int main(int argc, char *argv&#0091;&#0093;)</TT>.
except that it takes a third argument of type <TT>Shbltin_t*</TT> which can
be passed as <TT><FONT SIZE=-1>NULL</FONT></TT> if it is not used. The definition for
<TT>Shbltin_t*</TT> is in <TT>&lt;ast/shcmd.h&gt;</TT>.
Instead of <TT>exit</TT>, you need to use <TT>return</TT>
to terminate your command.
The return value will become the exit status of the command.
The <TT>open</TT> built-in, installed in <TT>lib/ksh</TT> in the AST Toolkit, uses this method.
The <TT>Shbltin_t</TT> structure contains a field named <TT>shp</TT> which is
a pointer the the shell data that is needed for <TT>shell</TT> library callbacks.
It also contains the fields, <TT>shrun</TT>, <TT>shtrap</TT>, <TT>shexit</TT>,
and <TT>shbltin</TT>
that are function pointers to the <TT>shell</TT> library functions <TT>sh_run</TT>, <TT>sh_trap</TT>
<TT>sh_exit</TT>, and <TT>sh_addbuiltin</TT>, respectively. These functions
can be invoked without the need for runtime symbol lookup when the
shell is statically linked with <TT>libshell</TT>.
<P>
The alternative method is to create a function <TT>lib_init</TT> and
use the <TT>Shbltin_t.shbltin()</TT> function to add one or more built-ins.
The <TT>lib_init</TT> function will be called with two arguments. The
first argument will be 0 when the library is loaded and the second
argument will be of type <TT>Shbltin_t*</TT>.
The <TT>dbm_t</TT> and <TT>dss</TT> shell built-ins use this method.
<P>
No matter which way you add built-ins you should add the line
<TT>SHLIB(</TT><EM>identifier</EM><TT>)</TT> as the last line of one
of the built-in source file, where <EM>identifier</EM> is any C identifier.
This line provides version information to the shell <TT>builtin</TT> command
that it uses to verify compatibility between the built-in and <TT>ksh</TT>
implementation versions. <TT>builtin</TT> fails with a diagnostic on version
mismatch. The diagnostic helps determine whether <TT>ksh</TT> is out of
date and requires an upgrade or the built-in is out of date and requires
recompilation.
<P>
The steps necessary to create and add a run time built-in are
illustrated in the following simple example.
Suppose you wish to add a built-in command named <TT>hello</TT>
which requires one argument and prints the word hello followed
by its argument. First, write the following program in the file
<TT>hello.c</TT>:
<DIV class=FI>
<PRE>
#include &lt;stdio.h&gt;
int b_hello(int argc, char *argv&#0091;&#0093;, void *context)
{
if(argc != 2)
{
fprintf(stderr,"Usage: hello arg&#0092;n");
return(2);
}
printf("hello %s&#0092;n",argv&#0091;1&#0093;);
return(0);
}
SHLIB(hello)
</DIV>
</PRE>
<P>
Next, the program needs to be compiled.
If you are building with AT&amp;T <TT>nmake</TT> use the following <TT>Makefile</TT>:
<DIV class=FI>
<PRE>
:PACKAGE: --shared ast
hello plugin=ksh :LIBRARY: hello.c
</DIV>
</PRE>
and run <TT>nmake install</TT> to compile, link, and install the built-in shared library
in <TT>lib/ksh/</TT> under <TT>PACKAGE_ast</TT>.
If the built-in extension uses several <TT>.c</TT> files, list all of these on
the <TT>:LIBRARY:</TT> line.
<P>
Otherwise you will have to compile <TT>hello.c</TT> with an option
to pick up the AST include directory
(since the AST <TT>&lt;stdio.h&gt;</TT> is required for <TT>ksh</TT> compatibility)
and options required for generating shared libraries.
For example, on Linux use this to compile:
<DIV class=FI>
<PRE>
cc -fpic -I$PACKAGE_ast/include/ast -c hello.c
</DIV>
</PRE>
and use the appropriate link line.
It really is best to use <TT>nmake</TT> because the 2 line Makefile above
will work on all systems that have <TT>ksh</TT> installed.
<P>
If you have several built-ins, it is desirable
to build a shared library that contains them all.
<P>
The final step is using the built-in.
This can be done with the <TT>ksh</TT> command <TT>builtin</TT>.
To load the shared library <TT>libhello.so</TT> from the current directory
and add the built-in <TT>hello</TT>, invoke the command,
<DIV class=FI>
<PRE>
builtin -f ./libhello.so hello
</DIV>
</PRE>
The shared library prefix (<TT>lib</TT> here) and suffix (<TT>.so</TT> here) be omitted;
the shell will add an appropriate suffix
for the system that it is loading from.
If you install the shared library in <TT>lib/ksh/</TT>, where <TT>../lib/ksh/</TT> is
a directory on <STRONG>$PATH</STRONG>, the command
<DIV class=FI>
<PRE>
builtin -f hello hello
</DIV>
</PRE>
will automatically find, load and install the built-in on any system.
Once this command has been invoked, you can invoke <TT>hello</TT>
as you do any other command.
If you are using <TT>lib_init</TT> method to add built-ins then no arguments
follow the <TT>&#45;f</TT> option.
<P>
It is often desirable to make a command <EM>built-in</EM>
the first time that it is referenced. The first
time <TT>hello</TT> is invoked, <TT>ksh</TT> should load and execute it,
whereas for subsequent invocations <TT>ksh</TT> should just execute the built-in.
This can be done by creating a file named <TT>hello</TT>
with the following contents:
<DIV class=FI>
<PRE>
function hello
{
unset -f hello
builtin -f hello hello
hello "$@"
}
</DIV>
</PRE>
This file <TT>hello</TT> needs to be placed in a directory that is
in your <STRONG><FONT SIZE=-1>FPATH</FONT></STRONG> variable, and the built-in shared library
should be installed in <TT>lib/ksh/</TT>, as described above.
<P>
<P><HR><CENTER><FONT color=red><FONT face=courier><H3><A name="CODING REQUIREMENTS AND CONVENTIONS">CODING REQUIREMENTS AND CONVENTIONS</A></H3></FONT></FONT></CENTER>
As mentioned above, the entry point for built-ins must either be of
the form <TT>b_</TT><EM>name</EM> or else be loaded from a function named
<TT>lib_init</TT>.
Your built-ins can call functions from the standard C library,
the <TT>ast</TT> library, interface functions provided by <TT>ksh</TT>,
and your own functions.
You should avoid using any global symbols beginning with
<STRONG>sh_</STRONG>,
<STRONG>nv_</STRONG>,
and
<STRONG>ed_</STRONG>
since these are used by <TT>ksh</TT> itself.
<TT>#define</TT> constants in <TT>ksh</TT> interface
files use symbols beginning with <TT>SH_</TT> and <TT>NV_</TT>,
so avoid using names beginning with these too.
<P>
<H4><A name="Header Files">Header Files</A></H4>
The development kit provides a portable interface
to the C library and to libast.
The header files in the development kit are compatible with
K&amp;R C<FONT SIZE=-6>[3]</FONT>,
ANSI-C<FONT SIZE=-6>[4]</FONT>,
and C++<FONT SIZE=-6>[5]</FONT>.
<P>
The best thing to do is to include the header file <TT>&lt;shell.h&gt;</TT>.
This header file causes the <TT>&lt;ast.h&gt;</TT> header, the
<TT>&lt;error.h&gt;</TT> header and the <TT>&lt;stak.h&gt;</TT>
header to be included as well as defining prototypes
for functions that you can call to get shell
services for your builtins.
The header file <TT>&lt;ast.h&gt;</TT>
provides prototypes for many <STRONG>libast</STRONG> functions
and all the symbol and function definitions from the
ANSI-C headers, <TT>&lt;stddef.h&gt;</TT>,
<TT>&lt;stdlib.h&gt;</TT>, <TT>&lt;stdarg.h&gt;</TT>, <TT>&lt;limits.h&gt;</TT>,
and <TT>&lt;string.h&gt;</TT>.
It also provides all the symbols and definitions for the
POSIX<FONT SIZE=-6>[6]</FONT>
headers <TT>&lt;sys/types.h&gt;</TT>, <TT>&lt;fcntl.h&gt;</TT>, and
<TT>&lt;unistd.h&gt;</TT>.
You should include <TT>&lt;ast.h&gt;</TT> instead of one or more of
these headers.
The <TT>&lt;error.h&gt;</TT> header provides the interface to the error
and option parsing routines defined below.
The <TT>&lt;stak.h&gt;</TT> header provides the interface to the memory
allocation routines described below.
<P>
Programs that want to use the information in <TT>&lt;sys/stat.h&gt;</TT>
should include the file <TT>&lt;ls.h&gt;</TT> instead.
This provides the complete POSIX interface to <TT>stat()</TT>
related functions even on non-POSIX systems.
<P>
<P>
<H4><A name="Input/Output">Input/Output</A></H4>
<TT>ksh</TT> uses <STRONG>sfio</STRONG>,
the Safe/Fast I/O library<FONT SIZE=-6>[7]</FONT>,
to perform all I/O operations.
The <STRONG>sfio</STRONG> library, which is part of <STRONG>libast</STRONG>,
provides a superset of the functionality provided by the standard
I/O library defined in ANSI-C.
If none of the additional functionality is required,
and if you are not familiar with <STRONG>sfio</STRONG> and
you do not want to spend the time learning it,
then you can use <TT>sfio</TT> via the <TT>stdio</TT> library
interface. The development kit contains the header <TT>&lt;stdio.h&gt;</TT>
which maps <TT>stdio</TT> calls to <TT>sfio</TT> calls.
In most instances the mapping is done
by macros or inline functions so that there is no overhead.
The man page for the <TT>sfio</TT> library is in an Appendix.
<P>
However, there are some very nice extensions and
performance improvements in <TT>sfio</TT>
and if you plan any major extensions I recommend
that you use it natively.
<P>
<H4><A name="Error Handling">Error Handling</A></H4>
For error messages it is best to use the <TT>ast</TT> library
function <TT>errormsg()</TT> rather that sending output to
<TT>stderr</TT> or the equivalent <TT>sfstderr</TT> directly.
Using <TT>errormsg()</TT> will make error message appear
more uniform to the user.
Furthermore, using <TT>errormsg()</TT> should make it easier
to do error message translation for other locales
in future versions of <TT>ksh</TT>.
<P>
The first argument to
<TT>errormsg()</TT> specifies the dictionary in which the string
will be searched for translation.
The second argument to <TT>errormsg()</TT> contains that error type
and value. The third argument is a <EM>printf</EM> style format
and the remaining arguments are arguments to be printed
as part of the message. A new-line is inserted at the
end of each message and therefore, should not appear as
part of the format string.
The second argument should be one of the following:
<DIV class=SH>
<DL>
<DT><TT>ERROR_exit(</TT><EM>n</EM><TT>)</TT>:<DD><BR>
If <EM>n</EM> is not-zero, the builtin will exit value <EM>n</EM> after
printing the message.
<DT><TT>ERROR_system(</TT><EM>n</EM><TT>)</TT>:<DD><BR>
Exit builtin with exit value <EM>n</EM> after printing the message.
The message will display the message corresponding to <TT>errno</TT>
enclosed within <TT>&#0091;&nbsp;&#0093;</TT> at the end of the message.
<DT><TT>ERROR_usage(</TT><EM>n</EM><TT>)</TT>:<DD><BR>
Will generate a usage message and exit. If <EM>n</EM> is non-zero,
the exit value will be 2. Otherwise the exit value will be 0.
<DT><TT>ERROR_debug(</TT><EM>n</EM><TT>)</TT>:<DD><BR>
Will print a level <EM>n</EM> debugging message and will then continue.
<DT><TT>ERROR_warn(</TT><EM>n</EM><TT>)</TT>:<DD><BR>
Prints a warning message. <EM>n</EM> is ignored.
</DL><P>
<H4><A name="Option Parsing">Option Parsing</A></H4>
The first thing that a built-in should do is to check
the arguments for correctness and to print any usage
messages on standard error.
For consistency with the rest of <TT>ksh</TT>, it is best
to use the <TT>libast</TT> functions <TT>optget()</TT> and
<TT>optusage()</TT>for this
purpose.
The header <TT>&lt;error.h&gt;</TT> includes prototypes for
these functions.
The <TT>optget()</TT> function is similar to the
System V C library function <TT>getopt()</TT>,
but provides some additional capabilities.
Built-ins that use <TT>optget()</TT> provide a more
consistent user interface.
<P>
The <TT>optget()</TT> function is invoked as
<DIV class=FI>
<PRE>
int optget(char *<EM>argv</EM>&#0091;&#0093;, const char *<EM>optstring</EM>)
</DIV>
</PRE>
where <TT>argv</TT> is the argument list and <TT>optstring</TT>
is a string that specifies the allowable arguments and
additional information that is used to format <EM>usage</EM>
messages.
In fact a complete man page in <TT>troff</TT> or <TT>html</TT>
can be generated by passing a usage string as described
by the <TT>getopts</TT> command.
Like <TT>getopt()</TT>,
single letter options are represented by the letter itself,
and options that take a string argument are followed by the <TT>:</TT>
character.
Option strings have the following special characters:
<DIV class=SH>
<DL>
<DT><TT>:</TT><DD>
Used after a letter option to indicate that the option
takes an option argument.
The variable <TT>opt_info.arg</TT> will point to this
value after the given argument is encountered.
<DT><TT>#</TT><DD>
Used after a letter option to indicate that the option
can only take a numerical value.
The variable <TT>opt_info.num</TT> will contain this
value after the given argument is encountered.
<DT><TT>?</TT><DD>
Used after a <TT>:</TT> or <TT>#</TT> (and after the optional <TT>?</TT>)
to indicate the the
preceding option argument is not required.
<DT><TT>&#0091;</TT>...<TT>&#0093;</TT><DD><BR>
After a <TT>:</TT> or <TT>#</TT>, the characters contained
inside the brackets are used to identify the option
argument when generating a <EM>usage</EM> message.
<DT><EM>space</EM><DD><BR>
The remainder of the string will only be used when generating
usage messages.
</DL>
</DIV>
<P>
The <TT>optget()</TT> function returns the matching option letter if
one of the legal option is matched.
Otherwise, <TT>optget()</TT> returns
<DIV class=SH>
<DL>
<DT><TT>':'</TT><DD>
If there is an error. In this case the variable <TT>opt_info.arg</TT>
contains the error string.
<DT><TT>0</TT><DD>
Indicates the end of options.
The variable <TT>opt_info.index</TT> contains the number of arguments
processed.
<DT><TT>'?'</TT><DD>
A usage message has been required.
You normally call <TT>optusage()</TT> to generate and display
the usage message.
</DL>
</DIV>
<P>
The following is an example of the option parsing portion
of the <TT>wc</TT> utility.
<DIV class=FI>
<PRE>
#include &lt;shell.h&gt;
while(1) switch(n=optget(argv,"xf:&#0091;file&#0093;"))
{
case 'f':
file = opt_info.arg;
break;
case ':':
error(ERROR_exit(0), opt_info.arg);
break;
case '?':
error(ERROR_usage(2), opt_info.arg);
break;
}
</DIV>
</PRE>
<P>
<H4><A name="Storage Management">Storage Management</A></H4>
It is important that any memory used by your built-in
be returned. Otherwise, if your built-in is called frequently,
<TT>ksh</TT> will eventually run out of memory.
You should avoid using <TT>malloc()</TT> for memory that must
be freed before returning from you built-in, because by default,
<TT>ksh</TT> will terminate you built-in in the event of an
interrupt and the memory will not be freed.
<P>
The best way to allocate variable sized storage is
through calls to the <STRONG>stak</STRONG> library
which is included in <STRONG>libast</STRONG>
and which is used extensively by <TT>ksh</TT> itself.
Objects allocated with the <TT>stakalloc()</TT>
function are freed when you function completes
or aborts.
The <STRONG>stak</STRONG> library provides a convenient way to
build variable length strings and other objects dynamically.
The man page for the <STRONG>stak</STRONG> library is contained
in the Appendix.
<P>
Before <TT>ksh</TT> calls each built-in command, it saves
the current stack location and restores it after
it returns.
It is not necessary to save and restore the stack
location in the <TT>b_</TT> entry function,
but you may want to write functions that use this stack
are restore it when leaving the function.
The following coding convention will do this in
an efficient manner:
<DIV class=FI>
<PRE>
<EM>yourfunction</EM>()
{
char *savebase;
int saveoffset;
if(saveoffset=staktell())
savebase = stakfreeze(0);
...
if(saveoffset)
stakset(savebase,saveoffset);
else
stakseek(0);
}
</DIV>
</PRE>
<P>
<P><HR><CENTER><FONT color=red><FONT face=courier><H3><A name="CALLING <TT>ksh</TT> SERVICES">CALLING <TT>ksh</TT> SERVICES</A></H3></FONT></FONT></CENTER>
Some of the more interesting applications are those that extend
the functionality of <TT>ksh</TT> in application specific directions.
A prime example of this is the X-windows extension which adds
builtins to create and delete widgets.
The <STRONG>nval</STRONG> library is used to interface with the shell
name space.
The <STRONG>shell</STRONG> library is used to access other shell services.
<P>
<H4><A name="The nval library">The nval library</A></H4>
A great deal of power is derived from the ability to use
portions of the hierarchal variable namespace provided by <TT>ksh-93</TT>
and turn these names into active objects.
<P>
The <STRONG>nval</STRONG> library is used to interface with shell
variables.
A man page for this file is provided in an Appendix.
You need to include the header <TT>&lt;nval.h&gt;</TT>
to access the functions defined in the <STRONG>nval</STRONG> library.
All the functions provided by the <STRONG>nval</STRONG> library begin
with the prefix <TT>nv_</TT>.
Each shell variable is an object in an associative table
that is referenced by name.
The type <TT>Namval_t*</TT> is pointer to a shell variable.
To operate on a shell variable, you first get a handle
to the variable with the <TT>nv_open()</TT> function
and then supply the handle returned as the first
argument of the function that provides an operation
on the variable.
You must call <TT>nv_close()</TT> when you are finished
using this handle so that the space can be freed once
the value is unset.
The two most frequent operations are to get the value of
the variable, and to assign value to the variable.
The <TT>nv_getval()</TT> returns a pointer the the
value of the variable.
In some cases the pointer returned is to a region that
will be overwritten by the next <TT>nv_getval()</TT> call
so that if the value isn't used immediately, it should
be copied.
Many variables can also generate a numeric value.
The <TT>nv_getnum()</TT> function returns a numeric
value for the given variable pointer, calling the
arithmetic evaluator if necessary.
<P>
The <TT>nv_putval()</TT> function is used to assign a new
value to a given variable.
The second argument to <TT>putval()</TT> is the value
to be assigned
and the third argument is a <EM>flag</EM> which
is used in interpreting the second argument.
<P>
Each shell variable can have one or more attributes.
The <TT>nv_isattr()</TT> is used to test for the existence
of one or more attributes.
See the appendix for a complete list of attributes.
<P>
By default, each shell variable passively stores the string you
give with with <TT>nv_putval()</TT>, and returns the value
with <TT>getval()</TT>. However, it is possible to turn
any node into an active entity by assigning functions
to it that will be called whenever <TT>nv_putval()</TT>
and/or <TT>nv_getval()</TT> is called.
In fact there are up to five functions that can
associated with each variable to override the
default actions.
The type <TT>Namfun_t</TT> is used to define these functions.
Only those that are non-<TT>NULL</TT> override the
default actions.
To override the default actions, you must allocate an
instance of <TT>Namfun_t</TT>, and then assign
the functions that you wish to override.
The <TT>putval()</TT>
function is called by the <TT>nv_putval()</TT> function.
A <TT>NULL</TT> for the <EM>value</EM> argument
indicates a request to unset the variable.
The <EM>type</EM> argument might contain the <TT>NV_INTEGER</TT>
bit so you should be prepared to do a conversion if
necessary.
The <TT>getval()</TT>
function is called by <TT>nv_getval()</TT>
value and must return a string.
The <TT>getnum()</TT>
function is called by by the arithmetic evaluator
and must return double.
If omitted, then it will call <TT>nv_getval()</TT> and
convert the result to a number.
<P>
The functionality of a variable can further be increased
by adding discipline functions that
can be associated with the variable.
A discipline function allows a script that uses your
variable to define functions whose name is
<EM>varname</EM><TT>.</TT><EM>discname</EM>
where <EM>varname</EM> is the name of the variable, and <EM>discname</EM>
is the name of the discipline.
When the user defines such a function, the <TT>settrap()</TT>
function will be called with the name of the discipline and
a pointer to the parse tree corresponding to the discipline
function.
The application determines when these functions are actually
executed.
By default, <TT>ksh</TT> defines <TT>get</TT>,
<TT>set</TT>, and <TT>unset</TT> as discipline functions.
<P>
In addition, it is possible to provide a data area that
will be passed as an argument to
each of these functions whenever any of these functions are called.
To have private data, you need to define and allocate a structure
that looks like
<DIV class=FI>
<PRE>
struct <EM>yours</EM>
{
Namfun_t fun;
<EM>your_data_fields</EM>;
};
</DIV>
</PRE>
<P>
<H4><A name="The shell library">The shell library</A></H4>
There are several functions that are used by <TT>ksh</TT> itself
that can also be called from built-in commands.
The man page for these routines are in the Appendix.
<P>
The <TT>sh_addbuiltin()</TT> function can be used to add or delete
builtin commands. It takes the name of the built-in, the
address of the function that implements the built-in, and
a <TT>void*</TT> pointer that will be passed to this function
as the third argument whenever it is invoked.
If the function address is <TT>NULL</TT>, the specified built-in
will be deleted. However, special built-in functions cannot
be deleted or modified.
<P>
The <TT>sh_fmtq()</TT> function takes a string and returns
a string that is quoted as necessary so that it can
be used as shell input.
This function is used to implement the <TT>%q</TT> option
of the shell built-in <TT>printf</TT> command.
<P>
The <TT>sh_parse()</TT> function returns a parse tree corresponding
to a give file stream. The tree can be executed by supplying
it as the first argument to
the <TT>sh_trap()</TT> function and giving a value of <TT>1</TT> as the
second argument.
Alternatively, the <TT>sh_trap()</TT> function can parse and execute
a string by passing the string as the first argument and giving <TT>0</TT>
as the second argument.
<P>
The <TT>sh_isoption()</TT> function can be used to set to see whether one
or more of the option settings is enabled.
</DIV>
<P><HR><CENTER><FONT color=red><FONT face=courier><H3><A name="References">References</A></H3></FONT></FONT></CENTER>
<P>
<DL compact>
<DT>[1]<DD>
<EM>POSIX &#45; Part 2: Shell and Utilities,</EM>
IEEE Std 1003.2-1992, ISO/IEC 9945-2:1993.
<DT>[2]<DD>
Glenn Fowler,
<EM>A Case for make</EM>,
Software - Practice and Experience, Vol. 20 No. S1, pp. 30-46, June 1990.
<DT>[3]<DD>
Brian W. Kernighan and Dennis M. Ritchie,
<EM>The C Programming Language</EM>,
Prentice Hall, 1978.
<DT>[4]<DD>
American National Standard for Information Systems &#45; Programming
Language &#45; C, ANSI X3.159-1989.
<DT>[5]<DD>
Bjarne Stroustroup,
<EM>C++</EM>,
Addison Wesley, xxxx
<DT>[6]<DD>
<EM>POSIX &#45; Part 1: System Application Program Interface,</EM>
IEEE Std 1003.1-1990, ISO/IEC 9945-1:1990.
<DT>[7]<DD>
David Korn and Kiem-Phong Vo,
<EM>SFIO - A Safe/Fast Input/Output library,</EM>
Proceedings of the Summer Usenix,
pp. , 1991.
</DL>
<P>
<HR>
<TABLE border=0 align=center width=96%>
<TR>
<TD align=left></TD>
<TD align=center></TD>
<TD align=right>March 13, 2012</TD>
</TR>
</TABLE>
<P>
</TD></TR></TBODY></TABLE>
</BODY>
</HTML>

55
docs/ksh/examples.html Normal file
View file

@ -0,0 +1,55 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<META name="generator" content="mm2html (AT&amp;T Research) 2012-01-11">
<TITLE> www/ksh/examples.mm mm document </TITLE>
<META name="author" content="gsf+dgk+kpv">
<STYLE type="text/css">
div.FI { padding-left:2em; text-indent:0em; }
div.HI { padding-left:4em; text-indent:-2em; }
dt { float:left; clear:both; }
dd { margin-left:3em; }
</STYLE>
</HEAD>
<BODY bgcolor=white link=slateblue vlink=teal >
<TABLE border=0 align=center width=96%>
<TBODY><TR><TD valign=top align=left>
<!--INDEX--><!--/INDEX-->
<P>
<P><CENTER><FONT color=red><FONT face=courier><H3><A name="Sample Functions">Sample Functions</A></H3></FONT></FONT></CENTER>
<P></P><TABLE border=0 frame=void rules=none width=100%><TBODY><TR><TD>
<TABLE align=center bgcolor=papayawhip border=0 bordercolor=white cellpadding=2 cellspacing=2 frame=void rules=none >
<TBODY>
<TR><TD align=left>
<A href="functions/dirs.txt">dirs</A>&nbsp;&nbsp;</TD><TD align=left>&nbsp;&nbsp;<A href="functions/getopt.txt">getopt</A>&nbsp;&nbsp;</TD><TD align=left>&nbsp;&nbsp;<A href="functions/popd.txt">popd</A>&nbsp;&nbsp;</TD><TD align=left>&nbsp;&nbsp;<A href="functions/title.txt">title</A></TD></TR>
<TR><TD align=left>
<A href="functions/emacs_keybind.txt">emacs_keybind</A>&nbsp;&nbsp;</TD><TD align=left>&nbsp;&nbsp;<A href="functions/keybind.txt">keybind</A>&nbsp;&nbsp;</TD><TD align=left>&nbsp;&nbsp;<A href="functions/pushd.txt">pushd</A>&nbsp;&nbsp;</TD><TD align=left>&nbsp;&nbsp;<A href="functions/vi_keybind.txt">vi_keybind</A></TD></TR>
</TBODY></TABLE></TD></TR></TBODY></TABLE>
<P>
<P><HR><CENTER><FONT color=red><FONT face=courier><H3><A name="Sample Scripts">Sample Scripts</A></H3></FONT></FONT></CENTER>
<P></P><TABLE border=0 frame=void rules=none width=100%><TBODY><TR><TD>
<TABLE align=center bgcolor=papayawhip border=0 bordercolor=white cellpadding=2 cellspacing=2 frame=void rules=none >
<TBODY>
<TR><TD align=left>
<A href="scripts/cgi-lib.ksh.txt">cgi-lib.ksh</A>&nbsp;&nbsp;</TD><TD align=left>&nbsp;&nbsp;<A href="scripts/env.txt">env</A>&nbsp;&nbsp;</TD><TD align=left>&nbsp;&nbsp;<A href="scripts/which.txt">which</A>&nbsp;&nbsp;</TD><TD align=left>&nbsp;&nbsp;&nbsp;</TD></TR>
<TR><TD align=left>
<A href="scripts/dump-cgi.ksh.txt">dump-cgi.ksh</A>&nbsp;&nbsp;</TD><TD align=left>&nbsp;&nbsp;<A href="scripts/line.txt">line</A>&nbsp;&nbsp;</TD><TD align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD><TD align=left>&nbsp;&nbsp;&nbsp;</TD></TR>
</TBODY></TABLE></TD></TR></TBODY></TABLE>
<P>
<HR>
<TABLE border=0 align=center width=96%>
<TR>
<TD align=left></TD>
<TD align=center></TD>
<TD align=right>March 13, 2012</TD>
</TR>
</TABLE>
<P>
</TD></TR></TBODY></TABLE>
</BODY>
</HTML>

1004
docs/ksh/faq.html Normal file

File diff suppressed because it is too large Load diff

207
docs/ksh/features.html Normal file
View file

@ -0,0 +1,207 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<META name="generator" content="mm2html (AT&amp;T Research) 2012-01-11">
<TITLE> www/ksh/features.mm mm document </TITLE>
<META name="author" content="gsf+dgk+kpv">
<STYLE type="text/css">
div.FI { padding-left:2em; text-indent:0em; }
div.HI { padding-left:4em; text-indent:-2em; }
dt { float:left; clear:both; }
dd { margin-left:3em; }
</STYLE>
</HEAD>
<BODY bgcolor=white link=slateblue vlink=teal >
<TABLE border=0 align=center width=96%>
<TBODY><TR><TD valign=top align=left>
<!--INDEX--><!--/INDEX-->
<P>
<P><CENTER><FONT color=red><FONT face=courier><H3><A name="ksh features">ksh features</A></H3></FONT></FONT></CENTER>
KSH-93 is the most recent version of the KornShell Language described in
<EM>The KornShell Command and Programming Language</EM>,
by Morris Bolsky and David Korn of AT&amp;T Research (nee Bell Laboratories).
The KornShell is a shell programming language,
which is upward compatible with
<EM>sh</EM>
(the Bourne Shell),
and is intended to conform to the IEEE P1003.2/ISO 9945.2 Shell and
Utilities standard.
KSH-93 provides an enhanced programming environment in
addition to the major command-entry features of the BSD
shell
<EM>csh</EM>.
With KSH-93, medium-sized programming tasks can be
performed at shell-level without a significant loss in performance.
In addition,
<EM>sh</EM>
scripts can be run on KSH-93 without modification.
<P>
The code should conform to the IEEE POSIX 1003.1 standard and to the
proposed ANSI-C standard so that it should be portable to all
such systems.
Like the previous version, KSH-88,
it is designed to accept eight bit character sets
transparently, thereby making it internationally compatible.
It can support multi-byte characters sets with some characteristics
of the character set given at run time.
<P>
KSH-93 provides the following features, many of which were also inherent
in KSH-88:
<P>
<H4><A name="Enhanced Command Re-entry Capability">Enhanced Command Re-entry Capability</A></H4>
The KSH-93 history
function records commands entered at any shell level and stores
them, up to a user-specified limit, even after you log off.
This allows you to re-enter long commands with a few keystrokes
- even those commands you entered yesterday.
The history file allows for eight bit characters in
commands and supports essentially unlimited size histories.
<P>
<H4><A name="In-line Editing">In-line Editing</A></H4>
In
<EM>sh</EM>
the only way to fix mistyped
commands is to backspace or retype the line.
KSH-93 allows you
to edit a command line using a choice of EMACS-TC or
<EM>vi</EM>
functions.
You can use the in-line editors to complete filenames as
you type them.
You may also use this editing feature when entering
command lines from your history file.
A user can capture keystrokes and rebind keys to customize the
editing interface.
<P>
<H4><A name="Extended I/O Capabilities">Extended I/O Capabilities</A></H4>
KSH-93 provides several I/O
capabilities not available in
<EM>sh</EM>,
including the ability to:
<UL type=square>
<LI>
specify a file descriptor for input and output
<LI>
start up and run co-processes
<LI>
produce a prompt at the terminal before a read
<LI>
easily format and interpret responses to a menu
<LI>
echo lines exactly as output without escape processing
<LI>
format output using printf formats.
<LI>
read and echo lines ending in "&#0092;e".
</UL>
<P>
<H4><A name="Improved performance">Improved performance</A></H4>
KSH-93 executes many scripts faster
than the System V Bourne shell.
A major reason for this is
that many of the standard utilities are built-in.
To reduce the time to initiate a command, KSH-93 allows
commands to be added as built-ins at run time
on systems that support dynamic loading such as System V Release 4.
<P>
<H4><A name="Arithmetic">Arithmetic</A></H4>
KSH-93 allows you to do integer arithmetic in any
base from two to sixty-four.
You can also do double
precision floating point arithmetic.
Almost the complete set of C language operators are available
with the same syntax and precedence.
Arithmetic expressions can be used to as an argument expansion
or as a separate command.
In addition there is an arithmetic for command that works
like the for statement in C.
<P>
<H4><A name="Arrays">Arrays</A></H4>
KSH-93 supports both indexed and associative arrays.
The subscript for an indexed array is an arithmetic expression,
whereas, the subscript for an associative array is a string.
<P>
<H4><A name="Functions and Aliases">Functions and Aliases</A></H4>
Two mechanisms - functions and
aliases - can be used to assign a user-selected identifier to
an existing command or shell script.
Functions allow local variables and provide scoping
for exception handling.
Functions can be searched for and loaded on first reference the
way scripts are.
<P>
<H4><A name="Substring Capabilities">Substring Capabilities</A></H4>
KSH-93 allows you to create a
substring of any given string either by specifying the starting
offset and length, or by stripping off leading
or trailing substrings during parameter substitution.
You can also specify attributes, such as upper and lower case,
field width, and justification to shell variables.
<P>
<H4><A name="Enhanced pattern matching capabilities">Enhanced pattern matching capabilities</A></H4>
KSH-93 allows you to specify
regular expressions for file and string matches.
<P>
<H4><A name="Improved debugging">Improved debugging</A></H4>
KSH-93 can generate line numbers on execution traces.
Also, I/O redirections are now traced.
There is a DEBUG trap that gets evaluated after each command
so that errors can be localized.
<P>
<H4><A name="Job Control">Job Control</A></H4>
On systems that support job control, including
System V Release 4, KSH-93
provides a job-control mechanism almost identical to that of
the BSD "csh", version 4.1.
This feature allows you
to stop and restart programs, and to move programs between the
foreground and the background.
<P>
<H4><A name="Added security">Added security</A></H4>
KSH-93 can execute scripts which do not have read permission
and scripts which have the setuid and/or setgid set when
invoked by name, rather than as an argument to the shell.
It is possible to log or control the execution of setuid and/or
setgid scripts.
The noclobber option prevents you from accidentally erasing
a file by redirecting to an existing file.
<P>
<H4><A name="Documentation">Documentation</A></H4>
Documentation for KSH-93 consists of an
<EM>Introduction to KSH-93,</EM>
<EM>Compatibility with the Bourne Shell</EM>,
a manual page and a
README file.
In addition, the
<EM>New KornShell Command and Programming Language</EM>
book is available from Prentice Hall.
<P>
<HR>
<TABLE border=0 align=center width=96%>
<TR>
<TD align=left></TD>
<TD align=center></TD>
<TD align=right>March 13, 2012</TD>
</TR>
</TABLE>
<P>
</TD></TR></TBODY></TABLE>
</BODY>
</HTML>

111
docs/ksh/functions/dirs.txt Normal file
View file

@ -0,0 +1,111 @@
#
# DIRECTORY MANIPULATION FUNCTIONS PUSHD, POPD AND DIRS
#
# Uses global parameters _push_max _push_top _push_stack
integer _push_max=100 _push_top=100
# Display directory stack -- $HOME displayed as ~
function dirs
{
typeset dir="${PWD#$HOME/}"
case $dir in
$HOME)
dir=\~
;;
/*) ;;
*) dir=\~/$dir
esac
print -r - "$dir ${_push_stack[@]}"
}
# Change directory and put directory on front of stack
function pushd
{
typeset dir= type=0
integer i
case $1 in
"") # pushd
if ((_push_top >= _push_max))
then print pushd: No other directory.
return 1
fi
type=1 dir=${_push_stack[_push_top]}
;;
+[1-9]|+[1-9][0-9]) # pushd +n
integer i=_push_top$1-1
if ((i >= _push_max))
then print pushd: Directory stack not that deep.
return 1
fi
type=2 dir=${_push_stack[i]}
;;
*) if ((_push_top <= 0))
then print pushd: Directory stack overflow.
return 1
fi
esac
case $dir in
\~*) dir=$HOME${dir#\~}
esac
cd "${dir:-$1}" > /dev/null || return 1
dir=${OLDPWD#$HOME/}
case $dir in
$HOME)
dir=\~
;;
/*) ;;
*) dir=\~/$dir
esac
case $type in
0) # pushd name
_push_stack[_push_top=_push_top-1]=$dir
;;
1) # pushd
_push_stack[_push_top]=$dir
;;
2) # push +n
type=${1#+} i=_push_top-1
set -- "${_push_stack[@]}" "$dir" "${_push_stack[@]}"
shift $type
for dir
do (((i=i+1) < _push_max)) || break
_push_stack[i]=$dir
done
esac
dirs
}
# Pops the top directory
function popd
{
typeset dir
if ((_push_top >= _push_max))
then print popd: Nothing to pop.
return 1
fi
case $1 in
"")
dir=${_push_stack[_push_top]}
case $dir in
\~*) dir=$HOME${dir#\~}
esac
cd "$dir" || return 1
;;
+[1-9]|+[1-9][0-9])
typeset savedir
integer i=_push_top$1-1
if ((i >= _push_max))
then print pushd: Directory stack not that deep.
return 1
fi
while ((i > _push_top))
do _push_stack[i]=${_push_stack[i-1]}
i=i-1
done
;;
*) print pushd: Bad directory.
return 1
esac
unset '_push_stack[_push_top]'
_push_top=_push_top+1
dirs
}

View file

@ -0,0 +1,12 @@
typeset -A Keytable
trap 'eval "${Keytable[${.sh.edchar}]}"' KEYBD
function emacs_keybind
{
keybind $'\E[A' $'\020' # Up key
keybind $'\E[B' $'\016' # Down key
keybind $'\E[C' $'\06' # Right key
keybind $'\E[D' $'\02' # Left key
keybind $'\E[H' $'\01' # Home key
keybind $'\E[Y' $'\05' # End key
keybind $'\t' $'\E\E' # Tab for command-line completion
}

View file

@ -0,0 +1,28 @@
function getopt
{
typeset c optstring=$1 options= sep=
shift
while getopts $optstring c
do case $c in
[:?])
exit 2
;;
*)
options="$options$sep-$c"
sep=' '
if [[ $optstring == *$c:* ]]
then options=" $options $OPTARG"
fi
#then print -rn -- " -$c" "$OPTARG"
#else print -rn -- " -$c"
;;
esac
done
print -rn -- "$options"
if [[ ${@:$OPTIND-1} != -- ]]
then print -rn -- " --"
fi
if [[ -n ${@:$OPTIND} ]]
then print -r -- " ${@:$OPTIND}"
fi
}

View file

@ -0,0 +1,14 @@
typeset -A Keytable
trap 'eval "${Keytable[${.sh.edchar}]}"' KEYBD
function keybind # key action
{
typeset key=$(print -f "%q" "$2")
case $# in
2) Keytable[$1]='.sh.edchar=${.sh.edmode}'"$key"
;;
1) unset Keytable[$1]
;;
*) print -u2 "Usage: $0 key [action]"
;;
esac
}

111
docs/ksh/functions/popd.txt Normal file
View file

@ -0,0 +1,111 @@
#
# DIRECTORY MANIPULATION FUNCTIONS PUSHD, POPD AND DIRS
#
# Uses global parameters _push_max _push_top _push_stack
integer _push_max=100 _push_top=100
# Display directory stack -- $HOME displayed as ~
function dirs
{
typeset dir="${PWD#$HOME/}"
case $dir in
$HOME)
dir=\~
;;
/*) ;;
*) dir=\~/$dir
esac
print -r - "$dir ${_push_stack[@]}"
}
# Change directory and put directory on front of stack
function pushd
{
typeset dir= type=0
integer i
case $1 in
"") # pushd
if ((_push_top >= _push_max))
then print pushd: No other directory.
return 1
fi
type=1 dir=${_push_stack[_push_top]}
;;
+[1-9]|+[1-9][0-9]) # pushd +n
integer i=_push_top$1-1
if ((i >= _push_max))
then print pushd: Directory stack not that deep.
return 1
fi
type=2 dir=${_push_stack[i]}
;;
*) if ((_push_top <= 0))
then print pushd: Directory stack overflow.
return 1
fi
esac
case $dir in
\~*) dir=$HOME${dir#~}
esac
cd "${dir:-$1}" > /dev/null || return 1
dir=${OLDPWD#$HOME/}
case $dir in
$HOME)
dir=\~
;;
/*) ;;
*) dir=\~/$dir
esac
case $type in
0) # pushd name
_push_stack[_push_top=_push_top-1]=$dir
;;
1) # pushd
_push_stack[_push_top]=$dir
;;
2) # push +n
type=${1#+} i=_push_top-1
set -- "${_push_stack[@]}" "$dir" "${_push_stack[@]}"
shift $type
for dir
do (((i=i+1) < _push_max)) || break
_push_stack[i]=$dir
done
esac
dirs
}
# Pops the top directory
function popd
{
typeset dir
if ((_push_top >= _push_max))
then print popd: Nothing to pop.
return 1
fi
case $1 in
"")
dir=${_push_stack[_push_top]}
case $dir in
\~*) dir=$HOME${dir#~}
esac
cd "$dir" || return 1
;;
+[1-9]|+[1-9][0-9])
typeset savedir
integer i=_push_top$1-1
if ((i >= _push_max))
then print pushd: Directory stack not that deep.
return 1
fi
while ((i > _push_top))
do _push_stack[i]=${_push_stack[i-1]}
i=i-1
done
;;
*) print pushd: Bad directory.
return 1
esac
unset '_push_stack[_push_top]'
_push_top=_push_top+1
dirs
}

View file

@ -0,0 +1,111 @@
#
# DIRECTORY MANIPULATION FUNCTIONS PUSHD, POPD AND DIRS
#
# Uses global parameters _push_max _push_top _push_stack
integer _push_max=100 _push_top=100
# Display directory stack -- $HOME displayed as ~
function dirs
{
typeset dir="${PWD#$HOME/}"
case $dir in
$HOME)
dir=\~
;;
/*) ;;
*) dir=\~/$dir
esac
print -r - "$dir ${_push_stack[@]}"
}
# Change directory and put directory on front of stack
function pushd
{
typeset dir= type=0
integer i
case $1 in
"") # pushd
if ((_push_top >= _push_max))
then print pushd: No other directory.
return 1
fi
type=1 dir=${_push_stack[_push_top]}
;;
+[1-9]|+[1-9][0-9]) # pushd +n
integer i=_push_top$1-1
if ((i >= _push_max))
then print pushd: Directory stack not that deep.
return 1
fi
type=2 dir=${_push_stack[i]}
;;
*) if ((_push_top <= 0))
then print pushd: Directory stack overflow.
return 1
fi
esac
case $dir in
\~*) dir=$HOME${dir#\~}
esac
cd "${dir:-$1}" > /dev/null || return 1
dir=${OLDPWD#$HOME/}
case $dir in
$HOME)
dir=\~
;;
/*) ;;
*) dir=\~/$dir
esac
case $type in
0) # pushd name
_push_stack[_push_top=_push_top-1]=$dir
;;
1) # pushd
_push_stack[_push_top]=$dir
;;
2) # push +n
type=${1#+} i=_push_top-1
set -- "${_push_stack[@]}" "$dir" "${_push_stack[@]}"
shift $type
for dir
do (((i=i+1) < _push_max)) || break
_push_stack[i]=$dir
done
esac
dirs
}
# Pops the top directory
function popd
{
typeset dir
if ((_push_top >= _push_max))
then print popd: Nothing to pop.
return 1
fi
case $1 in
"")
dir=${_push_stack[_push_top]}
case $dir in
\~*) dir=$HOME${dir#\~}
esac
cd "$dir" || return 1
;;
+[1-9]|+[1-9][0-9])
typeset savedir
integer i=_push_top$1-1
if ((i >= _push_max))
then print pushd: Directory stack not that deep.
return 1
fi
while ((i > _push_top))
do _push_stack[i]=${_push_stack[i-1]}
i=i-1
done
;;
*) print pushd: Bad directory.
return 1
esac
unset '_push_stack[_push_top]'
_push_top=_push_top+1
dirs
}

View file

@ -0,0 +1,54 @@
# add to (+), delete from (-), print (.), or set ([=]) window title
# arguments are eval'd before printing
# title text string exported in TITLE_TEXT
function title # [+ | - | =] title ...
{
typeset x t="$TITLE_TEXT"
case $1 in
+) shift
case $# in
0) ;;
*) for x
do case " $t " in
*" $x "*) ;;
" ") t=$x ;;
*) t="$t $x" ;;
esac
done
case $t in
$TITLE_TEXT) return 1 ;;
esac
;;
esac
;;
-) shift
case $# in
0) ;;
*) for x
do case " $t " in
*" $x "*) t="${t%?( )$x*}${t##*$x?( )}" ;;
esac
done
case $t in
$TITLE_TEXT) return 1 ;;
esac
;;
esac
;;
.) print -r -- "$TITLE_TEXT"
return 0
;;
*) t="$*"
;;
esac
export TITLE_TEXT="$t"
eval x=\"$t\"
case $TERM in
630*) print -nr -- "[?${#x};0v$x" ;;
vt100|xterm*) print -nr -- "]0;$x" ;;
*) return 1 ;;
esac
return 0
}

View file

@ -0,0 +1,10 @@
typeset -A Keytable
trap 'eval "${Keytable[${.sh.edchar}]}"' KEYBD
function vi_keybind
{
keybind $'\E[A' k # Up key
keybind $'\E[B' j # Down key
keybind $'\E[C' l # Right key
keybind $'\E[D' h # Left key
keybind $'\t' '\' # Tab for command-line completion
}

10
docs/ksh/index.html Normal file
View file

@ -0,0 +1,10 @@
<html>
<head><title>KSH93</title></head>
<body>
<a href='ksh.html'>Overview</a><br>
<a href='faq.html'>FAQ</a><br>
<a href='features.html'>Features</a><br>
<a href='builtins.html'>Builtins</a><br>
<a href='examples.html'>Examples</a>
</body>
</html>

118
docs/ksh/ksh.html Normal file
View file

@ -0,0 +1,118 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<META name="generator" content="mm2html (AT&amp;T Research) 2012-01-11">
<TITLE> www/ksh/ksh.mm mm document </TITLE>
<META name="author" content="gsf+dgk+kpv">
<STYLE type="text/css">
div.FI { padding-left:2em; text-indent:0em; }
div.HI { padding-left:4em; text-indent:-2em; }
dt { float:left; clear:both; }
dd { margin-left:3em; }
</STYLE>
</HEAD>
<BODY bgcolor=white link=slateblue vlink=teal >
<TABLE border=0 align=center width=96%>
<TBODY><TR><TD valign=top align=left>
<!--INDEX--><!--/INDEX-->
<P>
<P><CENTER><FONT color=red><FONT face=courier><H3><A name="ksh overview">ksh overview</A></H3></FONT></FONT></CENTER>
The
<STRONG>KornShell</STRONG>
language was designed and developed by David G. Korn at AT&amp;T Bell Laboratories and AT&amp;T Research.
It is an interactive command language that provides access to the UNIX system and to many other systems,
on the many different computers and workstations on which it is implemented.
The
<STRONG>KornShell</STRONG>
language is also a complete, powerful, high-level programming language for writing applications,
often more easily and quickly than with other high-level languages.
This makes it especially suitable for prototyping.
There are two other widely used shells, the Bourne shell developed by Steven Bourne at AT&amp;T Bell Laboratories,
and the C shell developed by Bill Joy at the University of California.
<STRONG>ksh</STRONG>
has the best features of both, plus many new features of its own.
Thus
<STRONG>ksh</STRONG>
can do much to enhance your productivity and the quality of your work,
both in interacting with the system, and in programming.
<STRONG>ksh</STRONG>
programs are easier to write, and are more concise and readable than programs written in a lower level language such as C.
<P>
The new version of
<STRONG>ksh</STRONG>
has the functionality of other scripting languages such as awk, icon, perl, rexx, and tcl.
For this and many other reasons,
<STRONG>ksh</STRONG>
is a much better scripting language than any of the other popular shells.
The code size for
<STRONG>ksh</STRONG>
is larger than the Bourne shell or C shell programs.
The revised version is even larger.
<P>
In spite of its increased size,
<STRONG>ksh</STRONG>
provides better performance.
You can write programs to run faster with
<STRONG>ksh</STRONG>
than with either the Bourne shell or the C shell, sometimes an order of magnitude faster.
<STRONG>ksh</STRONG>
has evolved and matured with extensive user feedback.
It has been used by many thousands of people at AT&amp;T since 1982, and at many other companies and universities.
A survey conducted at one of the largest AT&amp;T Bell Laboratories computer centers showed that 80% of their customers, both programmers and non-programmers, use
<STRONG>ksh.</STRONG>
<STRONG>ksh</STRONG>
is compatible with the Bourne shell.
Virtually all programs written for the Bourne shell run with
<STRONG>ksh.</STRONG>
If you are familiar with the Bourne shell, you can use
<STRONG>ksh</STRONG>
immediately, without retraining.
The new version of
<STRONG>ksh</STRONG>
is compatible with earlier versions of
<STRONG>ksh.</STRONG>
<STRONG>ksh</STRONG>
is readily available.
It is sold (source and binary) by AT&amp;T and Novell, and by other companies under license from AT&amp;T both in the USA and abroad.
It has been purchased by dozens of major corporations, and by many individuals for use on home computers.
<STRONG>ksh</STRONG>
is extensible.
<P>
The
<STRONG>KornShell</STRONG>
language uses the same syntax for built-in commands as for non built-in commands.
Therefore, system developers can add new commands "transparently" to the
<STRONG>KornShell</STRONG>
language; that is, with minimum effort and with no differences visible to users other than faster execution.
On systems with dynamic linking, it is possible to add new built-in commands at run time.
Novell has extended the new version of
<STRONG>ksh</STRONG>
to enable X-windows programming for their desktop
<STRONG>ksh</STRONG>
product,
<STRONG>dtksh</STRONG>.
<STRONG>dtksh</STRONG>
is a standard part of CDE, the Common Desktop Environment defined by COSE (Common Operating System Environment), supported by most major UNIX system hardware vendors.
An extended version of
<STRONG>ksh</STRONG>
that enables Tk programming, called tksh, is available as well.
<P>
<STRONG>ksh</STRONG>
is intended to conform to the Shell Language Standard developed by the IEEE POSIX 1003.2 Shell and Utilities Language Committee.
<P>
<HR>
<TABLE border=0 align=center width=96%>
<TR>
<TD align=left></TD>
<TD align=center></TD>
<TD align=right>March 13, 2012</TD>
</TR>
</TABLE>
<P>
</TD></TR></TBODY></TABLE>
</BODY>
</HTML>

View file

@ -0,0 +1,129 @@
typeset -A COOKIE HEADER
typeset Cgi _CGI_c _CGI_multipart
function cgi_header
{
typeset h
for h in "${!HEADER[@]}"
do printf '%s: %s\n' "$h" "${HEADER[$h]}"
done
print
}
function cgi_url
{
if [[ $SERVER_PORT != 80 ]]
then print "http://$SERVER_NAME:$SERVER_PORT$SCRIPT_NAME"
else print "http://$SERVER_NAME$SCRIPT_NAME"
fi
}
function cgi_parse
{
if [[ $REQUEST_METHOD == POST ]]
then if [[ $CONTENT_TYPE == multipart/form-data* ]]
then _CGI_multipart=${TMPDIR-/tmp}/cgi-form-$$
trap 'rm -rf "$_CGI_multipart"' EXIT
mkdir $_CGI_multipart
unset -f Cgi.set
typeset -A Cgi.file
typeset i b v
pax --nosummary --read --edit ",.*/,," --edit ",^,$_CGI_multipart/,"
for i in $_CGI_multipart/*
do b=${i##*/}
if [[ $b == +([a-z]) ]]
then v=$(<$i)
eval Cgi.$b='$v'
else Cgi.file[$b]=$i
fi
done
else Cgi=$(<&0) # Read from stdin
fi
else Cgi="$QUERY_STRING"
fi
cgi_cookie "$HTTP_COOKIE"
HEADER["Content-type"]="text/html"
}
function cgi_cookie
{
typeset cookie=$1 name val c IFS=';'
set -- $cookie
for c
do
IFS='='
set -- $c
name=${1##' '} val=${2##' '} # trim white space
name=${name%%' '} val=${val%%' '}
COOKIE[$name]=$val
done
}
function cgi_setcookie # name value
{
HEADER["Set-Cookie"]="$1=$2; path=$SCRIPT_NAME"
}
## Cgi variable disciplines
function Cgi.set
{
set -f
typeset i j n val IFS='&'
set -- ${.sh.value}
for i
do n=${i%%=*}
[[ $n == [[:alpha:]_]*([[:alnum:]_]) ]] || continue
val=${i#$n=}
val=${val//+/ }
val=${val//@([\'\\])/'\'\1}
eval j=\${#${.sh.name}.${n}[@]} \
"${.sh.name}.${n}[j]=\$'${val//'%'@(??)/'\x'\1"'\$'"}'"
done
}
function cgi_C_init
{
integer i
for ((i=1; i < 256; i++))
do if (( i!=16#22 && i!=16#27 && i!=16#5C && i!=16#5B && i!=16#5D ))
then printf $'_CGI_c[$\'\\\\x%.2X\']=%%%.2X\n' $i $i
fi
done
print
}
function cgi_encode
{
typeset v=$1
var=${v//' '/+}
cbrace='}'
eval var=${var//@([!a-zA-Z0-9_+])/\${_CGI_c[\\\1]$cbrace}
print -r -- "$var"
}
function Cgi.get
{
typeset i val name vname
if [[ ! ${_CGI_c[\\]} ]]
then val='"'
_CGI_c[""]=%00
_CGI_c[$var]=%22
_CGI_c[\']=%27
_CGI_c[\]]=%5B
_CGI_c[\[]=%5D
_CGI_c[\\]=%5C
eval $(cgi_C_init)
unset -f cgi_C_init
fi
vname=${.sh.name} # .sh.name contains variable name
.sh.value= # .sh.value stores value
for i in ${!Cgi.@}
do
name=${i#$vname.}
nameref v=${i}
val=$(cgi_encode "$v")
.sh.value="${.sh.value}${.sh.value:+&}$name=$val"
done
}

View file

@ -0,0 +1,17 @@
#!/bin/ksh
. ./cgi-lib.ksh
cgi_parse
cgi_header
print "<html>"
print "<pre>"
print -r "Url: $(cgi_url)"
for i in ${!Cgi.*}
do
nameref val=$i
print -r "$i = $val"
done
print "</pre>"
print "</html>"

66
docs/ksh/scripts/env.txt Normal file
View file

@ -0,0 +1,66 @@
#! /usr/bin/ksh
# shell version of env command
case $(getopts '[-]' opt '--???man' 2>&1) in
version=[0-9]*)
usage=$'[-?@(#)env (AT&T Labs Research) 1999-05-20\n]
[-author?David Korn <dgkorn@gmail.com>]
[-license?http://www.research.att.com/sw/tools/reuse]
[+NAME?env - set environment for command invocation]
[+DESCRIPTION?\benv\b modifies the current environment according
to the \aname\a\b=\b\avalue\a arguments, and then
invokes \acommand\a with the modified environment.]
[+?If \acommand\a is not specified, the resulting environment
is written to standard output quoted as required for
reading by the \bsh\b.]
[i:ignore-environment?Invoke \acommand\a with the exact environment
specified by the \aname\a\b=\b\avalue\a arguments; inherited
environment variables are ignored. As an obsolete feature,
\b-\b by itself can be specified instead of \b-i\b.]
[u:unset]:[name?Unset the environment variable \aname\a if it was
in the environment. This option can be repeated to unset
additional variables.]
[name=value]... [command ...]
[+EXIT STATUS?If \acommand\a is invoked, the exit status of \benv\b
will be that of \acommand\a. Otherwise, it will be one of
the following:]{
[+0?\benv\b completed successfully.]
[+126?\acommand\a was found but could not be invoked.]
[+127?\acommand\a could not be found.]
}
[+SEE ALSO?\bsh\b(1), \bexport\b(1)]
'
;;
*)
usage='iu:[name] [name=value]... [command ...]'
;;
esac
clear=
while getopts "$usage" var
do case $var in
i) clear=1;;
u) command unset $OPTARG 2> /dev/null;;
esac
done
#[[ $var == "" ]] || exit 1
shift $((OPTIND-1))
if [[ $1 == - ]] # obsolete form
then clear=1
shift
fi
if [[ $clear == 1 ]]
then typeset +x $(typeset +x)
fi
while true
do case $1 in
*=*) export "$1";;
*) break;;
esac
shift
done
if (( $# >0 ))
then exec "$@"
else export
exit 0
fi

View file

@ -0,0 +1,2 @@
#! /bin/ksh
read -r && print -r -- "$REPLY"

View file

@ -0,0 +1,2 @@
#! /bin/ksh
whence -p "$@"

260
lib/package/CONVERT.mk Normal file
View file

@ -0,0 +1,260 @@
/*
* {automake|configure} => {nmake|iffe} conversion support
*
* The first command line target overrides the default original source
* directory name $(MAKEFILE:D). The hard work is in the makefile using
* these assertions, since it must (manually) provide the nmake makefiles
* and config equivalent iffe scripts. The conversion makefile is typically
* named lib/package/PACKAGE.cvt in an ast package $PACKAGEROOT directory,
* and the conversion is run from the $PACKAGEROOT directory, e.g.:
*
* nmake -I lib/package -f PACKAGE-VERSION/PACKAGE.cvt
*
* The conversion requires the ast nmake, pax and tw commands.
*
* After the conversion you will be liberated from ./configure, *.in,
* *.am, automake, autom4te, libtool, make depend, and makefile
* recursion ordering. You can build from $PACKAGEROOT using the ast
* package(1) (which sets up the { HOSTTYPE PATH VPATH } environment):
*
* package make
*
* or cd into any arch/$HOSTTYPE/src subdirectory and rebuild that portion
* of the hierarchy with the ast nmake(1) (after setting PATH and VPATH):
*
* nmake
*
* The conversion assertions are:
*
* package :CONVERT: file ...
*
* files in the original source directory are copied
* and converted into the ./src and ./lib subdirectories
* the default original source directory is ./original
*
* package package name
* file original source file that must exist
*
* :OMIT: pattern
*
* files matching pattern are not copied into the converted
* directory
*
* pattern ksh pattern of files to omit
*
* :COPY: from to [ file ... ]
*
* files in the from directory are copied to the to directory
* the action may contain :MOVE: exceptions to the copy
*
* from original directory subdirectory
* . names the original directory
* .. names the
* to converted subdirectory
* libNAME => src/lib/libNAME
* NAME => src/cmd/NAME
* file files or files in subdirectories to be copied;
* explicit files are copied to the to directory;
* if no files are specified then the from hierarchy
* is recursively copied to the converted directory
*
* :MOVE: to file ...
*
* :COPY: assertion exceptions placed in the assertion's action
*
* to files or subdirectory files are copied to this directory
* file file or files in subdirectories to be copied
*
* :FILE: to file <<!
* contents
* !
*
* the :FILE: action is copied to the named file in the to directory
* the :FILE: action is usually specified using the here syntax to
* avoid make comment, quote and variable expansion
*
* :EDIT: to file ... | - pattern <<!
* edit script
* !
*
* the :EDIT: action is an ed(1) script applied to each file in the
* to directory after it has been copied from the original source
* directory; if to is - then the :EDIT: action is a sed(1) script
* that is applied to all files matching the file pattern during the
* copy from the original source directory; a file may be subject to
* both a sed(1) and ed(1) :EDIT:; the :EDIT: action is usually
* specified using the here syntax to avoid make comment, quote and
* variable expansion
*/
.CONVERT.ID. = "@(#)$Id: CONVERT (AT&T Research) 2004-03-19 $"
set nojobs noscan nowriteobject writestate=$$(MAKEFILE).ms
package = $(PWD:B)
here = !-=-=-=-=-!
hierarchy = src src/cmd src/lib
omit = .*|*.?(l)[ao]
original = $(MAKEFILE:D)
showedit = $(-debug:?p??)
CPFLAGS = -u
PAXFLAGS = -u -v
STDEDFLAGS = -
TW = tw
TWFLAGS = -CP
all : .VIRTUAL file
file : .VIRTUAL edit
edit : .VIRTUAL copy
copy : .VIRTUAL init
init : .VIRTUAL
.MAKEINIT : .cvt.init
.cvt.init : .MAKE .VIRTUAL .FORCE
local D
if D = "$(~.ARGS:O=1)"
if "$(D:T>FD)"
original := $(D)
.ARGS : .CLEAR $(~.ARGS:O>1)
end
end
.cvt.filter =
.cvt.package =
.cvt.atom : .FUNCTION
local N V
V := $(%:O=1)
let .cvt.$(V) = .cvt.$(V) + 1
return .cvt.$(V).$(.cvt.$(V))
.cvt.omit : .FUNCTION
return -s',^\(\(?K)?(*/)($(omit))?(/*))$,,$(showedit)'
.cvt.to : .FUNCTION
if "$(%)" == "."
return src
end
if "$(%)" == "*/*"
return src/$(%)
end
if "$(%)" == "lib*"
return src/lib/$(%)
end
return src/cmd/$(%)
":CONVERT:" : .MAKE .OPERATOR
local I
package := $(<)
I := $(hierarchy:C,$,/Makefile)
init : .cvt.verify $(I)
$(I) : .ACCEPT
test -d $(<:D) || $(MKDIR) -p $(<:D)
echo :MAKE: > $(<)
.cvt.verify : .MAKE .FORCE .REPEAT
local I
if I = "$(.cvt.package:T!=F)"
error 3 $(original): not a $(package) source directory: missing $(I)
end
.cvt.package := $(>:C,^,$$(original)/,)
":COPY:" : .MAKE .OPERATOR
local F T I A
F := $(>:O=1)
T := $(.cvt.to $(>:O=2))
A := $(.cvt.atom copy)
copy : $(A)
$(A) : .VIRTUAL
if F == "."
$(A) : $(T)
$(T) :
test -d $(<) || $(MKDIR) -p $(<)
for I $(>:O>2)
eval
$$(A) : $(I:D=$(T):B:S)
$(I:D=$(T):B:S) : $$(original)/$(I)
$$(CP) $$(CPFLAGS) $$(*) $$(<)
end
end
elif "$(F:T=FF)" || "$(F:N=*.(pax|t[bg]z))"
eval
$$(A) : $$(F)
test -d $(T) || $$(MKDIR) -p $(T)
cd $(T)
$$(PAX) $$(PAXFLAGS) -rf $$(*:P=A) -s ',^$(>:O=2)/*,,' $(.cvt.omit) $(.cvt.filter)
end
else
F := $$(original)/$(F)
if ! "$(@:V)"
eval
$$(A) : .FORCE
test -d $(T) || $$(MKDIR) -p $(T)
cd $(F:V)
$$(TW) $$(TWFLAGS) | $$(PAX) $$(PAXFLAGS) -rw $(.cvt.omit) $(.cvt.filter) $(T:P=A)
end
else
.cvt.move =
: $(@:V:@R)
eval
$$(A) : .FORCE
test -d $(T) || $$(MKDIR) -p $(T)
cd $(F:V)
$$(TW) $$(TWFLAGS) | $$(PAX) $$(PAXFLAGS) -rw $(.cvt.omit) $(.cvt.move) $(.cvt.filter) $(T:P=A)
end
end
end
":EDIT:" : .MAKE .OPERATOR
local A D F
D := $(>:O=1)
if D == "-"
A := ^$(>:O=2)^$$(SED) -e $(@:Q:/'\n'/ -e /G)
.cvt.filter += --action=$(A:@Q)
else
D := $(.cvt.to $(D))
F := $(>:O>1:C,^,$(D)/,)
edit : $(F)
eval
$$(F) :
$$(STDED) $$(STDEDFLAGS) $$(<) <<'$(here)'
$(@:V)
w
q
$(here)
end
end
":FILE:" : .MAKE .OPERATOR
local ( D F ) $(>)
local A
A := $(.cvt.atom file)
$(A) := $(@:V)
D := $(.cvt.to $(D))
file : $(D)/$(F)
eval
$$(D)/$$(F) :
test -d $$(<:D) || $$(MKDIR) -p $$(<:D)
cat > $$(<) <<'$(here)'
$$($(A):V)
$(here)
end
":MOVE:" : .MAKE .OPERATOR
local T I
T := ../../../$(.cvt.to $(>:O=1))
for I $(>:O>1)
if I == "*/"
.cvt.move += -s',^\(\(?K)$(I)),$(T)/,$(showedit)'
.cvt.move += -s',^\(\(?K)$(I:C%/$%%))$,,$(showedit)'
else
.cvt.move += -s',^\(\(?K)$(I))$,$(T)/$(I:B:S),$(showedit)'
end
end
":OMIT:" : .MAKE .OPERATOR
local P
for P $(>)
omit := $(omit)|$(P)
end

1029
lib/package/INIT.README Normal file

File diff suppressed because it is too large Load diff

1007
lib/package/INIT.html Normal file

File diff suppressed because it is too large Load diff

12
lib/package/INIT.pkg Normal file
View file

@ -0,0 +1,12 @@
INIT :PACKAGE:
:CATEGORY: admin utils
:INDEX: the package command with support scripts and utilities
:DESCRIPTION:
The INIT package is required by all but the standalone
and self extracting archive packages. It contains
the package command, support scripts, and utilities.
The package command installs binary packages, makes
source packages, and generates new package tarballs.

0
lib/package/INIT.req Normal file
View file

1
lib/package/INIT.ver Normal file
View file

@ -0,0 +1 @@
INIT 2012-08-01 2012-08-01 1

11
lib/package/ast-ast.pkg Normal file
View file

@ -0,0 +1,11 @@
ast-ast :PACKAGE: libast
:LICENSE: *.open
:CATEGORY: devel libs
:INDEX: the ast library, period
:DESCRIPTION:
The AT&T Software Technology ast-ast package from AT&T Research
contains the ast library.

22
lib/package/ast-base.pkg Normal file
View file

@ -0,0 +1,22 @@
ast-base :PACKAGE: \
ksh93 pax html proto bzip tw builtin libast libardir libcmd \
libdll libexpr libodelta librecsort libsum libuu libvdelta \
libbz libz tests 3d coshell cpp cs mam msgcc nmake probe ss \
libcoshell libcs libmam libpp libcodex paxlib codexlib \
libdss libpz dsslib libtaso
:COVERS: ast-make ast-ksh ast-ast
:LICENSE: *.open
:CATEGORY: devel libs shells
:INDEX: ksh, ksh builtin commands, pax, nmake, tw, sfio, and ast libraries
:DESCRIPTION:
The AT&T Software Technology ast-base package from AT&T Research
contains commands and libraries required by all other ast based
packages. Included are ksh93, ksh93 builtin commands, a pax that
generates compact delta archives, nmake, the 3d user level versioning
filesystem, coshell for network execution, a multi-dialect C preprocessor
and companion library, and libraries shared by the other ast packages.

0
lib/package/ast-base.req Normal file
View file

1
lib/package/ast-base.ver Normal file
View file

@ -0,0 +1 @@
ast-base 2012-08-01 2012-08-01 1

13
lib/package/ast-dss.pkg Normal file
View file

@ -0,0 +1,13 @@
ast-dss :PACKAGE: dss libdss libpz dsslib
:REQUIRES: ast-base
:LICENSE: *.(open|proprietary|special)
:CATEGORY: algorithms database utils
:INDEX: data stream scan command and support libraries
:DESCRIPTION:
The AT&T Software Technology ast-dss package from AT&T Research
contains the dss command, plugins and support libraries.

89
lib/package/ast-ksh.pkg Normal file
View file

@ -0,0 +1,89 @@
ast-ksh :PACKAGE: ksh93 libast libcmd libcoshell libsum libdll
:COVERS: ksh
:LICENSE: *.open
:CATEGORY: shells
:INDEX: ksh and support libraries
:DESCRIPTION:
The AT&T Software Technology ast-ksh package from AT&T Research
contains ksh and support libraries. This is the minimal set of
components needed to build ksh.
:DETAILS: cyg
:README:
This package installs a standalone ksh93 executable ksh93.exe
and its man page ksh93.1. If /bin/ksh.exe does not exist then
these symlinks
/bin/ksh.exe => ksh93.exe
/usr/share/man/man1/ksh93.1 => ksh.1
are created. This allows alternative ksh impelementations,
e.g., /bin/pdksh.exe, to be selected by changing the ksh.exe
and ksh.1 symbolic links. In addition, ksh and ksh93 paths are
added to /etc/shells if not already present.
$()
Each builtin or special command accepts the --man and --html
options to list the man page on the standard error. The --???
option describes the self documenting options available to all
builtin and special commands.
$()
The stanadlone ksh is statically linked with the ast libcmd
library which provides several builtin versions of /bin
commands. "builtin | grep /opt/ast/bin" lists the libcmd
builtins on the standard output. /opt/ast/bin/FOO accesses
the FOO builtin, whether the /opt/ast/bin directory exists
or not. "builtin FOO" allows /opt/ast/bin/FOO to be accessed
as FOO, bypassing the $PATH setting. To enable all libcmd
builtins do one of the following:
(a) create the directory /opt/ast/bin and the file
/opt/ast/bin/.paths with this line
BUILTIN_LIB=.
and place /opt/ast/bin before /bin and /usr/bin in $PATH
(this will affect all ksh subshells and scripts)
(b) run "builtin $( builtin | sed -e '/\//!d' -e 's,.*/,,' )"
(this will affect only the current shell)
Some scripts may run significantly faster with libcmd builtins
enabled.
$()
The ast library checks the DOSPATHVARS environment variable
for variable path values to convert to and from native windows
format when cross-executing between cygwin and non-cygwin
programs. The value is a space separated list of environment
variables to convert. PATH is handled by cygwin so it is not
converted by the ast library.
$()
The astksh cygwin source package provides a bootstrap build
environment that is not suited for an edit/build/debug cycle.
If you want to explore and modify the source then you should
install the (non-cygwinized) ast-base package which includes
AT&T nmake. With ast-base you will also be able to regenerate
the astksh cygwin source and binary packages.
$()
For more information on ksh and other AT&T ast tools see
http://www.research.att.com/sw/download/
:EXPORT:
SHOPT_CMDLIB_DIR=1
bin/ksh93.exe :INSTALL: bin/ksh.exe
share/man/man1/ksh93.1 :INSTALL: man/man1/sh.1
:POSTINSTALL:
if [ ! -e /bin/ksh.exe ]
then ln -fs ksh93.exe /bin/ksh.exe
ln -fs ksh93.1 /usr/share/man/man1/ksh.1
else echo "/bin/ksh.exe already exists"
fi
if [ -f /etc/shells ]
then for i in /bin/ksh93 /bin/ksh /usr/bin/ksh93 /usr/bin/ksh
do if grep $i /etc/shells >/dev/null 2>&1
then echo "$i already in /etc/shells"
else echo $i >> /etc/shells
echo "$i added to /etc/shells"
fi
done
else echo "no /etc/shells file"
fi
exit 0
:TEST: bin/ksh
KSH=$<; cd src/cmd/ksh93/tests; CYGWIN="$$CYGWIN ntsec binmode" SHELL=$$KSH $$KSH shtests

0
lib/package/ast-ksh.req Normal file
View file

1
lib/package/ast-ksh.ver Normal file
View file

@ -0,0 +1 @@
ast-ksh 2012-08-01 2012-08-01 1

19
lib/package/ast-make.pkg Normal file
View file

@ -0,0 +1,19 @@
ast-make :PACKAGE: \
nmake cpp probe 3d ksh93 coshell cs ss pax paxlib tw \
libast libardir libcmd libsum libdll libcoshell libpp
:AUXILIARY: bin/proto bin/pax
:LICENSE: *.open
:COVERS: ast-ksh ast-ast
:CATEGORY: devel libs shells
:INDEX: ksh, pax, nmake
:DESCRIPTION:
The AT&T Software Technology ast-make package from AT&T Research
contains an almost minimal set of commands and libraries required
to run ast nmake. ksh, coshell, pax, tw, and the 3d user-level
filesystem are also included.

20
lib/package/ast-open.pkg Normal file
View file

@ -0,0 +1,20 @@
ast-open :PACKAGE: \
ksh93 kshlib pax html proto bzip libast libardir libcmd libdll \
libexpr libodelta librecsort libsum libuu libvdelta libbz \
libz tests 3d coshell cpp cs mam msgcc nmake probe ss \
libcoshell libcs libmam libpp libcodex paxlib codexlib \
at builtin codex dss dsslib ie mailx mam ncsl pack pzip \
re sort sortlib std tksh tw warp libdss libpz \
libtksh libtk vczip libvcodex libvgraph libtaso jcl libjcl
:COVERS: ast-base ast-dss
:LICENSE: *.open
:CATEGORY: devel libs mail shells utils
:INDEX: ksh, pax, nmake, sfio, and ast open source commands and libraries
:DESCRIPTION:
The AT&T Software Technology ast-open package from AT&T Research
contains all of the ast open source commands and libraries.

0
lib/package/ast-open.req Normal file
View file

1
lib/package/ast-open.ver Normal file
View file

@ -0,0 +1 @@
ast-open 2012-08-01 2012-08-01 1

49
lib/package/ast.def Normal file
View file

@ -0,0 +1,49 @@
#
# ast default license info
#
message_set=3
contributor+=(
[gsf]="Glenn Fowler <gsf@research.att.com>"
[dgk]="David Korn <dgk@research.att.com>"
[kpv]="Phong Vo <kpv@research.att.com>"
[aedgar]="Adam Edgar <aedgar@research.att.com>"
[alb]="Adam Buchsbaum <alb@adambuchsbaum.com>"
[ashaikh]="Aman Shaikh <ashaikh@research.att.com>"
[bala]="Bala Krishnamurthy <bala@research.att.com>"
[brussell]="Brian Russell <brussell@research.att.com>"
[chen]="Robin Chen <chen@research.att.com>"
[dfwc]="Don Caldwell <dfwc@research.att.com>"
[ek]="Lefty Koutsofios <ek@research.att.com>"
[gruber]="Bob Gruber <bob.gruber@gmail.com>"
[jiawang]="Jia Wang <jiawang@research.att.com>"
[jkf]="Jeff Fellin <jkf@research.att.com>"
[jlk]="Jeff Korn <@google.com>"
[kfisher]="Kathleen Fisher <kfisher@research.att.com>"
[kwc]="Ken Church <@microsoft.com>"
[bwk]="Brian Kernigham <bwk@research.bell-labs.com>"
[dmr]="Dennis Ritchie <dmr@research.bell-labs.com>"
[doug]="Doug McIlroy <doug@research.bell-labs.com>"
[ekrell]="Eduardo Krell <ekrell@adexus.cl>"
[jjs]="John Snyder <jjs@adexus.cl>"
[rao]="Herman Rao <rao@fareastone.att.com.tw>"
[ast-users]="AST users mailgroup <ast-users@research.att.com>"
[ast-developers]="AST developers mailgroup <ast-developers@research.att.com>"
)
license+=(
organization="Information and Software Systems Research"
domain=research.att.com
parent="AT&T"
corporation="Intellectual Property"
company="Research"
location="Florham Park NJ"
package=ast
since=1986
author=gsf+dgk+kpv
)

5
lib/package/ast.lic Normal file
View file

@ -0,0 +1,5 @@
. ast.def
. epl.def
license+=(
start=2011
)

45
lib/package/bsd.def Normal file
View file

@ -0,0 +1,45 @@
message_set=18
contributor+=(
[bj]="Bill Joy"
)
license+=(
company="The Regents of the University of California"
package=BSD
since=1979
type=bsd
name="${license.package} Open Source"
url=http://www.opensource.org/licenses/bsd-license
urlmd5=5bfd485a7ffdb6249d1097da94ae75fc
notice='
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
3. Neither the name of the University nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
'
)

1
lib/package/bsd.lic Normal file
View file

@ -0,0 +1 @@
. bsd.def

8
lib/package/epl.def Normal file
View file

@ -0,0 +1,8 @@
license+=(
type=epl
id=eclipse
name="Eclipse Public License"
version=1.0
url=http://www.eclipse.org/org/documents/${license.type}-v${license.version//./}.html
urlmd5=b35adb5213ca9657e911e9befb180842
)

14
lib/package/ksh.pkg Normal file
View file

@ -0,0 +1,14 @@
ksh :PACKAGE:
:LICENSE: *.open
:CATEGORY: shells
:INDEX: standalone AT&T ksh executable
:DESCRIPTION:
The AT&T Software Technology ksh package from AT&T Research
contains the AT&T ksh executable implemented by David Korn.
The download file is a gzipped ksh executable. If you want
to build ksh from the source then download one of the ast-ksh,
ast-base or ast-open packages.

1537
lib/package/package.mk Normal file

File diff suppressed because it is too large Load diff

39
lib/package/zlib.def Normal file
View file

@ -0,0 +1,39 @@
message_set=20
contributor+=(
[jlg]="Jean-loup Gailly"
[ma]="Mark Adler"
)
license+=(
company="Jean-loup Gailly and Mark Adler"
package=zlib
since=1995
type=zlib
name="${license.package} Open Source"
url=http://www.opensource.org/licenses/Zlib
urlmd5=4cfd2c17b0340c2f3c80b577a8e45bee
notice='
This software is provided "as-is", without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would
be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
'
)

1
lib/package/zlib.lic Normal file
View file

@ -0,0 +1 @@
. zlib.def

16
src/Mamfile Normal file
View file

@ -0,0 +1,16 @@
info mam static
note *
note * This build file is in the Make Abstract Machine (MAM) language. It was
note * first generated by nmake, but in the ksh 93u+m distribution we maintain
note * it manually because nmake had too many problems to keep using. The
note * Mamfiles are processed by mamake (src/cmd/INIT/mamake.c); we added
note * support for indentation to improve readability. The language is
note * documented in Glenn Fowler's paper "A Make Abstract Machine":
note * http://web.archive.org/web/20041227143022/http://www2.research.att.com/~gsf/mam/mam.html
note *
note source level :MAKE: equivalent
make install
make all
exec - ${MAMAKE} -r '*/*' ${MAMAKEARGS}
done all virtual
done install virtual

870
src/cmd/INIT/C+probe Normal file
View file

@ -0,0 +1,870 @@
:
### this script contains archaic constructs that work with all sh variants ###
# Glenn Fowler
# AT&T Research
#
# @(#)C probe (AT&T Research) 2012-02-29
#
# probe [ -d ] c-compiler-path [ attributes ]
#
# common C probe preamble for the tool specific probes
#
# NOTE: some cc -E's do syntax analysis!
#
# probe_* are first eval'd and then attempted from left to right
#
probe_binding="-dy -dn -Bdynamic -Bstatic '-Wl,-ashared -Wl,+s' -Wl,-aarchive -call_shared -non_shared -dynamic -static -bshared -bstatic '' -static"
probe_env="CC_OPTIONS CCOPTS LD_OPTIONS LDOPTS LIBPATH LPATH"
probe_include="stdio.h iostream.h complex.h ctype.h plot.h stdarg.h varargs.h ranlib.h hash.h sys/types.h stab.h cmath cstdio iostream string"
probe_longlong="long 'long long'"
probe_longlong_t="__int64_t _int64_t __int64 _int64 int64"
probe_l="l yyreject m sin mopt sin"
probe_lxx="C exit ++ exit g++ exit"
probe_ppprefix="a n"
probe_size="size"
probe_src="cxx C cc c"
probe_sa=".sa"
probe_sd=".dll .lib .dll .x"
probe_sdb=".pdb"
probe_so=".dylib .so .sl"
probe_symprefix="_"
probe_verbose="'-v -v' '-# -#' '-d -d' -dryrun '-V -V'"
probe_version="--version -V -version -v"
#
# the following are set by the preamble for the tool specific probe
#
cc=cc
debug=
dir=.
dll=.dll
dynamic=
exe=exe
executable="test -x"
hosted=
ifs=${IFS-'
'}
obj=o
ppenv=
ppopt=
predef=
prepred=
sa=
sd=
sdb=
so=
sov=
static=
stdlib=
stdpp=
suffix_command=
if test "" != "$TMPDIR" -a -d "$TMPDIR"
then tmpdir=$TMPDIR
else tmpdir=/tmp
fi
tmpdir=$tmpdir/probe$$
undef="define defined elif else endif error if ifdef ifndef include line pragma undef __STDC__ __STDPP__ __ARGC__ __BASE__ __BASE_FILE__ __DATE__ __FILE__ __FUNCTION__ __INCLUDE_LEVEL__ __LINE__ __PATH__ __TIME__ __TIMESTAMP__ __VERSION__"
version_flags=
version_stamp=
version_string=
#
# constrain the environment
#
DISPLAY=
LC_ALL=C
export DISPLAY LC_ALL
#
# now the common probes
#
while :
do case $1 in
-d) debug=1 ;;
-*) set ''; break ;;
*) break ;;
esac
shift
done
cc=$1
case $cc in
[\\/]*|[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz]:\\*)
;;
*) echo "Usage: $0 [ -d ] c-compiler-path [ attributes ]" >&2
exit 1
;;
esac
ATTRIBUTES=
eval $2
_probe_PATH=$PATH
PATH=/usr/bin:/bin:$PATH
case $0 in
*[\\/]*) dir=`echo $0 | sed -e 's,[\\/][\\/]*[^\\/]*\$,,'` ;;
esac
$executable . 2>/dev/null || executable='test -r'
case $SHELL in
[\\/]*|[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz]:\\*)
sh=$SHELL
;;
*) sh=/bin/sh
;;
esac
trap 'code=$?; cd ..; rm -rf $tmpdir; exit $code' 0 1 2 3
mkdir $tmpdir
cd $tmpdir
exec 3>&1 4>&2 </dev/null
case $debug in
"") exec >/dev/null 2>&1
(ulimit -c 0) >/dev/null 2>&1 && ulimit -c 0
;;
*) PS4='+$LINENO+ '
set -x
;;
esac
if (xxx=xxx; unset xxx)
then UNSET=1
else UNSET=
fi
eval set x $probe_env
while :
do shift
case $# in
0) break ;;
esac
eval x='$'$1
case $x in
'') continue ;;
esac
case $1 in
*PATH) _probe_export="$_probe_export $1='$x'" ;;
esac
case $UNSET in
'') eval $1=
export $1
;;
*) unset $1
;;
esac
done
if test -f "$dir/probe.ini"
then . "$dir/probe.ini"
IFS=$ifs
fi
mkdir suffix
cd suffix
for src in $probe_src
do echo "int main(){return 0;}" > ../test.$src
rm -f test*
if $cc -c ../test.$src
then set test.*
if test -f "$1"
then o="$*"
mv $* ..
for i in $o
do if $cc -o test.exe ../$i
then obj=`echo "$i" | sed -e 's,test.,,'`
$executable test.exe || executable="test -r"
set test*
rm *
if $cc -o test ../$i
then rm $*
set test.*
if $executable "$1"
then exe=`echo "$1" | sed -e 's,test.,,'`
suffix_command=.$exe
fi
fi
break 2
fi
done
fi
fi
done
cd ..
case $src in
c) ;;
*) echo '// (
int
main()
{
class { public: int i; } j;
j.i = 0;
int k = j.i + 1;
return k;
}' > dialect.$src
if $cc -c dialect.$src && $cc -o dialect.$exe dialect.$obj && $executable dialect.$exe
then mv dialect.$src dialect.c
rm -f dialect.$obj dialect.$exe
if $cc -c dialect.c && $cc -o dialect.$exe dialect.$obj && $executable dialect.$exe
then src=c
else set x $cc
while :
do shift
case $# in
0) break ;;
esac
case $1 in
*=*) continue ;;
esac
case `echo $1 | sed -e 's,.*/,,'` in
*CC*|*++*|*[xX][xX]*|*[pP][lL][uU][sS]*) ;;
*) src=c ;;
esac
break
done
fi
else src=c
fi
;;
esac
set x x '(' 1 'int x;' 0
while :
do shift
shift
case $# in
[01]) break ;;
esac
rm -f test.$obj
echo "$1" > test.$src
$cc -c test.$src
r=$?
case $r in
0) test -f test.$obj || r=1 ;;
*) r=1 ;;
esac
case $2:$r in
0:0) ;;
0:1) echo "$cc: not a C compiler: failed to compile \`\`$1''" >&4
exit 1
;;
1:0) echo "$cc: not a C compiler: successfully compiled \`\`$1''" >&4
exit 1
;;
esac
done
hosttype=`package CC="$cc" || $SHELL -c "package CC='$cc'"`
case $hosttype in
*[Uu][Ss][Aa][Gg][Ee]:*)
hosttype=`PATH=$_probe_PATH; export PATH; package CC="$cc" || $SHELL -c "package CC='$cc'"`
;;
esac
echo '#include <stdio.h>
int main(){printf("hello");return 0;}' > dynamic.$src
echo 'extern int sfclose() { return 0; }' > fun.$src
if $cc -c dynamic.$src && $cc -c fun.$src
then eval set x $probe_so
while :
do shift
case $# in
0) break ;;
esac
for i in foo junk
do rm -f dynamic.$exe
if $cc -L. -o dynamic.$exe dynamic.$obj -l$i
then : "there's really a -l$i"?
else rm -f dynamic.$exe
cat fun.$obj > lib$i$1
$cc -L. -o dynamic.$exe dynamic.$obj -l$i && $executable dynamic.$exe
x=$?
rm lib$i$1
case $x in
0) so=$1
rm -f dynamic.$exe > lib$i$1.1
$cc -L. -o dynamic.$exe dynamic.$obj -l$i && $executable dynamic.$exe
x=$?
rm lib$i$1.1
case $x in
0) sov=1 ;;
esac
break 2
;;
*) break
;;
esac
fi
done
k=
for i in "" .1 .2 .3 .4 .5 .6 .7 .8 .9
do rm -f dynamic.$exe > libc$1$i
$cc -L. -o dynamic.$exe dynamic.$obj && $executable dynamic.$exe
x=$?
(cd ..; rm $tmpdir/libc$1$i)
case $x in
0) ;;
*) k=X$k
case $k in
XXX) break ;;
esac
;;
esac
done
case $k in
XXX) so=$1
sov=1
break
;;
?*) so=$1
break
;;
esac
done
rm -f dynamic.$exe
if $cc -o dynamic.$exe dynamic.$obj 2>e && $executable dynamic.$exe
then e=`wc -l e`
maybe=
eval set x x $probe_binding
while :
do shift
shift
case $# in
0) break ;;
esac
rm -f dynamic.$exe
$cc -o dynamic.$exe $1 dynamic.$obj 2>e && $executable dynamic.$exe || continue
case $1 in
?*) case $maybe in
"") maybe=$1 ;;
*) maybe=-- ;;
esac
;;
esac
case `wc -l e` in
$e) ;;
*) continue ;;
esac
d=`ls -s dynamic.$exe`
rm -f dynamic.$exe
$cc -o dynamic.$exe $2 dynamic.$obj 2>e && $executable dynamic.$exe || continue
case `wc -l e` in
$e) ;;
*) continue ;;
esac
case `ls -s dynamic.$exe` in
$d) ;;
*) dynamic=$1
static=$2
maybe=
break
;;
esac
done
case $maybe in
""|--) ;;
*) rm -f dynamic.$exe
if $cc -o dynamic.$exe $maybe dynamic.$obj 2>e && $executable dynamic.$exe
then e=`wc -l e`
if $cc -o dynamic.$exe $maybe-bogus-bogus-bogus dynamic.$obj 2>e && $executable dynamic.$exe
then case `wc -l e` in
$e) ;;
*) dynamic=$maybe ;;
esac
else dynamic=$maybe
fi
fi
;;
esac
fi
fi
eval set x $probe_version
shift
for o in "$@"
do if $cc $o > version.out 2>&1
then version_string=`sed -e '/ is /d' -e 's/;/ /g' version.out | sed -e 1q`
case $version_string in
''|*[Ee][Rr][Rr][Oo][Rr]*|*[Ff][Aa][Tt][Aa][Ll]*|*[Ww][Aa][Rr][Nn][Ii][Nn][Gg]*|*[Oo][Pp][Tt][Ii][Oo][Nn]*)
;;
*) version_flags=$o
version_stamp=";VERSION;$o;$version_string;PATH;$cc"
break
;;
esac
fi
done
case $version_stamp in
'') eval set x $probe_version
shift
echo 'int main() { return 0; }' > version.i
for o in "$@"
do if $cc -c $o version.i > version.out 2>&1
then version_string=`sed -e '/ is /d' -e 's/;/ /g' version.out | sed -e 1q`
case $version_string in
''|*[Ee][Rr][Rr][Oo][Rr]*|*[Ff][Aa][Tt][Aa][Ll]*|*[Ww][Aa][Rr][Nn][Ii][Nn][Gg]*|*[Oo][Pp][Tt][Ii][Oo][Nn]*)
;;
*) version_flags=$o
break
;;
esac
fi
done
;;
esac
echo 'int main(){return 0;}' > hosted.$src
$cc -o hosted.$exe hosted.$src && ./hosted.$exe && hosted=1
echo '#!'$sh'
echo "" $@' > cpp
chmod +x cpp
case `./cpp -Dprobe` in
*-Dprobe*)
;;
*) cp /bin/echo cpp
chmod u+w cpp
;;
esac
for prefix in $probe_ppprefix `echo $cc | sed -e '/cc\$/!d' -e 's,cc\$,,' -e 's,.*/,,'`
do cp cpp ${prefix}cpp
done
echo "" > flags.$src
echo '#pragma pp:version' > libpp.$src
if test `realcppC=./cpp $cc -Dprobe -E flags.$src | tee cpp.out | grep -c '[-]Dprobe'` -eq 1
then ppenv='realcppC=${ppcmd}'
elif test `cppC=./cpp $cc -Dprobe -E flags.$src | tee cpp.out | grep -c '[-]Dprobe'` -eq 1
then ppenv='cppC=${ppcmd}'
elif test `_CPPNAME=./cpp $cc -Dprobe -E flags.$src | tee cpp.out | grep -c '[-]Dprobe'` -eq 1
then ppenv='_CPPNAME=${ppcmd}'
elif test `_CPP=./cpp $cc -Dprobe -E flags.$src | tee cpp.out | grep -c '[-]Dprobe'` -eq 1
then ppenv='_CPP=${ppcmd}'
elif test `$cc -Dprobe -E -%p+. flags.$src | tee cpp.out | grep -c '[-]Dprobe'` -eq 1 && test `$cc -Dprobe -E -%p+. flags.$src | wc -l` -eq 1
then ppopt='-%p+${ppdir}'
elif test `$cc -Dprobe -E -Yp,. flags.$src | tee cpp.out | grep -c '[-]Dprobe'` -eq 1
then ppopt='-Yp,${ppdir}'
elif test `$cc -Dprobe -E -Qpath $tmpdir flags.$src | tee cpp.out | grep -c '[-]Dprobe'` -eq 1
then ppopt='-Qpath ${ppdir}'
elif test `$cc -Dprobe -E -tp -B./ flags.$src 2>err.out | tee cpp.out | grep -c '[-]Dprobe'` -eq 1 -a ! -s err.out
then ppopt='-tp -B${ppdir}/'
elif test `$cc -Dprobe -E -B./ flags.$src | tee cpp.out | grep -c '[-]Dprobe'` -eq 1
then ppopt='-B${ppdir}/'
elif test `$cc -Dprobe -E -tp -h./ -B flags.$src | tee cpp.out | grep -c '[-]Dprobe'` -eq 1
then ppopt='-tp -h${ppdir}/ -B'
elif test `$cc -Dprobe -E -t p,./cpp flags.$src | tee cpp.out | grep -c '[-]Dprobe'` -eq 1
then ppopt='-t p,${ppcmd}'
else {
eval set x $probe_verbose
shift
for o in "$@"
do $cc -E $o flags.$src
done
} 2>&1 | sed -e "s/['\"]//g" > cpp.out
fi
set x `sed -e 's,[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz]:\\\\,/,g' -e 's,\\\\,/,g' cpp.out`
def=
definclude="-I+C -I-H"
stdinclude=$definclude
case $hosted in
"") usrinclude= ;;
esac
cmdinclude=
while :
do case $# in
0|1) break ;;
esac
shift
case $1 in
-A) case $2 in
*\(*\)) shift
prepred="$prepred `echo $1 | sed 's/\(.*\)(\(.*\))/\1 \2/'`"
;;
esac
;;
-A\(*\))
prepred="$prepred `echo $1 | sed 's/-A\(.*\)(\(.*\))/\1 \2/'`"
;;
-[DI][-+][ABCDEFGHIJKLMNOPQRSTUVWXYZ]*)
stdpp=1
case $1 in
-I?[CH]) case $def in
?*) definclude="$definclude $1" ;;
*) stdinclude="$stdinclude $1" ;;
esac
;;
-I-S*|-YI,*) usrinclude="`echo $1 | sed 's/....//'`" ;;
-Y?,*) ;;
-Y*) usrinclude="`echo $1 | sed 's/..//'`" ;;
esac
;;
-D) shift
case $1 in
[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]*=*)
predef="$predef
`echo $1 | sed -e 's/=.*//'`"
;;
[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]*)
predef="$predef
$1"
;;
esac
;;
-Dprobe);;
-D*) case $1 in
-D[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]*=*)
predef="$predef
`echo $1 | sed -e 's/^-D//' -e 's/=.*//'`"
;;
-D[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]*)
predef="$predef
`echo $1 | sed -e 's/^-D//'`"
;;
esac
;;
-I) shift
case $1 in
/*) case $def in
?*) definclude="$definclude $1" ;;
*) stdinclude="$stdinclude $1" ;;
esac
cmdinclude="$cmdinclude $1"
;;
esac
;;
-I/*) f=`echo X$1 | sed 's/X-I//'`
case $def in
?*) definclude="$definclude $f" ;;
*) stdinclude="$stdinclude $f" ;;
esac
cmdinclude="$cmdinclude $f"
;;
-U) shift
undef="$undef $1"
;;
-U*) undef="$undef `echo $1 | sed 's/^-U//'`"
;;
flags.$src)def=
;;
esac
done
stdinclude="$stdinclude $definclude"
case " $stdinclude " in
*\ $usrinclude\ *)
case $usrinclude in
/usr/include)
usrinclude=
;;
*) case " $stdinclude " in
*\ /usr/include\ *)
usrinclude=
;;
*) usrinclude=/usr/include
;;
esac
;;
esac
;;
esac
tstinclude=`$cc -v -E flags.$src 2>&1 | sed -e '1,/[iI][nN][cC][lL][uU][dD][eE][ ]*<[.][.][.]>/d' -e '/^[eE][nN][dD] [oO][fF] [sS][eE][aA][rR][cC][hH]/,\$d'`
j=$tstinclude
case $j in
*/*) ;;
*) j=$cmdinclude ;;
esac
tstinclude=
good=
nogood=
c_hdr="stdio.h ctype.h"
C_hdr="libc.h"
for i in $j
do if test -d "$i"
then tstinclude="$tstinclude $i"
h=
for f in $c_hdr
do if test -f "$i/$f"
then case $i in
*/CC) nogood=1 ;;
*) good=1 ;;
esac
else h="$h $f"
fi
done
c_hdr=$h
h=
for f in $C_hdr
do if test -f "$i/$f"
then case $i in
*/CC) nogood=1 ;;
*) good=1 ;;
esac
else h="$h $f"
fi
done
C_hdr=$h
fi
done
case $nogood in
1) good=0 ;;
esac
case $good in
1) case $c_hdr in
?*) bad=1
usrinclude=/usr/include
set '' $tstinclude /usr/include
;;
*) set '' $tstinclude
;;
esac
shift
stdinclude=$*
echo "#include <sys/types.h>" > include.$src
$cc -E include.$src | sed -e '/# 1 "[\\/]/!d' -e 's,[^"]*",,' -e 's,[\\/][^\\/]*".*,,' -e 's,[\\/]sys,,' > include.out
for f in `cat include.out`
do if test -d "$f"
then g=`echo $f | sed -e 's,[\\/][\\/]*[^\\/]*$,,'`
case " $stdinclude " in
*\ $f\ *|*\ $g\ *)
;;
*) stdinclude="$stdinclude $f"
case $f in
/usr/include) usrinclude=$f ;;
esac
bad=1
;;
esac
fi
done
;;
*) case $ppopt$ppenv in
?*) echo '#!'$sh'
echo $VIRTUAL_ROOT | sed "s/:.*//"' > cpp
chmod +x cpp
ppcmd=cpp
ppdir=.
eval x='`'$ppenv '$'cc -E $ppopt flags.$src'`'
case $x in
?*) tstinclude=$x/usr/include
;;
esac
cp /bin/echo cpp
chmod u+w cpp
;;
esac
eval set x $probe_include
while :
do shift
case $# in
0) break ;;
esac
echo "#include <$1>" > include.$src
$cc -E include.$src
done > include.out
ccinclude=
x=$stdinclude
stdinclude=
subinclude=
for f in $x $tstinclude `sed -e 's,\\\\,/,g' -e 's,///*,/,g' -e 's,"[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz]:/,"/,g' -e '/^#[line ]*[0123456789][0123456789]*[ ][ ]*"[\\/]/!d' -e 's/^#[line ]*[0123456789][0123456789]*[ ][ ]*"\(.*\)[\\/].*".*/\1/' include.out | sort -u`
do case $f in
-*) ;;
*/) f=`echo $f | sed -e 's,//*\$,,'` ;;
*/.) f=`echo $f | sed -e 's,//*.\$,,'` ;;
esac
case $f in
-I*) ;;
*/cc) ccinclude=1
;;
*/sys) continue
;;
*/include/*/*)
;;
*/include/*)
subinclude="$subinclude $f"
continue
;;
esac
if test -d "$f"
then case " $stdinclude " in
*\ $f\ *) ;;
*) stdinclude="$stdinclude $f" ;;
esac
fi
done
rm include.out
case $ccinclude in
?*) eval set x $probe_include
while :
do shift
case $# in
0) break ;;
esac
echo "#include <cc/$1>" > include.$src
if $cc -E include.$src > /dev/null
then break
fi
done
case $# in
0) ;;
*) x=$stdinclude
stdinclude=
for f in $x
do case $f in
*/cc) ;;
*) stdinclude="$stdinclude $f" ;;
esac
done
;;
esac
;;
esac
case $subinclude in
?*) for i in $subinclude
do for j in $stdinclude
do case $i in
$j/*/*) ;;
$j/*) both=
eval set x $probe_include
while :
do shift
case $# in
0) for k in $both
do echo "#include <$k>" > include.$src
$cc -E include.$src > include.out
I=`grep -c $i/$k < include.out`
J=`grep -c $j/$k < include.out`
case $I:$J in
0:*) ;;
*:0) stdinclude="$i $stdinclude"
break
;;
esac
done
continue 3
;;
esac
if test -f $i/$1
then if test ! -f $j/$1
then break 2
fi
both="$both $1"
fi
done
;;
$j) continue 2
;;
esac
done
stdinclude="$i $stdinclude"
done
;;
esac
{
for i in $stdinclude
do
case $i in
$usrinclude) ;;
*) echo $i $i ;;
esac
done
eval set x $probe_include
while :
do shift
case $# in
0) break ;;
esac
echo "#include <$1>" > t.c
p=
for j in `$cc -E t.c | grep "$1" | sed -e 's,\\\\,/,g' -e 's,"[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz]:/,"/,g' -e '/^#[line ]*1[ ][ ]*"[\\/]/!d' -e 's/^#[line ]*1[ ][ ]*"\(.*\)[\\/].*".*/\1/'`
do j=`echo $j | sed -e 's,///*,/,g' -e 's,/$,,'`
case $p in
?*) echo $p $j ;;
esac
p=$j
done
done
case $usrinclude in
?*) echo $usrinclude $usrinclude ;;
esac
} | tsort > tmp.tmp
tstinclude=`cat tmp.tmp`
bad=
for i in $stdinclude
do case "
$tstinclude
" in
*"
$i
"*) ;;
*) bad=1
break
;;
esac
done
;;
esac
case $bad in
"") x=$stdinclude
stdinclude=
z=
for i in $tstinclude
do case " $x " in
*" $i "*)
stdinclude="$stdinclude $i"
z=$i
;;
esac
done
case $usrinclude in
'') usrinclude=$z ;;
esac
;;
esac
case $hosted in
"") case $usrinclude in
/usr/include) usrinclude= ;;
esac
;;
esac
case $usrinclude in
?*) case " $stdinclude " in
*\ $usrinclude\ *)
x=$stdinclude
stdinclude=
for f in $x
do case $f in
$usrinclude) ;;
*) stdinclude="$stdinclude $f" ;;
esac
done
;;
esac
;;
esac
# drop dups -- they creep in somehow
x=$stdinclude
stdinclude=
for f in $x
do case " $stdinclude $usrinclude " in
*" $f "*) ;;
*) stdinclude="$stdinclude $f" ;;
esac
done

260
src/cmd/INIT/CONVERT.mk Normal file
View file

@ -0,0 +1,260 @@
/*
* {automake|configure} => {nmake|iffe} conversion support
*
* The first command line target overrides the default original source
* directory name $(MAKEFILE:D). The hard work is in the makefile using
* these assertions, since it must (manually) provide the nmake makefiles
* and config equivalent iffe scripts. The conversion makefile is typically
* named lib/package/PACKAGE.cvt in an ast package $PACKAGEROOT directory,
* and the conversion is run from the $PACKAGEROOT directory, e.g.:
*
* nmake -I lib/package -f PACKAGE-VERSION/PACKAGE.cvt
*
* The conversion requires the ast nmake, pax and tw commands.
*
* After the conversion you will be liberated from ./configure, *.in,
* *.am, automake, autom4te, libtool, make depend, and makefile
* recursion ordering. You can build from $PACKAGEROOT using the ast
* package(1) (which sets up the { HOSTTYPE PATH VPATH } environment):
*
* package make
*
* or cd into any arch/$HOSTTYPE/src subdirectory and rebuild that portion
* of the hierarchy with the ast nmake(1) (after setting PATH and VPATH):
*
* nmake
*
* The conversion assertions are:
*
* package :CONVERT: file ...
*
* files in the original source directory are copied
* and converted into the ./src and ./lib subdirectories
* the default original source directory is ./original
*
* package package name
* file original source file that must exist
*
* :OMIT: pattern
*
* files matching pattern are not copied into the converted
* directory
*
* pattern ksh pattern of files to omit
*
* :COPY: from to [ file ... ]
*
* files in the from directory are copied to the to directory
* the action may contain :MOVE: exceptions to the copy
*
* from original directory subdirectory
* . names the original directory
* .. names the
* to converted subdirectory
* libNAME => src/lib/libNAME
* NAME => src/cmd/NAME
* file files or files in subdirectories to be copied;
* explicit files are copied to the to directory;
* if no files are specified then the from hierarchy
* is recursively copied to the converted directory
*
* :MOVE: to file ...
*
* :COPY: assertion exceptions placed in the assertion's action
*
* to files or subdirectory files are copied to this directory
* file file or files in subdirectories to be copied
*
* :FILE: to file <<!
* contents
* !
*
* the :FILE: action is copied to the named file in the to directory
* the :FILE: action is usually specified using the here syntax to
* avoid make comment, quote and variable expansion
*
* :EDIT: to file ... | - pattern <<!
* edit script
* !
*
* the :EDIT: action is an ed(1) script applied to each file in the
* to directory after it has been copied from the original source
* directory; if to is - then the :EDIT: action is a sed(1) script
* that is applied to all files matching the file pattern during the
* copy from the original source directory; a file may be subject to
* both a sed(1) and ed(1) :EDIT:; the :EDIT: action is usually
* specified using the here syntax to avoid make comment, quote and
* variable expansion
*/
.CONVERT.ID. = "@(#)$Id: CONVERT (AT&T Research) 2004-03-19 $"
set nojobs noscan nowriteobject writestate=$$(MAKEFILE).ms
package = $(PWD:B)
here = !-=-=-=-=-!
hierarchy = src src/cmd src/lib
omit = .*|*.?(l)[ao]
original = $(MAKEFILE:D)
showedit = $(-debug:?p??)
CPFLAGS = -u
PAXFLAGS = -u -v
STDEDFLAGS = -
TW = tw
TWFLAGS = -CP
all : .VIRTUAL file
file : .VIRTUAL edit
edit : .VIRTUAL copy
copy : .VIRTUAL init
init : .VIRTUAL
.MAKEINIT : .cvt.init
.cvt.init : .MAKE .VIRTUAL .FORCE
local D
if D = "$(~.ARGS:O=1)"
if "$(D:T>FD)"
original := $(D)
.ARGS : .CLEAR $(~.ARGS:O>1)
end
end
.cvt.filter =
.cvt.package =
.cvt.atom : .FUNCTION
local N V
V := $(%:O=1)
let .cvt.$(V) = .cvt.$(V) + 1
return .cvt.$(V).$(.cvt.$(V))
.cvt.omit : .FUNCTION
return -s',^\(\(?K)?(*/)($(omit))?(/*))$,,$(showedit)'
.cvt.to : .FUNCTION
if "$(%)" == "."
return src
end
if "$(%)" == "*/*"
return src/$(%)
end
if "$(%)" == "lib*"
return src/lib/$(%)
end
return src/cmd/$(%)
":CONVERT:" : .MAKE .OPERATOR
local I
package := $(<)
I := $(hierarchy:C,$,/Makefile)
init : .cvt.verify $(I)
$(I) : .ACCEPT
test -d $(<:D) || $(MKDIR) -p $(<:D)
echo :MAKE: > $(<)
.cvt.verify : .MAKE .FORCE .REPEAT
local I
if I = "$(.cvt.package:T!=F)"
error 3 $(original): not a $(package) source directory: missing $(I)
end
.cvt.package := $(>:C,^,$$(original)/,)
":COPY:" : .MAKE .OPERATOR
local F T I A
F := $(>:O=1)
T := $(.cvt.to $(>:O=2))
A := $(.cvt.atom copy)
copy : $(A)
$(A) : .VIRTUAL
if F == "."
$(A) : $(T)
$(T) :
test -d $(<) || $(MKDIR) -p $(<)
for I $(>:O>2)
eval
$$(A) : $(I:D=$(T):B:S)
$(I:D=$(T):B:S) : $$(original)/$(I)
$$(CP) $$(CPFLAGS) $$(*) $$(<)
end
end
elif "$(F:T=FF)" || "$(F:N=*.(pax|t[bg]z))"
eval
$$(A) : $$(F)
test -d $(T) || $$(MKDIR) -p $(T)
cd $(T)
$$(PAX) $$(PAXFLAGS) -rf $$(*:P=A) -s ',^$(>:O=2)/*,,' $(.cvt.omit) $(.cvt.filter)
end
else
F := $$(original)/$(F)
if ! "$(@:V)"
eval
$$(A) : .FORCE
test -d $(T) || $$(MKDIR) -p $(T)
cd $(F:V)
$$(TW) $$(TWFLAGS) | $$(PAX) $$(PAXFLAGS) -rw $(.cvt.omit) $(.cvt.filter) $(T:P=A)
end
else
.cvt.move =
: $(@:V:@R)
eval
$$(A) : .FORCE
test -d $(T) || $$(MKDIR) -p $(T)
cd $(F:V)
$$(TW) $$(TWFLAGS) | $$(PAX) $$(PAXFLAGS) -rw $(.cvt.omit) $(.cvt.move) $(.cvt.filter) $(T:P=A)
end
end
end
":EDIT:" : .MAKE .OPERATOR
local A D F
D := $(>:O=1)
if D == "-"
A := ^$(>:O=2)^$$(SED) -e $(@:Q:/'\n'/ -e /G)
.cvt.filter += --action=$(A:@Q)
else
D := $(.cvt.to $(D))
F := $(>:O>1:C,^,$(D)/,)
edit : $(F)
eval
$$(F) :
$$(STDED) $$(STDEDFLAGS) $$(<) <<'$(here)'
$(@:V)
w
q
$(here)
end
end
":FILE:" : .MAKE .OPERATOR
local ( D F ) $(>)
local A
A := $(.cvt.atom file)
$(A) := $(@:V)
D := $(.cvt.to $(D))
file : $(D)/$(F)
eval
$$(D)/$$(F) :
test -d $$(<:D) || $$(MKDIR) -p $$(<:D)
cat > $$(<) <<'$(here)'
$$($(A):V)
$(here)
end
":MOVE:" : .MAKE .OPERATOR
local T I
T := ../../../$(.cvt.to $(>:O=1))
for I $(>:O>1)
if I == "*/"
.cvt.move += -s',^\(\(?K)$(I)),$(T)/,$(showedit)'
.cvt.move += -s',^\(\(?K)$(I:C%/$%%))$,,$(showedit)'
else
.cvt.move += -s',^\(\(?K)$(I))$,$(T)/$(I:B:S),$(showedit)'
end
end
":OMIT:" : .MAKE .OPERATOR
local P
for P $(>)
omit := $(omit)|$(P)
end

45
src/cmd/INIT/MAPLIB.mk Normal file
View file

@ -0,0 +1,45 @@
/*
* normalize local -l* library conventions
*
* L [ [ G11 ... G1n ] ... [ Gg1 ... Ggn ] ] :MAPLIB: T1.c ... Tn.c
*
* if Giji not specified then G11 == L
* the first Ti.c that compiles/links with group -lGi1 ... -lGin
* but does not compile/link with no libraries maps
* -lL to require -lGi1 ... -lGin
* otherwise -lL is not required and maps to "no library required"
*/
":MAPLIB:" : .MAKE .OPERATOR
local L P
L := $(<:B:O=1)
if ! ( P = "$(<:B:O>1)" )
P := $(L)
end
$(LIBDIR)/lib/$(L) :INSTALL: $(L).req
eval
$(L).req : (CC) $$(>)
set -
r='-'
for i in $$(*)
do if $$(CC) -c $i > /dev/null
then g=
for p in $(P) -
do case $p in
-) if $$(CC) -o $$(<:B:S=.exe) $i $g > /dev/null 2>&1
then $$(CC) -o $$(<:B:S=.exe) $i > /dev/null 2>&1 || {
r="$g"
break 2
}
fi
g=
;;
*) g="$g -l$p"
;;
esac
done
fi
done 2>/dev/null
echo " $r" > $$(<)
rm -f $$(<:B:S=.exe) $$(*:B:S=$$(CC.SUFFIX.OBJECT))
end

2
src/cmd/INIT/MSGFUN.mk Normal file
View file

@ -0,0 +1,2 @@
/* stub for pre-2000-05-01 nmake */
":MSGFUN:" : .MAKE .OPERATOR

2
src/cmd/INIT/MSGKEY.mk Normal file
View file

@ -0,0 +1,2 @@
/* stub for pre-2000-05-01 nmake */
":MSGKEY:" : .MAKE .OPERATOR

1393
src/cmd/INIT/Mamfile Normal file

File diff suppressed because it is too large Load diff

13
src/cmd/INIT/PROBE.mk Normal file
View file

@ -0,0 +1,13 @@
/*
* @(#)probe (AT&T Bell Laboratories) 11/11/91
*
* <lang> <tool> :PROBE: *.probe *.sh *
*
* common probe script installation
* generates probe.sh and probe in .
*/
":PROBE:" : .MAKE .OPERATOR
probe.sh : $(LIBDIR)/probe/$(<:O=1)/probe $(>:N=*.(probe|sh))
cat $(*) > $(<)
$(LIBDIR)/probe/$(<:O=1)/$(<:O=2) :INSTALLDIR: probe $(>:N!=*.(probe|sh))

934
src/cmd/INIT/RELEASE Normal file
View file

@ -0,0 +1,934 @@
12-07-17 iffe.sh: add C code NOTE("...") to amend --verbose output
12-06-26 iffe.sh: fix "npt foo" to handle function-like macro foo()
12-06-20 package.sh: use $KSH for rt in "results test"
12-06-15 Makefile: add PLUGIN_LIB to $INSTALLROOT/bin/.paths and BUILTIN_LIB => PLUGIN_LIB
12-06-15 package.sh: add PLUGIN_LIB to $INSTALLROOT/bin/.paths and BUILTIN_LIB => PLUGIN_LIB
12-06-13 package.sh: handle admin.db column output
12-06-08 iffe.sh: fix 12-06-06 typo
12-06-06 iffe.sh: check for -l* in reverse and accumulative order (e.g., for -last & -lm)
12-06-04 package.sh: always check $INSTALLROOT/lib/package/profile
12-05-31 Makefile: ID=ast; $(INSTALLROOT)/prototyped.h => $(INSTALLROOT)/$(ID)/prototyped.h
12-05-28 iffe.sh: api foo YYYYMMDD => FOOAPI(rel) test macro
12-05-24 package.sh: change admin.db comment => owner attributes
12-04-25 ratz.c: add sear -k option to keep installation tmp dir on exit
12-04-17 package.sh: skip sh version logic for ``use''
12-04-17 cc.ibm.risc*: _LARGEFILE64_SOURCE => _LARGE_FILE_API moved to libast/features
12-04-09 cc.ibm.risc*: speak aixese for _LARGEFILE64_SOURCE
12-02-29 cc.darwin.i386*: handle default cc vs kernel bittedness
12-02-29 C+probe: add __TIMESTAMP__ to the nopredefined list
12-02-29 package.sh: don't assume grep -q or /usr/local/lib in LD_LIBRARY_PATH
12-02-29 package.sh: fix ksh vs -lcmd compatibility checks
12-02-23 iffe.sh: checkcc() before checkread() for sensible diagnostics
12-02-14 package.mk: { --clobber --compare --link=lib*.a* } for --mam=static
12-02-14 package.mk: export LICENSEFILEDEFAULT instead of LICENSEFILE
12-02-14 package.sh: handle @(cc|ld).${HOSTTYPE}* intercepts
12-02-07 package.sh: add { clean clobber } actions
12-02-02 regress.sh: fix ulimit -c defaults for --nokeep
12-01-18 regress.sh: add INPUT|OUTPUT|ERROR -e 'filter' to filter before comparison
12-01-21 package.sh: fix `admin make' bug that created unused $INSTALLROOT/lib
12-01-21 Makefile: :PACKAGE: license=ast -- oops
12-01-20 cc.darwin,cc.mvs.390: tmp=/tmp/cc.${USER:-$LOGNAME}.$$.err
12-01-12 package.sh: add admin make share closure to handle alternate HOSTTYPEs
11-12-13 iffe.sh: add /*<NOSTDIO>*/ test code comment to disable default #include <stdio.h>
11-11-11 C+probe: test for .so before .sl
11-10-26 package.sh: don't forget about *.pkg for admin update
11-10-18 cc.*-icc: update and add more
11-10-11 package.sh: handle package make|view when no source installed
11-09-11 package.sh: count admin '*** termination code' errors
11-08-31 mamake.c: add -e, ignore use recursive prereq timestamps
11-08-29 iffe.sh: add ``set stdio try1.h - try2.h ...''
11-08-29 iffe.sh: trap EXIT => trap 0 for ancient sh
11-08-11 iffe.sh: handle ancient sort that doesn't have -k
11-06-01 make.probe: add more /lib64 logic
11-05-01 package.sh: fix admin ditto to sync LICENSES too
11-03-25 package.sh: initialize { $SED $TR } before first use!
11-03-21 package.sh: fix vpath probes
11-03-17 iffe.sh: fix cleanup to rm $tmp* instead of $tmp*.*
11-02-24 package.sh: change curl usage to "curl -L ..."
11-02-11 package.sh,C+probe,make.probe,mamprobe.sh: add ###.*archaic.*###
11-02-02 Makefile: add :MAPLIB: check for ancient -lw
11-02-02 make.probe: handle -print-multi-directory => 64 => /usr/lib64 /lib64
11-02-02 package.sh: HOSTTYPE=*,*cc*[,-*,...] sets CC [ and CCFLAGS ]
11-02-02 make.probe: handle gcc $ORIGIN link but exec failure -- gee thanks
11-01-25 cc.hp.ia64: bundled cc is a pile of shaving cream
11-01-07 iffe.sh: check debug==3 for is_hdr() failure
10-11-22 ditto.sh: fix timing problem between |& and exec &p
10-11-10 package.sh: fix cc cross compile check to use checkcc absolute path
10-10-10 package.sh: list main env vars at start of make action
10-10-10 ratz.c: tweak windows delays
10-09-10 ratz.c: add _SEAR_ARGS for _SEAR_EXEC
10-09-01 package.sh: fix ratz from source logic
10-08-25 package.mk: consolidate license file search in .package.licenses.
10-08-22 ratz.c: run sear bootstrap command detached
10-08-20 C+probe: version_stamp only if version_flags works
10-08-17 package.sh: unset makerules *DIR variables in env
10-08-15 package.sh: "make" action now lists some env values
10-08-11 mktest.sh: add "DO command ..."
10-07-27 rt.sh: handle "rt X=Y ..."
10-06-29 ratz.c: non-option sear args passed to sear_exec()
10-06-25 iffe.sh: "api" op changed to not do "map-libc" type mappings
10-06-25 package.sh: "force admin ditto" => no ditto --update option
10-06-22 C+probe: handle cc that require .[ci] input for version info
10-06-21 ditto.sh: change default remote access to ssh (about time)
10-06-12 regress.sh: DIAGNOSTICS [ 1 | 0 | pattern ] and fix EXIT for all
10-06-09 package.sh: add AT&T to usable nmake check
10-06-06 iffe.sh,iffe.tst: add { api ver } ops
10-04-22 package.sh: update "html binary|source" NAME/PASSWORD info
10-04-15 iffe.sh: don't forget candidate headers for hdr|sys!
10-04-11 WWW.mk: disable man page metarule -- now done by admin-man(1)
10-02-14 package.sh: $CC verification needs $INSTALLROOT/bin in PATH
10-02-11 package.sh: fix package admin make report error count
10-02-02 package.sh: fix write binary bug that did scp on local fs
10-02-02 package.mk: up to date binary targets must still be in PACKAGE.*.lst
10-01-01 package.sh: fix premature $INSTALLROOT/bin during cross compile check
10-01-01 make.probe: handle ['"] in CC.VERSION.STRING
09-12-04 iffe.sh: add "opt name" to check for name in $PACKAGE_OPTIONS
09-11-30 mktest.sh: change RESET to STATE.RESET to make it global
09-11-14 make.probe: use gcc { -print-multi-directory -print-search-dirs }
09-11-11 package.sh: re-order and combine cc checks
09-10-27 C+probe,make.probe,probe.win32: add CC.SUFFIX.DEBUG
09-10-21 iffe.sh,Makefile: test -e is not in ksh88!
09-10-06 iffe.sh: handle cc -E #error with 0 exit status (sgi)
09-10-06 package.sh: stub in ar intercept checks -- not used yet
09-10-06 ar.ibm.risc: add ar intercept because some aix require -Xfoo first!!
09-09-24 regress.sh: fix UMASK logic to create test support files before umask
09-08-28 release.c: change docs to mention stdin if no file operands
09-08-24 package.sh: fix isascii() bug that failed on od(1) trailing space
09-08-20 make.probe: add CC.SHARED.NAME
09-08-20 regress.sh: add { JOB CONTINUE EXITED KILL FIFO }
09-08-11 package.sh: filter lines containing : for package results
09-07-31 make.probe: add CC.AR.ARFLAGS (for aix ar -xany)
09-07-31 package.sh,cc.*: fix -dumpmachine to handle 32/64/* bit options
09-06-24 package.sh: fix admin.db output formatting
09-05-05 package.sh: export dll hackery environment vars
09-05-05 package.sh: handle non-identifier hostnames
09-05-05 mamake.c: pass undefined ${...} identifiers to the shell
09-05-05 mamake.rt: add macro expansion regression tests
09-05-01 iffe.sh: fix output initialization *again*
09-04-28 package.sh: handle admin.db contact field $9
09-04-15 iffe.sh: add implicit "ini" op to initialize io for subsequent ops
09-03-31 regress.sh: EXPORT before test => global ENVIRON[]
09-03-26 package.sh: test fail pattern is 'fail[es]'
09-03-26 UNIT - ... appends (options) to command line
09-03-19 TEST.mk: x.tst => x only if x is command target
09-03-15 regress.sh: add ${MAIN} for base name of main unit
09-03-10 TEST.mk: add .SOURCE:tests if tests is a dir
09-03-03 regress.sh: allow command line unit to override UNIT
09-03-03 mktest.sh: handle IO == $'\n'
09-02-02 package.sh: delay $INSTALLROOT/bin/.paths generation until mamprobe runs
09-01-30 cc.mvs.390: c89 balks at [ ()] in -Dname="..."!
09-01-27 package.sh: add isascii() to use ratz instead of tar
09-01-20 hurl.sh: add --size=bytes option
09-01-08 TEST.mk: add test.* prereqs, multiple arg lists with :T=*: binding
09-01-03 regress.sh: fix UNIT to allow command line override
09-01-03 mktest.sh: handle TWD
08-12-24 package.sh: fix cross-compile HOSTTYPE logic
08-12-15 package.sh,hurl.sh: handle http codes { 301 302 303 }
08-10-16 make.probe '-fno-stack-protector -fno-stack-protector-all' to cop out!!
08-09-30 rt.sh: fix ksh93 regression test signal count
08-09-26 regress.sh: ignore SIGPIPE for SET pipe-input
08-09-24 package.sh: package only test foo => make --recurse=only recurse tests foo
08-09-20 make.probe: handle another /usr/bin/file shared lib description
08-09-20 regress.sh: add --pipefail for SET pipe-input ...
08-09-17 Makefile: add gdbm1.c for <gdbm-ndbm.h>
08-09-10 make.probe: add CC.NOPROTECT
08-08-08 mktest.sh: add --width=width
08-08-05 dbm.req: favor sleepycat ndbm compatibility
08-08-04 C+probe: fix stdlib initialization logic
08-06-24 package.sh: fix $INSTALLROOT/bin/cc intercept time stamp file typo
08-06-20 TEST.mk: make the localyunit before *.rt => *.tst -- doh
08-06-20 mktest.sh: prepend $PWD onto PATH for local units -- doh^2
08-06-11 regress.sh: fix bug that skipped the last test
08-05-20 regress.sh: add --local to put *.tmp dir in local fs
08-05-05 regress.sh: add IF command ... ELIF command ... ELSE ... FI
08-05-01 package.sh: package test => ulimit -c 0
08-04-28 regress.sh: fix EXPORT quoting
08-04-28 regress.sh: fix UNIT set check args too
08-04-24 rt.sh: exit code > 256 => signal termination
08-04-10 C+probe: change probe_so order to check .so last (macos ld workaround)
08-04-01 package.sh: handle multiple admin HOSTTYPEs per HOST
08-03-28 C+probe: add C++ #include <iostream> (no extension) dir probes
08-03-17 regress.sh: fix trap on EXIT, add terminated note to final tally
08-02-28 make.probe: fix probe_warn to include ld!
08-02-02 make.probe: add CC.RUNPATH to match default -L order
08-01-31 package.sh: check lib64 for LD_LIBRARY_PATH
08-01-31 iffe.sh: tweak ancient /bin/sh workarounds
08-01-28 make.probe: darwin ld export dynamic is -force_flat_namespace
08-01-28 C+probe: handle sgi cc error message but exit 0 botch(es)
08-01-23 package.sh: fix checksum doc typo
08-01-09 C+probe: add __FUNCTION__ to the undef (don't check) list
07-12-14 iffe.sh: add set nooptimize
07-12-03 package.sh: add LC_ALL=C
07-11-27 package.sh: fix overaggressive *.md5 cleanup
07-11-20 iffe.sh: treat exit status >= 250 as normal error with no signal
07-11-05 package.sh: fix write op error count pattern
07-11-05 package.mk: fix $(~req) .ver binding
07-08-11 probe.win32: add cl.exe setuid workaround, CC.VERSION[.STRING]
07-08-01 package.sh: handle 'package read lcl|tgz'
07-05-08 regress.sh: execute basename instead of absolute path for short $0
07-04-27 cc.sgi.mips[34]: for #error to exit non-zero -- a no brainer
07-04-20 mktest.sh: defer to systems without 'grep -q' -- sigh
07-04-11 mamprobe.sh: handle $(CC.*) => ${mam_cc_*}, $(...) => ${...}
07-04-11 make.probe: fix CC.PICBIG probe, default { CC.PIC CC.DLL } to BIG
07-04-04 iffe.sh: prepend ${tst}${ext} to each .c probe
07-03-28 package.sh: fix binary tgz architecture type duplication
07-03-28 package.mk: add binary write PACKAGE.$HOSTTYPE.lst
07-03-28 iffe.sh: add -F header to mac test
07-03-23 make.probe: handle file(1) that returns 'archive' for .so
07-03-22 mamprobe.sh: fix STDED probe for implementations that ignore EOF
07-03-11 package.sh: add nocopyright and tst => nocopyright
07-03-11 package.mk: add copyright=0
07-03-08 C+probe: restore IFS after probe.ini
07-02-26 mamake.c: expand first of ${mam_lib*} for ${AR}
07-01-05 package.sh: fix "admin write binary" logic
07-01-01 iffe.sh: add "cmd" --verbose trace
07-01-01 iffe.sh: sort => LC_ALL=C sort
07-01-01 C+probe: LC_ALL=C
06-12-22 make.probe: lean on gcc -v for stdlib, but preserve /usr/local!
06-11-23 package.sh: *.md5 are not tarballs -- doh
06-11-23 iffe.sh: add -F, --features=feature-test-header
06-11-11 make.probe: favor lib64 over lib for hosttype==*64
06-10-31 make.probe: add "-ignore-source-dir -iquote" test
06-10-31 iffe.sh: add status{...} code block
06-10-11 regress.sh: fix DO to handle {...} (time for regress.tst?)
06-10-11 package.sh: handle already gunzip'd *.tgz
06-10-06 iffe.sh: add reference for header content tests
06-09-27 regress.sh: fix UMASK to do DO too (duh)
06-09-22 iffe.sh: drop -O for npt tests (for msvc intrinsics)
06-09-14 cc.darwin: drop -O until gcc 4.* gets its act together
06-09-11 package.sh: { cc ld ldd } intercepts check ${HOSTTYPE%.*} too
06-09-08 regress.sh: add PIPE INPUT|OUTPUT for pipe io
06-09-05 C+probe: add { probe_version version_stamp version_string }
06-09-05 make.probe: add version stamp comment, CC.VERSION[.STRING]
06-08-27 regress.sh,mktest.sh: add UMASK
06-08-25 regress.sh: add -b,--ignore-space,IGNORESPACE
06-08-25 mktest.sh: add IGNORESPACE
06-08-24 mktest.sh: handle \000 in data
06-08-24 regress.sh: handle -f* for INPUT|OUTPUT|ERROR
06-08-16 package.sh: fix 'install flat' logic
06-08-11 rt.sh: handle style=shell %K date format
06-07-17 ratz.c: fix __MVS__ FAR definition
06-07-17 iffe.sh: "header x.h" -- deprecate "include x.h" for .SCAN.iffe
06-07-17 package.sh: differentiate urls vs. assignments
06-06-27 rt.sh: add --failed, --heading
06-06-27 C+probe,TEST.mk,make.probe,mktest.sh,regress.sh: 'ulimit -c 0'
06-06-26 cc.darwin.ppc: handle -lcc_dynamic disappearance
06-06-25 mktest.sh: implement PROG
06-06-11 Makefile: add -ldbm :MAPLIB:, provide public MAPLIB.mk
06-05-06 package.sh: add PACKAGE_admin_tail_timeout
06-05-22 ratz.c: upgrade to zlib-1.2.3
06-05-09 package.sh: fix admin.db docs
06-03-11 package.sh: fix `package use - command ...'
06-03-05 make.probe: work around pedantic bash 3.1 mismatched " in `.`
06-02-14 package.sh: "results failed test" == "results test failed"
cc.sgi.*: add _AST_cc_OPTIONS parameterization, -OPT:Olimit=0
cc.linux.ia64-icc: add for intel cc
06-02-02 package.sh: freebsd stuck with os version for all arch
06-02-01 package.mk: fix locale logic (tw -d requires dir arg)
06-01-31 package.sh: require $CC only for make|test
06-01-30 package.sh,hurl.sh: use the backwards-compatible --http-passwd
package.sh: add more pdksh => /bin/sh checks
06-01-26 package.sh: wget --http-pass => --http-password
package.sh: fix wget error logic
hurl.sh: wget --http-pass => --http-password
06-01-11 package.mk: pass package.license.class to make --mam too
package.mk: variants=pattern => --variants=pattern
package.sh: darwin rel<=7 => darwin7.ppc
package.sh: freebsd rel<=4 => freebsd4
package.sh: freebsd rel<=5 => freebsd5
05-12-07 iffe.sh: don't emit <stdio.h> if <sfio.h>|<ast.h> (XXX)
05-12-05 make.probe: disable readonly.exe core dump via ulimit -c 0
05-09-22 mktest.sh: add EXEC [ ++NOOUTPUT ++NOERROR ++NOEXIT ]
05-09-21 mktest.sh: fix --style=shell compare to ignore \r
05-09-12 TEST.mk: all --force to force %.rt regeneration
05-09-05 TEST.mk: regenerate from %.rt only if newer, :SAVE: %.tst
05-08-25 mktest.sh: add
TEST.mk: add %.rt=>%.tst for mktest
05-08-18 package.sh: 'package host cpu' now checks $NPROC first
05-07-17 iffe.sh: add { define extern include print } ops
iffe.sh: accept output{...}end output on success only -- doh
05-07-01 package.sh: add TARPROBE for tar B flag probe
05-06-24 package.sh: fix binary read chmod via *.sum
05-06-06 package.sh: fix KEEP_HOSTTYPE logic to handle synthesized types
05-06-01 make.probe: verify that cc_pic works for hosted cc
cc.lynxos.ppc: make -mshared the default
package.sh: note $INSTALLROOT/bin/@(cc|ld|ldd) installation
05-05-25 make.probe: add CC.INCLUDE.LOCAL instead of -I- in CC.DIALECT
05-05-24 iffe.sh: really fix grouping logic -- with tests this time
package.sh: pipe/socket configuration mismatches => use /bin/sh
05-04-28 TEST.mk: add $(TESTS)
05-04-19 package.sh: package results test uses rt if possible
iffe.sh: fix 'op var - ... - ...' grouping logic
05-04-15 rt.sh: handle autom4ate style
05-04-11 regress.sh: fix unit name when command line unit also specified
rt.sh: handle all ast package test output formats
package.sh: fix make docs for options passed to underlying make
05-04-08 package.sh: cp -p makerules.mo to $OK to preserve mtime
regress.sh: add "TITLE name" to change TEST output title
05-04-01 rt.sh: add pretty make test + regress.sh wrapper
05-03-29 package.sh: test -e path => test -f path -o -d path
05-03-24 make.probe: fix CC.PICBIG probe to prefer -fPIC over -fpic -- doh
05-03-19 mamake.c: command line name=var also defines name.FORCE=var
05-03-11 regress.sh: unset LC_ALL when LC_* EXPORT'd
package.sh: old make.out saved in circular make.out.[1-9]
mamake.c: sync with nmake :W=O:
05-03-01 package.sh: fix flat hierarchy initialization
package.sh: admin action now properly resets sibling remote logs
package.mk: relax unknown/unwritten package messages to warnings
package.sh: handle space in command line name=value
make.probe: add mvs -Wc,dll,exportall,longname,rent to CC.DLL probe
05-02-24 package.sh: hosttype *.powerpc => *.ppc
cc.lynxos.ppc,ldd.lynxos.ppc: add
05-02-22 mamake.c: fix { -G --debug-symbols -S --strip-symbols } MAMAKEFLAGS bug
05-02-20 probe.win32: handle /platformsdk mount
05-02-19 package.sh,package.mk: add write tst for tgz in tst subdir
05-02-18 package.sh: accept cc -dumpmachine with 0 or 1 -
05-02-14 package.sh: handle multiple architectures per host in admin.db
Makefile,package.sh: honor $INSTALLROOT/bin/.paths overrides
package.sh: normalize trailing [-_]bits in host type
iffe.sh: some ksh-compatible shells don't do *(pattern)
05-02-11 iffe.sh: back out 05-01-11 child process stdin hijack
cc.lynxos.i386: -dynamic instead of -static default
05-02-10 package.sh: cyg usr/doc => usr/share/doc
05-02-08 package.sh: drop -m with pax -- delta bug fixed 2005-02-08
iffe.sh: work around old bash 0<... redirection bug
05-02-06 package.mk: source.tgz: update generated files only when they change
05-02-02 *.sh,*probe: IFS may be unset and { ash bsh } don't on startup -- wow
05-01-11 package.sh: update setup docs to include authorize+password
package.mk: fix .source.cyg final directory edit
package.mk: notice=1 for conspicuous empty NOTICE file
WWW.mk: fix *-index.html installation
filter.sh: retain input file suffix in tmp copy
mamexec.c: fix non-contiguous "exec" bug that skipped lines
iffe.sh: fix candidate lib test to try grouping subsequent libs
iffe.sh: fix child process stdin hijack that skipped input lines
iffe.sh: --shell=osh to force read -r compatibility command
iffe.sh: chop iffe input leading space before # for KnR compatibility
05-01-05 package.sh: add ${TAR} ${TARFLAGS} and tar B flag for pipes
mamake.c: fix makefile scan to ignore lib*.[hH]
iffe.sh: immunize function/symbol tests from aggressive -O
04-12-28 WWW.mk: add :WWWPAGE: faq.*.mm index generator
04-12-21 ratz.c: make sure tmp dir is writable -- doh
04-12-08 iffe.sh: fix dat test for aggressive -O
04-12-01 iffe.sh: add `include file' to pull in #define's for `exp'
04-11-11 package.sh: default MAKESKIP is "*[-.]*"
04-10-22 ratz.c: change docs to note zlib license
mamake.c: handle --debug-symbols and --strip-symbols
package.sh: make (debug|strip)=1 => --(debug|strip)-symbols
package.mk: add :LICENSE: => package.license.class
mamake.c: fix recursive order logic
04-10-18 package.mk: add :LICENSE:, :OMIT: to omit package subdirs
04-10-11 package.sh: add 'authorize name' and 'password password'
04-10-01 iffe.sh: double check $static link with ! $static
Makefile: add BUILTIN_LIB to $INSTALLROOT/bin/.paths
make.probe: add CC.DIALECT EXPORT={ALL,REF,EXT,DLL}
package.sh: add BUILTIN_LIB to $INSTALLROOT/bin/.paths
04-09-21 package.mk: $(init)$(name) is now an implicit prereq
04-09-09 package.sh: copy makerules.mo to $INSTALLROOT/bin/ok
04-09-01 package.mk,package.sh: rename *.txt => *.README
package.mk: add the runtime package type (no *.[ah])
iffe.sh: fix key test reports
04-08-26 Makefile: { add m2.c m3.c } -lm tests for { frexp[l] ldexp[l] }
04-08-11 package.mk: handle HOSTTYPE for solaris > 9
package.sh: add `checkaout proto' for { make view }
package.sh: check for { md5sum md5 }
iffe.sh: add {if|elif|else|endif} test ...
iffe.sh: add 'exp - expression' and '( expression )'
iffe.sh: add 'name = test ...' user defined macros
iffe.sh: add '! test ...' negation
TEST.mk: add implied { .c .sh } generated prereq
cc.darwin.ppc: handle 10.3 -dylib mess
04-08-01 package.mk: let include handle nested requirements -- duh
04-07-31 package.sh: attempt a second ping before admin assumes host down
04-07-26 package.sh: fix hp.ia64 HOSTTYPE
04-07-23 probe.win32: generalize #include dir order search
04-07-17 regress.sh: add INPUT -x for chmod +x
04-07-01 regress.sh: TMP => TWD
04-06-29 regress.sh: put COMMAND in $TWD too
04-06-21 regress.sh: mkdir -p INPUT and OUTPUT intermediate dirs
TEST.mk: add :TEST: -- to disable .c .sh search
04-06-18 TEST.mk: add .SCAN.tst
04-06-17 regress.sh: TEST returns true if active, false otherwise
regress.sh: add CD to change test pwd from $TWD
04-06-16 regress.sh: add TWD for ./unit.tmp override
regress.sh: DO now flushes previous test
regress.sh: INPUT and OUTPUT handle -f for printf instead of print
04-06-11 package.sh: make sure $INSTALLROOT/bin is in front of $PATH
package.sh: skip nmake if older than 2000-10-31
04-05-20 package.sh: fix arg vs. package parse with - or '' to disambuguate
04-05-11 package.sh: package verbose update lists closure for package setup
package.sh: add src/lib/libardir to nmake proto bootstrap
regress.sh: probe for rm -u vs. chmod -R u+rwx
04-05-01 package.sh: $CC must be C, not C++; allow release command on $PATH
04-04-15 make.probe: check probe_libdir false positives
package.sh: add lib/package/*.lic src package subdirs
package.mk: add mamfile=0 to inhibit Mamfile generation
iffe.sh: config name_DECLARED => HAVE_name_DECL
iffe.sh: fix mac to handle default value
04-04-11 iffe.sh: normalize sed [\\\\/] quoting
04-04-04 package.mk: only checksum generated tarballs
mamprobe.sh: add STDCHMOD
04-04-01 C+probe: set export LANG=C for uniform error messages
make.probe: another CC.STDLIB tweak
package.sh: fix regress core dump pattern, expand [a-z] match ranges
04-03-31 Makefile: add intl :MAPLIB: test
make.probe: fix CC.STDLIB search; drop CC.* path duplicates
04-03-28 iffe.sh: drop unused exec $stdin<&0 dup
04-03-25 Makefile: add iconv :MAPLIB:
package.sh: use ${PING:-ping -c 1 -w 4}, allowing admin.db override
04-03-24 package.mk: add *.md5 checksum for each *.(c|exe|tgz)
package.sh: update base change on md5 sum instead of size
iffe.sh: adjust case label \ and keyword quoting for ancient /bin/sh
04-03-22 probe.win32: ncc => nld
04-03-19 CONVERT.mk: change the instructions and old source dir default
package.mk: fix recurse=list check
package.mk: add *.md5 checksum for each *.(c|exe|tgz)
package.sh: fix update base/delta/sync existence check
04-03-18 iffe.sh: -d2 does not remove core dumps on exit
04-03-17 package.sh: fix make recurse arg/action order
04-02-29 package.sh: add regress action to compare current and previous tests
package.sh: fix sgi.mips[23] HOSTTYPE test for old irix cc
package.sh: add `export variable ...'
package.sh: admin action now handles host name with non-id chars
package.sh: non-numeric M T W in admin.db disables that action
package.sh: fix admin write binary local vs. shared clash
cc.hp.pa: add _AST_CC_hp_pa_DEFAULT=+DAportable
cc.hp.pa64: sync with cc.hp.pa
cc.ibm.risc: -bnolibpath => -blibpath:/usr/lib:/lib
probe.win32: sync with make.probe
make.probe: fix last chance dynamic test
make.probe: add hp.pa CC.EXPORT.DYNAMIC -Wl,-E
make.probe: add ibm.risc CC.EXPORT.DYNAMIC -bexpall
make.probe: move probe_dll_def to the end of probe_dll
package.mk: capture subcomponent mamfile recursion
04-02-24 make.probe: strip "..." from cc/ld traces
iffe.sh: add ``set [no]define'' to disable macro #define/#undef
04-02-23 make.probe: rework CC.LD search
04-02-14 make.probe: add CC.EXPORT.DYNAMIC for main dynamic sym export
make.probe: resurrect CC.PIC with separate semantics from CC.DLL
make.probe: add CC.SHARED.LD for CC.SHARED linker
C+probe: clear DISPLAY to stifle interactive windows
04-02-11 iffe.sh: handle ``siz void*'', add cross{ ... }end
make.probe: add { CC.AR CC.SIZE }, fix cross command search
cc.darwin.ppc: change $cc => $CC for old ksh + libast conf bug
04-02-09 make.probe: drop -nostartfiles from CC.SHARED for C++
04-02-04 package.sh: fix cross compilation bug that mixed binary formats
04-02-02 package.sh: package admin now ditto's bin/package too
04-01-30 cc.sgi.mips3: drop warning 3421
04-01-11 regress.sh: output label#count for tests in loops
04-01-05 regress.sh: fix bug that ignored the first SAME
04-01-04 crossexec.sh: fix typo that did not recognize rcp
03-12-19 mamake.c: add `foolib:foo:libfoo' to recurse()
03-10-11 regress.sh: add EXPORT, export COLUMNS=80 for message consistency
03-09-23 ratz.c: fix tar header number parse bug that skipped to next number
regress.sh: rm cleanup now handles files matching -*
03-09-11 iffe.sh: add unnamed { ... } blocks
regress.sh: add COPY from to, like MOVE but comprison still done
regress.sh: rm -rfu to handle test dirs w/o u+rwx
03-08-14 Makefile: add hello.c to the manifest
03-08-11 package.sh: fix `html binary' generation
03-06-21 package.sh: fix INITROOT initialization bug
package.sh: make sure admin logs exists before tail'ing
03-06-11 probe.win32: fix $(BINDIR) typo that expanded in sh instead of make
cc.mvs.390: return code 4 yields exit code 3 but it's *really* ok
package.sh: fix onpath function global var conflict
make.probe: add CC.DIALECT { GNU -dD }
package.mk: add Mamfile to lcl manifest
03-06-10 package.sh: fix setup action typo that only checked the INIT package
package.sh: *.s390x => *.s390-64
03-06-09 package.mk: add cyg :POSTINSTALL:
03-06-08 make.probe: fix CC.STDLIB logic
hurl.sh: add User-Agent identification
package.sh: tweak source and binary installation instructions
cc.hp.pa,ld.hp.pa: +-Wl,+cdp,${INSTALLROOT}/lib/: drops abs lib paths
ldd.hp.pa: add
03-06-06 package.sh: fix $INSTALLROOT/bin/ldd check
make.probe: add CC.STDLIB verification
03-06-04 make.probe: add +forceread +noforceread
03-05-11 hurl.sh: handle http://host:port/path
03-05-06 package.sh: fix setup action PACKAGEROOT and INIT logic
03-05-05 package.mk: fix cygwin tarball names
03-04-30 package.sh: move (cc|ld|ldd).$HOSTTYPE updates from Makefile
03-04-27 make.probe: fix mvs CC.PREFIX.SHARED "lib" => ""
make.probe: add CC.DLL.DIR = $(BINDIR) or $(LIBDIR)
make.probe: add { CC.LD.LAZY CC.LD.NOLAZY CC.LD.RECORD CC.LD.NORECORD }
probe.win32: sync with latest CC.*
03-04-25 mamprobe.sh: add args to `. $makeprobe' for ancient sh
03-04-23 package.mk: fix dup "covered by" licenses
03-04-22 probe.win32: CC.DIALECT += "LIBPP -I-" for all cc's
package.sh: fix admin write binary tarball snarf
03-04-21 package.mk: package covered *.@(pkg|lic) too
03-04-15 package.mk: don't generate incremental archives for lcl
package.mk: add incremental=[source:1 binary:0] archive control
package.sh: generate $INSTALLROOT/bin/cc wrapper for CC != cc
package.sh: admin must ditto lib/package/*.@(pkg|lic) too
mamake.c: ignore time of ignore prereqs
mamake.c: -D2 lists propagated times
03-04-11 package.mk: tidy up cyg tarballs
package.sh: fix old shell clash between get() and $get
03-04-05 package.mk: restore *.inx generation somehow lost during cyg additions
package.sh: add pthread_num_processors_np() last resort for cpu count
package.sh: use `make believe' to accept mamake generated files
package.sh: handle `make [make-flags] [target ...]'
mamake.c: ignore -e
03-03-21 package.mk: fix cyg old make typo
package.sh: switch to `package setup' instructions
03-03-19 package.sh: add registry checks for `host cpu'
package.sh: `results failed' now lists core dump messages
03-03-17 package.sh: on cygwin verify 'ntsec binmode' in $CYGWIN or die
Makefile: install gcc wrapper if no cc
package.mk: add :DETAILS: { :README: :EXPORT: :INSTALL: :TEST: } ops
03-03-12 package.mk: add :DETAILS: for style-specific details
03-03-11 package.sh: add beta setup/update support
TEST.mk: add (TESTCC) prereq for .sh tests
03-03-07 hurl.sh: add
03-03-06 iffe.sh: fix lib win32 test cygwin vs native incompatibility
iffe.sh: change internal stdio.h guard to handle C++ inline vs. macro
03-03-03 package.sh: check for curl or wget for update
package.sh: add setup action == update read make
package.sh: fix packageroot() typo that showed up in non ~user shells
mamake.c: treat name+=value args like name=value
mamake.c: add ${var?*|value?match?no-match?}
mamake.c: fix archive vs. dynamic bind logic
03-02-28 package.sh: add the "cyg" (cygwin) package type
package.mk: add "cyg" stubs, :CATEGORY: for category name(s)
03-02-25 mamake.c: add -D4 system(3) debug trace
03-02-24 package.mk: change --mismatch to --corrupt=accept
03-02-14 ratz.c: add _WIN32 setmode([01],O_BINARY) and fopen "rb"/"wb"
03-02-12 Makefile: handle getconf LIBPATH with host pattern
03-01-31 package.mk: fix .lic search
03-01-30 package.sh: handle { INIT ksh nmake } already installed elsewhere
package.sh: admin handles command outside of $PACKAGEROOT/bin
Makefile: install $(INSTALLROOT)/lib/make/package.mk
03-01-28 package.sh: admin remote commands on one line to please syslog
03-01-23 probe.win32: borland and mingw32 tweaks
03-01-22 package.sh: fix $CC test to ignore set -x trace -- duh
03-01-16 ditto.sh: tw --chop on by default
03-01-14 package.sh: use /bin/cp to copy previous binaries to bin/ok/
package.sh: admin now initiates remote exec and copy from local host
03-01-12 package.sh: handle admin "xxx:" default root
03-01-03 probe.win32: add /usr/include/borland path truncation workaround
02-12-10 iffe.sh: add <&$nullin >&$nullout to checkread() $cc
02-12-06 probe.win32: fix inlcude => include typo, add lcc lib
probe.win32: CC.MAKE.OPTIONS = nativepp=0
02-12-04 mamake.c: fix ${foo-bar} to expand foo if defined
02-11-28 probe.win32: add C++ and -I- CC.DIALECT checks
02-11-26 package.sh: package release now checks for second level files
02-11-22 package.sh: update action now uses HTTP/1.0
02-11-21 probe.win32: update the vc include dir test
02-11-20 make.probe: fix CC.LD.ORIGIN typo that expanded make var
02-11-13 packahe.mk: fix list.install => list.installed typo
02-11-12 make.probe: add CC.LD.ORIGIN for a.out origin dir relative dll search
make.probe: add CC.LD.STRIP for link time a.out strip
package.sh: fix package_use vs. PACKAGE_USE check
02-10-24 WWW.mk: fix bug that required a :WWWBIN: assertion to post
02-10-23 mamake.c: fix unuinitialized time in make()
ratz.c: fix meter buffer overflow
02-10-20 package.sh: fix lib/probe/C/make/probe update test
02-10-18 probe.win32: update for mingw
make.probe: add bash workaround to SHELLMAGIC test
package.sh: work around yet another cygwin hassle
02-10-17 iffe.sh: short circuit id check for *[-+/\\]*
02-10-08 regress.sh: unset FIGNORE to avoid rm . errors
package.sh: unset FIGNORE to avoid rm . errors
package.sh: $CC must at least compile and executable hello world
02-10-04 package.sh: $INSTALLROOT/lib/package/tgz=>$PACKAGEROOT/lib/package/tgz
package.mk: $(ED) => $(STDED), $(EDFLAGS) => $(STDEDFLAGS)
iffe.sh: add identifier checks for tests that (implicitly) require them
iffe.sh: disambiguate a few --config macros
02-10-02 iffe.sh: fix shell=bsh `hdr a/b'
02-09-30 package.sh: handle chmod of -* files
package.sh: verify that $SHELL is Bourne compatible
package.sh: tighten PACKAGE_USE logic PATH,LIBPATH,etc. validation
iffe.sh: fix bug that didn't define mac variable on success
02-09-22 package.sh: handle admin_action=ditto
iffe.sh: --config sizeof(foo) macro is SIZEOF_foo
iffe.sh: fix long.long test so it doesn't defeat uwin "typ long.long"
mamprobe.sh: convert $("foo") nmake string constants
02-09-21 mamprobe.sh: "-" info-path writes probe info to stdout
02-09-11 make.probe: move from nmake src to be part of mamprobe.sh
mamprobe: generate from mamprobe.beg C.probe make.probe mamprobe.end
mamake.c: pass cc absolute path to mamprobe
package.sh: generate mamprobe -- yuk (at least it's confined to INIT)
iffe.sh: lcl,nxt: drop default sys/ check
ditto.sh: tw --logical by default; add --physical
02-09-10 package.sh: SHELLMAGIC creeps into package too -- duh and fooey
02-09-09 ditto.sh: test that remote .profile exists before sourcing
02-09-06 package.sh: don't ditto nfs junk
ditto.sh: --show now lists directory ops instead of enumerating all
02-09-05 ditto.sh: add --remote={rsh|ssh}
package.sh: add admin [[{rsh|ssh|-}]:]directory
02-09-02 iffe.sh: change 'print -r --' to 'print -r -' for ksh86 compatibility
02-09-01 cc.unix.mc68k: add for ancient 3b1
02-08-22 package.sh: fix component() to test for components -- duh
Makefile: add LICENSE:.DONTCARE to workaround mam
02-08-11 iffe.sh: provide defaults for LD_* additions
02-08-07 ratz.c: change -m to use * instead of non-portable inverse video
02-07-17 mamprobe.sh: close tmp file in trap before rm for cygwin
package.sh: fix "type" to handle i1586 (P4)
package.sh: add the view action
02-06-28 package.sh: handle multiple packages for release action
02-06-27 package.sh: catch sol*.sparc=>sol*.sun4 when CC=gcc
02-06-14 package.sh: fix admin_action to not include qualifiers
package.sh: fix help/html doc typo
02-06-11 package.sh: fix ditto update doc to `PACKAGEROOT field matching *:*'
02-06-07 WWW.mk: change substitute $("\n") to \n
02-06-06 package.sh: clarify output streams for help/html
02-05-22 mamake.c: fix executable file check to use (S_IXUSR|S_IXGRP|S_IXOTH)
02-04-04 package.sh: fix update to differentiate *.sun4 and sun4
02-03-27 package.sh: yacc/bison warning only if both missing
02-03-24 mamake.c: all shell actions wrapped with -c to avoid #! problems
02-03-23 package.sh: recover $PACKAGEROOT/bin/package if not in INIT package
package.sh: precheck $CC, not `cc'
package.sh: fix install to use pax -ps to preserve set-uid/gid
package.sh: fix install to use list.installed for existing files only
02-03-17 package.sh: fix PAX initialization that was sometimes omitted for read
package.sh: fix update delta sync fetch
02-02-14 iffe.sh: fix macro{ }end docs to include "
iffe.sh: add dfn to extract #define from headers
iffe.sh: handle nxt #include ok but no line sync
iffe.sh: drop local header clash logic
iffe.sh: add -X, --exclude=dir to exclude -I dirs
iffe.sh: lcl,nxt now generate <...> headers instead of "..."
package.sh: admin.db root dir matching -* disables host
package.mk: fix package.src.pat typo -- too many )
package.mk: add { :COVERS: :DESCRIPTION: :REQUIRES: }
package.sh: handle { :COVERS: :DESCRIPTION: :REQUIRES: }
Makefile: move proto.c generation to the proto component dir
02-02-02 execrate.sh: add for .exe challenged win32 systems/commands
mamprobe.sh: add STD* commands/flags
mamake.c: update mamprobe info when older than mamprobe executable
package.sh: move ed/ex workaround to mamprobe.sh
package.sh: fix `host type' bug that incorrectly assumed sun4 for sol
package.sh: add execrate(1) hooks for challenged systems
package.sh: add check for { cc ar nm yacc/bison } before make
ratz.c: fix "rb" vs. "r" macro tests
iffe.sh: add nxt, similar to lcl but defines _nxt_foo for #include
iffe.sh,package.sh: remove vaibale from sccs,cvs ident strings -- duh
02-01-24 C+probe: check CC.DYNAMIC to handle cc that accept but ignore -B*
iffe.sh: handle 'mem struct.a.b'
02-01-22 iffe.sh: cache (internal) `foo vs. struct foo' test results
package.sh: uts.370 => uts.390
02-01-18 package.sh: fix uts hosttype
02-01-17 package.sh: add 'results failed ...' to list failures only
package.sh: change ARCH internal var to all_types to avoid env conflict
iffe.sh: fix hdr/lib precheck that missed some -- ouch
iffe.sh: fix noexecute test that forgot to check compile first!
02-01-15 ratz.c: fix path[] type typo
02-01-01 package.mk: tighten license search
02-01-08 package.sh: `pwd` => ${PWD:-`pwd`}
package.mk: expand license file pattern match
02-01-04 iffe.sh: fix `exp name "value"' bug that duped "value"
iffe.sh: fix initial <sys/types.h> check to honor --config
01-12-25 iffe.sh: fix bug where -o file restored old file
01-12-23 package.mk: uniq the closure lists
01-12-07 ratz.c: fix --meter to retain paths containing " -- "
01-11-30 ratz.c: use sear_system() to execute; should work on all windows
01-11-28 ratz.c: fix sear_rm_r() to check SetCurrentDirectory() status
01-11-26 ditto.sh: drop n+=v for ksh compatibility
01-11-21 ditto.sh: add rsync script replacement [hey, it works!]
package.sh: add [ditto]:directory notation to admin.db
01-10-31 package.sh: handle *.sum paths with embedded space
package.sh: change executable() to onpath()
package.sh: executable([!] foo) replaces test [!] -x foo (.exe hack)
package.sh: add os2 fix to `host type'
mamake.c: add .exe hack
iffe.sh: fix intrinsic function lib test
mamprobe.sh: update pic probe to match make.probe for linux.ia64
01-10-30 package.sh: make action skeleton view now checks subdirs
01-10-20 package.sh: don't recurse into leaf dirs matching $MAKESKIP
package.mk: tarball package.notice replaces `license accepted' prompt
package.sh: eliminate `license accepted' prompt
package.sh: add update to download latest from a url
package.sh: use builtin arithmetic when we know it's ksh
iffe.sh: unkown -> unknown
01-10-18 package.sh: convert to YYYY-MM-DD delta releases instead of NNNN
package.mk: convert to YYYY-MM-DD delta releases instead of NNNN
ratz.c: fix -m for paths containing \f\n\r\v
01-10-16 ratz.c: _SEA_* => SEAR_*
ratz.c: preserve stdin for sear_exec()
ratz.c: add recursive sear_rm_r() to sear_exec() tmp dir cleanup
01-10-10 mamprobe.sh: add mam_cc_SHELLMAGIC
package.sh: add nfs wakeup call to admin to avoid stale file handles
01-10-04 cc.darwin.ppc: -flat_namespace is not longer the default (huh)
01-10-01 package make: prepend $INSTALLROOT/bin/ok to PATH
package read: save cpy of bin/package when reading the INIT package
mamprobe.sh: allow cc path with optional arguments
01-09-24 Makefile,package.sh: add $INSTALLROOT/bin/.paths initialization
01-09-19 package.mk: add recurse to list.package.*
package.sh: bootstrap build nmake with _BLD_STATIC for _WIN32
01-09-11 ratz.c: add _SEA_SKIP & _SEA_COMMAND for self extracting archives
01-09-07 package.mk: fix output capture to not generate files names with spaces
01-09-07 package.mk: fix delta release number search
01-08-11 package.mk: handle single gz executable packages (e.g., for ksh)
package.sh: fix package install to require nmake only if no *.sum
iffe.sh: drop ancient menu and prompt actions; check ./hdr.h clash
01-07-17 package: fix use cross compile test to generate files in /tmp
01-06-27 ratz: handle hard and soft links if possible
01-06-07 Makefile: fix :MAPLIB: for sco
01-05-31 crossexec.sh: add
iffe.sh: add -x crosstype to run crossexec
iffe.sh: exp test now handles pass{}end fail{}end yes{}end no{}end
package.sh: add package host canon external-host-type-name
package.sh: fix `use USER' lookup for shells that support ~USER
cc.*: add -dumpmachine to dump target HOSTTYPE
01-05-18 iffe.sh: drop $HOME/tmp/t.sh debug trace -- oops
01-05-01 mamake.c: scan() now handles :PACKAGE: foo:command
01-04-26 *.sh: expand [a-z][A-Z][0-9] for non-contiguous character codes
iffe.sh: fix run *.sh for shells that don't $* across . command
cc.mvs.390: recode for /bin/sh
01-04-25 package.mk: include non cc-g variants by default
package.sh: *[._]* => *?[_.]* for mvs.390 /bin/sh
01-04-24 TEST.mk: no tests for VARIANT=="DLL"
01-04-22 package.mk,package.sh: tarball text members are ascii encoded
01-04-18 package.mk: allow package name to be the same as one of its components
cc.mvs.390: handle .C .cpp .cxx
cc.mvs.390: compensate for -o that does not overwrite
01-04-01 regress: fix SAME that just skipped it -- we should regress regress!
iffe: fix bug that didn't emit _hdr_foo for internal hdr tests
iffe: fix lcl bug for cc -E that doesn't emit line syncs
ratz: add ascii=>ebcdic conversion for text archive members
mamake: fix buffer overlap bug that clobbered the probe file path
01-03-17 iffe: handle : separator as first arg
01-03-15 mamake.c,ratz.c,release.c: add <stdlib.h> and <string.h>
01-02-26 iffe.sh: fix bug that omitted runtime #define for `mac' op
01-02-22 cc.ibm.risc: handle SF_CLOSE clash in <sfio.h>
01-02-14 cc.sgi.mips3,cc.sgi.mips4: handle -mips2 -mips3 -mips4 for cross cc
C+probe: quote "$cc" when it's an argument!
mamake: execute actions with $SHELL, ignored signals back to default
package.sh: nmake check error output to /dev/null
package.sh: fix INIT a.out updates for knr cc
package.sh: package list now handles large tgz dirs
package.sh: *-ok executables moved to ok/* for *.dll systems
iffe.sh: change "exec >&-" to "exec >/dev/null" else linux mkdir fails!
mamake: handle `bind -lx [dontcare]'
01-02-12 ratz.c: fix _PACKAGE_ast includes
package.sh: $HOSTTYPE env overrides if $PACKAGEROOT/arch/$HOSTTYPE/
package.sh: $CC ^HOSTTYPE=[A-Za-z_0-9.]*$ overrides HOSTTYPE
iffe.sh: fix dat code that used previous $tmp.exe
iffe.sh: fix dat code for _DLL imports
01-02-09 iffe.sh: add copy() for shells with the disappearing here doc bug
01-02-08 Makefile: guard against null $(CC.HOSTTYPE)
01-02-06 Makefile: separate out cc,ld,ldd workarounds (so they will be packaged)
01-02-02 package.sh: fix package use for $INSTALLROOT != */$HOSTTYPE
package.sh: create intermediate recursion makefiles when needed
package.sh: add $SECONDS to the DEBUG trace prompt
01-01-01 ratz.c: #ifdef for uwin ncc
iffe.sh,package.sh: check PACKAGE_PATH for local installations
package.sh: add psrinfo for osf.alpha host cpu
package.sh: change pax --meter probe; some hang on /dev/tty
package.sh: fix `install flat ARCH'
mamake: eliminate loops from scan order
C+probe: add probe_verbose -V for aix cc=xlc
cc.ibm.risc,ldd.ibm.risc: add
package.mk: list refs to top-level licenses only
package.mk: add local link table to change log html
00-12-25 package.sh: `no package archives' is a hard error, duh
package.sh: reorder host type logic for lame shells
mamake.c: getcwd => getwd for NeXT -- how about posix==default guys
iffe.sh: really gross workaround for NeXT -lposix stdout null's
iffe.sh: handle cc -E that insists on compiling
00-12-15 iffe.sh: ancient sh function call blows $*; call only when $# == 0
*.sh: `getopts 2>/dev/null` => `(getopts)2>/dev/null` for ancient sh
package.sh: fix LD_LIBRARY*_PATH initialization
cc.next.m68k: add for _POSIX_SOURCE and linker multiply defined syms
00-12-12 ratz: add --meter
package.sh: a few VPATH fixes
Makefile: don't override *.mips* cc if -version not accepted
00-12-11 package.mk: *.inx now contains name=value
00-12-07 package.sh: handle PC netscape . => _ pathname mangle
WWW.mk: .tar.gz => .tgz
00-11-27 package.sh: add checklicense() to do license checks at read time
package.mk: change component list from preformat to table
00-10-31 package.mk: *.pkg must assert closure
package.mk: add cc- variants to list.package.binary
package.sh: omit dups from package list
package.sh: invalid arg gives one line Usage
package.sh: relax checkaout checks for non-owners
package.sh: package use sets NPROC if not already set or [01]
proto.c: add $(INSTALLROOT)/include/ast hack
00-10-26 WWW.mk: add .SOURCE rhs to :WWWPAGE:
00-10-25 package: fix install
package.mk: add list.install
00-10-22 regress: fix VIEW to skip empty dirs
00-10-19 package.mk: $(PACKAGEROOT)/bin/nmake => $(PACKAGEROOT)/bin/manmake
iffe: validate #define identifiers
00-10-18 C+probe: mac os10 additions
package: add DYLD_LIBRARY_PATH initialization
add ldd.$(CC.HOSTTYPE)
00-10-01 iffe: handle -I* -L* options
00-09-21 mamake: add libxxx and xxx to makefile ordered prereqs
00-09-19 C+probe: add probe_longlong
00-09-11 package: drop manmake and $PACKAGEROOT/bin/nmake
00-09-08 iffe: verify that $cc is a C compiler
00-06-14 mamprobe: fix win32.* probe
mamake: fix bug that used lower view path for generation
package: don't clobber $PACKAGEROOT/bin/nmake
00-06-01 C+probe: fix stdinclude *again*
package: fix write delta source to use default pax format
package: add disambiguating bias for sgi.mips3 over sgi.mips4
package.mk: fix for directory content packages lib ast-locale
00-05-01 iffe: fix invalid _LIB_ macro identifier
00-04-11 C+probe: uniq stdinclude and stdlib, fix usrinclude
00-04-01 regress: fix explicit OUTPUT bug that didn't compare with expected
00-03-17 package: all archives are .tgz for binary download
package: $(PACKAGEROOT)/LICENSES/* in source and binary archives
package: implement install and verify actions
iffe: add exp, pth file dir ..., fix lib - -lfoo, fix lib - - -la -lb
iffe: -L* must affect LD_LIBRARY* hacks for .exe tests -- yuk
package.mk: add *.pkg :INDEX:
00-03-07 package: add admin action
00-03-06 makefile: install optional make probe override script C+make+probe.lcl
00-02-14 --- release 1.0 ---
ratz: treat "foo/" as a dir, not a regular file
package: clarify source and binary installation instructions
package: fix so binary packages can install without cc
package: "ratz" now a non-archive package (the only one) for bootstrap
package: handle VPATH=a:b arg
package.mk: "ratz" package adjustments
Makefile: use :PACKAGE_INIT: to support binary INIT packages
WWW.mk: add :WWWALL:
C.probe: fix .so check that let .dll slip through
iffe: fix config sh var assignment for HAVE_member_IN_struct
iffe: fix config sh var assignment for symbol_DECLARED
package: delay PATH export until dll hack exports complete
package: don't forget binary package $(INSTALLROOT)/lib(32|64)
package: add delta change log for source packages
00-02-10 mamprobe: add mam_cc_DLLBIG
package: fix spelling typos
package: add html help output
package.mk: beef up source and binary help => html
00-02-08 package: mkdir man/man[138] in the new arch to cover MAM bug
00-01-28 package,release: add -rcount to release
package: fix linux "host cpu" and "host rating"
package: copy *.lic to $PACKAGEBIN for "make" and "write binary"
package: fix 'release change log' case match
00-01-24 package: add copyright action
mamprobe: add -D_BLD_DLL to mam_cc_DLL
00-01-11 package: tsort for package write
package: early verification that $CC works
package: add non-interactive command arg for use action
proto: fix -C intermediate mkdir()
mamprobe: unixware.i386 ksh workaround
C.probe: move hosttype to C.probe (with unixware.i386 workaround)
WWW.mk: fix mm2html option quoting
WWW.mk: add .SCAN.mm
WWW.mk: don't force static=1; grab dll's instead
*.sh: fix getopts test to handle botched implementations like osf.alpha
iffe.sh: fix read -r test
99-12-25 iffe: tweak verbose messages
iffe: hand code non-optget getopts parse
iffe: fix bash quoting bug again
iffe: do test -w . after option parse
package: fix PACKAGEROOT search
99-11-19 --- release 0.2 ---
99-11-19 first working package & friends
99-10-31 change from lib0ast to INIT; add MAM and package bootstrap
hostinfo: gobbled by package
99-10-01 iffe: add --config, yes{...}end no{...}end, fix read -r workaround
99-09-27 iffe: add --all --verbose, --* set options
99-09-22 regress: -v disables long line truncation
99-09-11 WWW.mk: WWWDIR and MM2HTMLINFO are now lists searched in $(HOME)
99-08-11 hostinfo: fix type sgi.mips4
99-06-24 WWW.mk: add
99-06-08 hostinfo.sh: ${TMPDIR:-/tmp}
99-06-07 TEST.mk: add
99-06-01 iffe: add `siz type' for _siz_type == sizeof(type)
99-05-11 hostinfo,iffe,regress,use: long options
99-05-01 C.probe: fix over aggressive stdinclude, e.g., /usr/include/machine
99-04-01 hostinfo: sgi.mips? -o32 and -n32 checks
iffe: check that . is writable
99-03-17 hostinfo: fix for cc not found
dl.c,hello.c,m.c: headers in conditionals to force .DONTCARE
C.probe: extra check for include dirs pulled in by <sys/types.h>
99-03-03 regress: add `UNIT - ...' for extra args
Makefile: add (_hosttype_) prereq for cc
99-01-23 hostinfo: tweak rating, use /proc/cpuinfo if there
99-01-11 C.probe: shlib before lib, /usr before /
98-12-25 iffe: work around win32.alpha intrinsic clash with -O
98-11-11 regress: fix UNIT PATH lookup
98-11-01 regress: add PROG
98-10-01 hostinfo: add unixware.*
use: export PACKAGE_*
98-08-11 C.probe: add /usr/include check (for sco CC)
hostinfo: handle uwin uname update
98-05-01 regress: fix bug sometimes didn't list last test
98-04-01 hostinfo: add cc path arg
hostinfo: now works with /bin/sh
Makefile: strengthed -lm probe
98-01-23 Makefile: check for -ldl -lm
C.probe: handle gcc -v -E phony include dirs
iffe: fix lcl by dropping sort -u -- we need the real first
iffe: `mem x' to test if x is a non-opaque struct
98-01-11 $(INSTALLROOT)/lib32 for sgi.mips3
$(INSTALLROOT)/lib64 for sgi.mips4
add cc.hp.pa
98-01-01 cc.sgi.mips*: turn off ld library multiply defined
97-10-11 regress: add VIEW function for locating data
97-10-01 Makefile: -ldl test moved to libdll Makefile
97-08-11 regress: add MOVE
regress: add SAME
regress: use getopts
regress: `EXEC' repeats previous test
97-07-17 use: tweak PATH and LIBPATH bootstrap order
iffe: fix lcl bug that botched pathnames with embedded spaces
97-06-12 iffe: add npt `needs prototype' test
97-05-09 hostinfo: mvs.* => mvs.390
Makefile: cc.$(_hosttype_) workaround installed here
iffe: fix nolink{ ... }end
iffe: add [no]static{ ... }end for static link test
C.probe: _probe_PATH => _probe_export which must be eval'd
97-04-01 use: _RLD_ROOT set too
97-03-17 mm2html: changed inner loop
mm2html: handle .if|.ie|.el, .so
mm2html: handle different man styles
mm2html: differentiate mm/man in some non-obvious cases
hostinfo: r5000 is not mips4
97-02-14 hostinfo: validate type with cc
96-12-25 C.probe: uwin tweaks
iffe: use `...` instead of $(...) for alpha /bin/sh
iffe: fix `typ' divide by 0
iffe: `lcl' now drops X: prefix
iffe: +l* -> -l*
iffe: eval around ${...#%...} for bsd /bin/sh
use: add sgi.mips LD_LIBRARY<abi>_PATH variants
use: add -e to list exports
iffe: lcl leaves leading [a-zA-Z]: for dos
iffe: fix no{link|output|execute} logic
C.probe: don't automatically add /usr/include for non-hosted compilers
C.probe: don't automatically place /usr/include last
C.probe: check gcc style -v -E for stdinclude usrinclude
96-11-28 iffe: check BASH_VERSION for IFS botch
iffe: typ long.xxx only if sizeof(long xxx) != sizeof(xxx)
hostinfo: fix sgi.mips[234] tests
hostinfo: fix ncr.i386 tests
96-10-31 iffe: work around old bsh here doc bug by running separate sh
96-10-11 iffe: *.iffe and *.iff for iffe src files
hostinfo: tighten sgi.mips cpu type check
96-10-01 C.probe: add probe_libdir to catch alpha /usr/shlib
96-09-17 iffe: fix typ bug that failed for single id types!
96-08-31 hostinfo: handle recent sgi hinv cpu changes
96-07-17 make sure sizeof(long xxx)>sizeof(xxx) for typ long.xxx
96-05-09 C.probe: drop multiple / in stdinclude
96-02-29 use: package root must have bin and lib subdir
mm2html: add
C.probe: probe_members += -whole-archive for gcc
iffe: add + fix the blasted `...'...\\...'...`
96-01-31 use: add pkg dir
hostinfo: add tandem
96-01-01 hostinfo: windows_nt|windows[0-9][0-9] -> win32
95-11-24 hostinfo: linux-aout.* for non-elf linux
95-11-11 use: add aix LIBPATH
95-10-11 hostinfo: no args prints type
95-08-11 use: add
95-05-09 save original PATH in _probe_PATH
beef up library dir probe
95-04-01 use c source suffix if it still preserves the dialect
add hostinfo
add lib/hostinfo/typemap user type map
add sol.sun4 cpu count
fix C.probe to properly handle C/C++ combined compiler drivers
add NeXT to hostinfo
bummer: mach has /usr/bin/hostinfo
95-03-19 fix dialect executable test
95-03-19 --- release 0.0 ---

197
src/cmd/INIT/TEST.mk Normal file
View file

@ -0,0 +1,197 @@
/*
* regression test support
*
* @(#)TEST.mk (AT&T Research) 2010-05-19
*
* test management is still in the design phase
*/
/*
* three forms for :TEST:
*
* :TEST: xxx yyy ...
*
* $(REGRESS) $(REGRESSFLAGS) xxx.tst
* $(REGRESS) $(REGRESSFLAGS) yyy.tst
*
* :TEST: xxx.tst yyy ...
*
* $(REGRESS) $(REGRESSFLAGS) xxx.tst yyy ...
*
* :TEST: xxx.c [ :: test-prereq ... :: ] [ args [ : args ... ] ]
*
* :TEST: xxx.sh [ :: test-prereq ... :: ] [ args [ : args ... ] ]
*
* xxx :TEST: prereq ...
* [ action ]
*
* $(*) if no action
*/
":TEST:" : .MAKE .OPERATOR
local B G P S T
test : .INSERT .TESTINIT
if "$("tests":T=FD)"
.SOURCE : tests
end
P := $(>:O=1)
if "$(P:N=*.tst)" && ! "$(@:V)"
B := $(P:B)
if ! ( T = "$(<:V)" )
T := $(B)
end
test : - test.$(T)
eval
test.$$(T) : $$(B).tst
$$(REGRESS) $$(REGRESSFLAGS) $$(*) $(>:V:O>1)
:SAVE: $$(B).tst
end
elif "$(P:N=*@(.sh|$(.SUFFIX.c:/ /|/G)|$(.SUFFIX.C:/ /|/G)))"
B := $(P:B)
if ! ( T = "$(<:V)" )
T := $(B)
end
:INSTALLDIR: $(B)
$(B) :: $(P) $(*:-l*|*$(CC.SUFFIX.ARCHIVE))
if "$(P:N=*.sh)"
TESTCC == $(CC)
$(B) : (TESTCC)
end
test : - test.$(T)
if "$(@:V)"
eval
test.$$(T) : $$(B) $(>:V:O>1)
set +x; (ulimit -c 0) >/dev/null 2>&1 && ulimit -c 0; set -x
$(@:V)
end
elif "$(>:V:O>1)"
local I A V X S R=0
for A $(>:V:O>1)
if A == "::"
let R = !R
elif A == ":"
let I = I + 1
test.$(T).$(I) := $(V:V)
V =
X := $(X:V)$(S)$$(*) $$(test.$(T).$(I):T=*)
S = $("\n")
elif A != "-l*|*$(CC.SUFFIX.ARCHIVE)"
if R
test.$(A) : .VIRTUAL .FORCE
test.$(T) : test.$(A)
else
V += $(A:V)
end
end
end
if V
let I = I + 1
test.$(T).$(I) := $(V:V)
X := $(X:V)$(S)$$(*) $$(test.$(T).$(I):T=*)
end
eval
test.$$(T) : $$(B)
set +x; (ulimit -c 0) >/dev/null 2>&1 && ulimit -c 0; set -x
$(X:V)
end
else
eval
test.$$(T) : $$(B)
set +x; (ulimit -c 0) >/dev/null 2>&1 && ulimit -c 0; set -x
$$(*)
end
end
elif ! "$(<:V)"
G = 1
for B $(>)
if B == "-|--"
let G = !G
else
if ! G
T =
elif ! ( T = "$(B:A=.COMMAND)" ) && ! "$(B:A=.TARGET)"
for S .c .sh
if "$(B:B:S=$(S):T=F)"
:INSTALLDIR: $(B)
$(B) :: $(B:B:S=$(S))
T := $(B)
break
end
end
end
test : - test.$(B)
test.$(B) : $(T) - $(B).tst
$(REGRESS) $(REGRESSFLAGS) $(*:N=*.tst) $(*:N!=*.tst)
:SAVE: $(B).tst
end
end
else
if "$(>:V)" || "$(@:V)"
P := $(>)
T := $(P:O=1)
B := $(T:B)
if "$(T)" != "$(B)" && "$(T:G=$(B))"
:INSTALLDIR: $(B)
$(B) :: $(T) $(P:O>1:N=-*)
T := $(B)
P := $(B) $(P:O>1:N!=-*)
end
if "$(<:V)"
T := $(<:V)
end
test : - test.$(T)
if "$(@:V)"
eval
test.$$(T) : $$(P) $(>:V:O>1)
set +x; (ulimit -c 0) >/dev/null 2>&1 && ulimit -c 0; set -x
$(@:V)
end
else
test.$(T) : $(P)
set +x; (ulimit -c 0) >/dev/null 2>&1 && ulimit -c 0; set -x
$(*)
end
else
test : - test.$(<)
test.$(<) : $(<).tst $(<:A=.COMMAND)
$(REGRESS) $(REGRESSFLAGS) $(*)
end
end
.TESTINIT : .MAKE .VIRTUAL .FORCE .REPEAT
if VARIANT == "DLL"
error 1 :DLL: tests skipped
exit 0
end
set keepgoing
REGRESSFLAGS &= $(TESTS:@/ /|/G:/.*/--test=&/:@Q)
.SCAN.tst : .SCAN
$(@.SCAN.sh)
I| INCLUDE@ % |
.ATTRIBUTE.%.tst : .SCAN.tst
MKTEST = mktest
MKTESTFLAGS = --style=regress
/*
* test scripts are only regenerated from *.rt when --force
* is specified or the .rt file is newer than the script
* otherwise the script is accepted if it exists
*
* this avoids the case where a fresh build with no state
* would regenerate the test script and capture current
* behavior instead of expected behavior
*/
%.tst : %.rt
if [[ "$(-force)" || "$(>)" -nt "$(^|<)" ]]
then $(MKTEST) $(MKTESTFLAGS) $(>) > $(<)
fi
test%.sh test%.out : %.rt
if [[ "$(-force)" || "$(>)" -nt "$(^|<:O=1)" ]]
then $(MKTEST) --style=shell $(>) > $(<:N=*.sh)
$(SHELL) $(<:N=*.sh) --accept > $(<:N=*.out)
fi

450
src/cmd/INIT/WWW.mk Normal file
View file

@ -0,0 +1,450 @@
/*
* post stuff to WWWDIR for web access
* index generated from *.mm
*/
WWWDIR = wwwfiles public_html
WWWSAVE =
WWWSTYLE =
WWWTYPES =
.WWW.semaphore : .SEMAPHORE
.EXPORT : WWWSTYLE WWWTYPES
/*
* item :WWW: [style=frame] [save=pattern] file ...
*
* `item'.mm generates index.html
* other files copied to $(WWWDIR)/`item'
* sets up www.bin
*/
":WWW:" : .MAKE .OPERATOR
local A B D I J L X E P R M
.WWW.LOCAL .WWW.REMOTE : .DO.NOTHING
WWWDIR := $(HOME:X=$(WWWDIR):T=F:O=1)
B := $(*:N=*.mm::O=1:B)
D := $(WWWDIR)/$(B)
M := $(WWWDIR)/man/man1
R := $(>:N!=*=*)
for I $(>:N=*=*)
A := WWW$(I:/=.*//:F=%(upper)s)
$(A) := $(I:/.*=//)
end
(html_info) : $$(MM2HTMLINFO) $$(MM2HTMLINIT)
if WWWSTYLE == "frame"
%.html %-index.html : %.mm (html_info)
$(MM2HTML) $(MM2HTMLFLAGS) $(%:N=faq.*:?> $(<:O=1)?-f $(%) -x?) -o WWWTYPES=$(WWWTYPES:@Q:@Q) $(WWWSOURCE.$(%)) $(>)
else
%.html : %.mm (html_info)
$(MM2HTML) $(MM2HTMLFLAGS) -o WWWTYPES=$(WWWTYPES:@Q:@Q) $(>) $(WWWSOURCE.$(%)) > $(<)
end
%.html : %.1 (html_info)
$(MM2HTML) $(MM2HTMLFLAGS) $(>) $(WWWSOURCE.$(%)) > $(<)
%-man.html : $(BINDIR)/% (html_info)
ignore $(>) --html 2> $(<)
.DO.WWW.MAN : .USE
if { test '' = '$(*)' || { strings $(*) | egrep -q '\[\+NAME\?|libcmd\.|cmd[0-9][0-9]\.' ;} ;} && [[ "$( $(<:B) '--???html' -- 2>&1 )" == version=[1-9]* ]]
then ( $(<:B) '--??html' -- 2>$(<) ) || true
fi
if 0
$(M)/%.html : .DONTCARE $(INSTALLROOT)/bin/%
$(@.DO.WWW.MAN)
end
if "$(<)"
D := $(<)
elif ! "$(R)"
return
end
.WWW .WWW.BIN : $(D) $(M) -
$(D) $(M) :
$(SILENT) test -d $(<) || mkdir $(<)
if ( J = "$(R:N=*.mm)" )
for I $(J:G=%.html)
if I == "*-index.html"
O := $(D)/index.html
else
O := $(I:D=$(D):B:S)
end
.WWW : $(O)
$(O) :COPY: $(I)
end
end
.WWW.req : .FUNCTION
return $(*$(%:T=SR):N=-l*:T=F:P=B:N!=-l*|/*)
A = 0
for I $(R:N!=*.mm)
if I == "-"
let A = ! A
elif I == "-l*"
L := $(I:/-l//)
if J = "$(.DLL.NAME. $(L) $($(L).VERSION):T=F)"
X += $(J)
end
elif A || "$(I:A=.COMMAND|.ARCHIVE)" || "$(I:D:D:N=$(INSTALLROOT))" || "$(I:N=*-www)"
X += $(I)
if "$(I:A=.COMMAND)"
X += $$(.WWW.req $(I))
J := $(I:/-www$//)
eval
.WWW : $(J:D=$(M):B:S=.html)
$(J:D=$(M):B:S=.html) : $(I) $(I:B:S=.1:T=F:?$(I:B:S=.1)??)
if strings $$(*:O=1) | egrep -q '\[\+NAME\?|libcmd\.|cmd[0-9][0-9]\.'
then $$(IGNORE) $$(*:O=1) '--??html' -- 2>&1
elif test '' != '$$(*:N=*.1)'
then $$(MM2HTML) $$(*:N=*.1)
fi > $$(<)
end
end
else
if I == "*.html"
$(I) : .TERMINAL
end
.WWW : $(D)/$(I)
$(D)/$(I) :COPY: $(I)
end
end
if "$(X:V)"
.WWW.EDIT. : .FUNCTION
local E I J
for I $(.INSTALL.LIST.:C,^$(INSTALLROOT)/,,:N!=lib/lib/*)
for J $(%)
if "$(I:B:S)" == "$(J:B:S)"
E += -s ',^$(J)$,$(I),'
end
end
end
return $(E)
.WWW.LIST. : .FUNCTION
local E I J
for I $(.INSTALL.LIST.:C,^$(INSTALLROOT)/,,:N!=lib/lib/*)
for J $(%)
if "$(I:B:S)" == "$(J:B:S)"
E += $(I)
end
end
end
return $(E)
.WWW .WWW.BIN : $(D)/$(B)-$(CC.HOSTTYPE).tgz
$(D)/$(B)-$(CC.HOSTTYPE).tgz : $(X:V)
cat > X.$(tmp).X <<!
This archive contains $(CC.HOSTTYPE) binaries for
$(.WWW.LIST. $(*))
Add the bin directory to PATH and the lib directory
to LD_LIBRARY_PATH or its equivalent for your system.
Use the --?help and --man options for online help,
documentation and contact info.
!
$(PAX) -wvf $(<) -x tar:gzip -s "/X.$(tmp).X/README/" $(.WWW.EDIT. $(*)) -s ',\(.*\)-www$,bin/\1,' -s ',.*/lib/,lib/,' X.$(tmp).X $(*:N!=-l*)
$(RM) -f X.$(tmp).X
end
/*
* item ... :WWWBIN: index.mm file ... host:arch ...
*
* home page control
* `host' of type `arch' for www.bin files
*/
":WWWBIN:" : .MAKE .OPERATOR
local HOST ITEM ARCH BINS DIRS G
.WWW.NOMAN. += $(<)
for HOST $(>)
TYPE := $(HOST:/.*://)
HOST := $(HOST:/:.*//)
WWWTYPES += $(TYPE)
ARCH := $(PWD:D:C,/$(CC.HOSTTYPE)/,/$(TYPE)/)
BINS :=
DIRS :=
for ITEM $(<)
if TYPE == "$(CC.HOSTTYPE)"
G := $("index.mm":G=%.html:D=$(WWWDIR)/$(ITEM):B:S)
.WWW.LOCAL : $(G)
eval
$(G) : .JOINT $(ARCH)/$(ITEM)/$(ITEM).mm (html_info) .WWW.semaphore .FORCE
cd $$(*:D)
$$(MAKE) $$(-) $$(=) www
end
else
BINS += $(WWWDIR)/$(ITEM)/$(ITEM)-$(TYPE).tgz
DIRS += $(ARCH)/$(ITEM)
end
end
.WWW.REMOTE : $(BINS)
ARCH := $(ARCH:C,/src/.*,,)
eval
$(BINS) :JOINT: .FORCE .WWW.semaphore
rsh $(HOST) "
eval \"\`bin/package debug use\`\"
PATH=\$PATH:$(PATH):/usr/ccs/bin
umask 022
for dir in $(DIRS)
do cd \$dir
$(MAKE) $(-) $(=) --errorid=\$dir www.bin
done
"
end
end
/*
* :WWWPOST: [ host [ dir [ tmp ] ] ]
*
* post local $(WWWDIR) to host:dir putting archives in host:tmp/www-*.pax
* defaults: host=www dir=$(WWWDIR) tmp=tmp
*/
":WWWPOST:" : .MAKE .OPERATOR
local ( host dir tmp ignore ... ) $(>) www $(WWWDIR:B:S) tmp ignore
:ALL: delta.pax
.WWW.ALL : .WWW.REMOTE - .WWW.LOCAL
eval
.POST : .VIRTUAL base.pax delta.pax
case "$$(>)" in
'') ;;
*) $$(>:C,.*,rcp & $(host):$(tmp)/$(dir)-&;,)
rsh $(host) '
umask 022
PATH=$HOME/bin:$PATH
cd $(dir)
pax -rvf $HOME/$(tmp)/$(dir)-delta.pax -z $HOME/$(tmp)/$(dir)-base.pax
'
;;
esac
end
base.pax :
cd $(WWWDIR)
pax -wvf $(<:P=A) .
.base.list. : .FUNCTION
local X
X := $(sh pax -f $(%:N=*.pax):C,\n, ,G:C,^,$$(WWWDIR)/,)
$(X) : .DONTCARE
return $(X)
delta.pax : .WWW.ALL base.pax $$(.base.list. $$(*))
cd $(WWWDIR)
pax -wvf $(<:P=A) -z $(*:N=*.pax:P=A) .
.WWW.FAQ : .USE
{
set -o noglob
print .xx title=\"$(<:B:/\..*//) FAQ index\"
print .MT 4
print .TL
print
print .H 1 \"$(<:B:/\..*//) FAQ index\"
print .BL
for i in $(*)
do exec < $i || exit 1
e=0 l=0 x=y
while read -r op a1 a2
do case $op in
.H) case $e in
0) e=1 ;;
1) print .LE ;;
esac
print .sp
print .LI
a2=${a2//\"/}
a2=${a2%\ [Ff][Aa][Qq]}
f=${i%.*}.html
f=${f#*/}
print .xx link=\"$f' '$a2\"
print .sp
print .NL
;;
.AL|.BL|.NL)
case $x in
y) x=x ;;
*) x=xx$x ;;
esac
;;
.LE) x=${x%xx}
;;
.LI) case $x in
x) x=
print .LI
;;
esac
;;
.sp) case $x in
'') x=x ;;
esac
;;
*) case $x in
'') print -r -- $op $a1 $a2 ;;
esac
;;
esac
done
case $e in
1) print .LE ;;
esac
done
print .LE
} > $(<)
/*
* [ dir ] :WWWPAGE: [ source ... ] file.mm file
*
* *.mm generates *.html
* faq.*.mm generates faq.mm
* other files copied to $(WWWDIR)[/dir]
* files after - (toggle) are just asserted on ::
*/
":WWWPAGE:" : .MAKE .OPERATOR
local B D I J O P Q S X G A
A = 0
D := $(<:O=1)
P := $(>:N!=*=*)
S := $(>:N=*=*)
if X = "$(P:B:S:N=faq.*.mm)"
Q := $(D:+$(D).)faq.mm
$(Q) : .WWW.FAQ $(X)
P += $(Q)
end
if D
B := $(D:B)
if D != "/*"
D := $(WWWDIR)/$(D)
$(D) :INSTALLDIR:
.WWW.LOCAL : $(D)
end
for I $(<:B)
.WWW.LOCAL : $(WWWDIR)/man/man1/$(I).html
$(WWWDIR)/man/man1/$(I).html : .DONTCARE
end
for I $(P)
if I == "-"
let A = !A
continue
end
if A || I == "$(WWWSAVE)"
:: $(I)
continue
end
if "$(I:T=FD)"
.SOURCE : $(I)
if "$(<)"
WWWSOURCE.$(<:O=1) += $(I:T=F:P=L=*)
end
continue
end
if I == "*.html"
$(I) : .TERMINAL
O := $(I)
X := $(I)
elif ( G = "$(I:G=%.html)" )
$(G) : .IMPLICIT $(S) $(I)
if $(G:O) > 1
for J $(G)
if J == "*-index.html"
if J == "faq.*.*"
continue
end
O := index.html
else
O := $(J)
end
.WWW.LOCAL : $(D)/$(O)
$(D)/$(O) :INSTALL: $(J)
end
continue
end
if X
X := $(I)
else
X := index
end
I := $(I:B:S=.html)
O := $(X:B:S=.html)
else
O := $(I)
end
$(D)/$(O) :INSTALL: $(I)
.WWW.LOCAL : $(D)/$(O)
end
else
for I $(P)
if I == "-"
let A = !A
continue
end
if A || I == "$(WWWSAVE)"
:: $(I)
continue
end
if "$(I:T=FD)"
.SOURCE : $(I)
continue
end
if I == "*.html"
$(I) : .TERMINAL
O := $(I)
elif ( O = "$(I:G=%.html)" )
$(O) : $(S) .IMPLICIT $(I)
end
for J $(O)
if J == "*-index.html"
X := index.html
else
X := $(J)
end
X := $(WWWDIR)/$(X)
.WWW.LOCAL : $(X)
$(X) :COPY: $(J)
end
end
end
/*
* rhs done by default
*/
":WWWALL:" : .MAKE .OPERATOR
.WWW.ALL : $(>)
":WWWMAN:" : .MAKE .OPERATOR
.INIT : .WWW.MAN
.WWW.MAN. := $(>)
.WWW.MAN : .MAKE .FORCE
local H I
for I $(.WWW.MAN.)
.WWW.LOCAL : $(WWWDIR)/man/man1/$(I:B).html
$(WWWDIR)/man/man1/$(I:B).html : .DO.WWW.MAN $(I)
end
for I $(sh builtin:B)
.WWW.LOCAL : $(WWWDIR)/man/man1/$(I).html
$(WWWDIR)/man/man1/$(I).html : .DO.WWW.MAN -
end
for I $("$(BINDIR)/*([!-.])":P=G:B)
if I != "*_*"
H := $(WWWDIR)/man/man1/$(I).html
if ! "$(*$(H))" && I != "$(.WWW.NOMAN.:/ /|/G)"
.WWW.LOCAL : $(H)
end
elif "$(PATH:/:/ /G:X=$(I:/.*_//):T=F:O=1)"
H := $(WWWDIR)/man/man1/$(I:/.*_//).html
.WWW.LOCAL : $(H)
$(H) : .DO.WWW.MAN $(BINDIR)/$(I)
end
end
.WWW.SED. : .FUNCTION
local E T
E = s/^\(\.xx.link=.*\)%HOSTTYPE%\(.*\)%HOSTTYPE%\(.*\)/
for T $(%)
E := $(E:V)\$$("\n").LI\$$("\n")\1$(T)\2$(T)\3
end
return $(E:V)/
/*
* mm scan support
*/
.SCAN.mm : .SCAN
O|S|
I|.sn %|A.DONTCARE|M$$(%)|
I|.so %|A.DONTCARE|M$$(%)|
.ATTRIBUTE.%.mm : .SCAN.mm

View file

@ -0,0 +1,6 @@
: linux.i386-64 ar wrapper
case $1 in
*x*) /usr/bin/ar "$@" ;;
*) /usr/bin/ar U"$@" ;;
esac

9
src/cmd/INIT/ar.ibm.risc Executable file
View file

@ -0,0 +1,9 @@
: stupid stupid stupid to require a non-standard option for ar to work : 2009-10-06 :
op=$1
shift
case $op in
-*) ;;
*) op=-$op ;;
esac
/usr/bin/ar -Xany "$op" "$@"

6
src/cmd/INIT/ar.linux.i386-64 Executable file
View file

@ -0,0 +1,6 @@
: linux.i386-64 ar wrapper
case $1 in
*x*) /usr/bin/ar "$@" ;;
*) /usr/bin/ar U"$@" ;;
esac

52
src/cmd/INIT/cc.darwin Executable file
View file

@ -0,0 +1,52 @@
: unix wrapper for macOS cc : 2020-07-17 :
HOSTTYPE=darwin.generic
case " $* " in
*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
esac
CC=/usr/bin/cc
op=init
for arg
do case $op in
init) op=ld
set ''
;;
esac
case $arg in
-c) op=cc
;;
-E) op=cpp
continue
;;
-G) op=dll
continue
;;
-lc) continue
;;
-lm) continue
;;
esac
set "$@" "$arg"
done
case $# in
0) ;;
*) shift ;;
esac
case $* in
-v) $CC "$@"; exit ;;
esac
case $op in
init) echo "cc: arguments expected" >&2
exit 1
;;
cpp) $CC -E "$@"
;;
cc) $CC -D_ast_int8_t=int64_t -D_lib_memccpy "$@"
;;
dll) $CC -Wl,-flat_namespace -dynamiclib -undefined dynamic_lookup "$@"
;;
ld) $CC -Wl,-search_paths_first "$@"
;;
esac

71
src/cmd/INIT/cc.darwin07 Executable file
View file

@ -0,0 +1,71 @@
: unix wrapper for Mac OS X 10.3-10.6 (Darwin 7-10) cc : 2020-07-17 :
HOSTTYPE=darwin07.generic
case " $* " in
*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
esac
CC=/usr/bin/cc
op=init
for arg
do case $op in
init) op=ld
set ''
;;
esac
case $arg in
-c) op=cc
;;
-E) op=cpp
continue
;;
-G) op=dll
continue
;;
-lc) continue
;;
-lm) continue
;;
esac
set "$@" "$arg"
done
case $# in
0) ;;
*) shift ;;
esac
case $* in
-v) $CC "$@"; exit ;;
esac
case $op in
init) echo "cc: arguments expected" >&2
exit 1
;;
cpp) $CC -E "$@"
;;
cc) $CC -DCLK_TCK=100 "$@"
;;
dll) # what a compatibility mess -- surely they can get the apis to play nice
tmp=/tmp/cc.${USER:-$LOGNAME}.$$.err
trap "rm -f $tmp" EXIT
case `MACOSX_DEPLOYMENT_TARGET=10.3 ld -undefined dynamic_lookup 2>&1` in
*undefined*dynamic_lookup*)
ld -m -flat_namespace -undefined suppress -dylib -dynamic \
-ldylib1.o "$@" -lcc_dynamic -framework System >$tmp 2>&1
status=$?
;;
*) MACOSX_DEPLOYMENT_TARGET=10.3 $CC -Wl,-flat_namespace -dynamiclib -undefined dynamic_lookup "$@" >$tmp 2>&1
status=$?
;;
esac
egrep -v ' (warning .*multiple definitions|definition) of ' $tmp >&2
exit $status
;;
ld) tmp=/tmp/cc.${USER:-$LOGNAME}.$$.err
trap "rm -f $tmp" EXIT
$CC -Wl,-m -DCLK_TCK=100 "$@" >$tmp 2>&1
status=$?
egrep -v ' (warning .*multiple definitions of|definition of|as lazy binding|not from earlier dynamic) ' $tmp >&2
exit $status
;;
esac

71
src/cmd/INIT/cc.darwin11 Executable file
View file

@ -0,0 +1,71 @@
: unix wrapper for Mac OS X 10.7 (Darwin 11) cc : 2020-07-17 :
HOSTTYPE=darwin11.generic
case " $* " in
*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
esac
CC=/usr/bin/cc
op=init
for arg
do case $op in
init) op=ld
set ''
;;
esac
case $arg in
-c) op=cc
;;
-E) op=cpp
continue
;;
-G) op=dll
continue
;;
-lc) continue
;;
-lm) continue
;;
esac
set "$@" "$arg"
done
case $# in
0) ;;
*) shift ;;
esac
case $* in
-v) $CC "$@"; exit ;;
esac
case $op in
init) echo "cc: arguments expected" >&2
exit 1
;;
cpp) $CC -E "$@"
;;
cc) $CC -DCLK_TCK=100 "$@"
;;
dll) # what a compatibility mess -- surely they can get the apis to play nice
tmp=/tmp/cc.${USER:-$LOGNAME}.$$.err
trap "rm -f $tmp" EXIT
case `MACOSX_DEPLOYMENT_TARGET=10.7 ld -undefined dynamic_lookup 2>&1` in
*undefined*dynamic_lookup*)
ld -m -flat_namespace -undefined suppress -dylib -dynamic \
-ldylib1.o "$@" -lcc_dynamic -framework System >$tmp 2>&1
status=$?
;;
*) MACOSX_DEPLOYMENT_TARGET=10.7 $CC -Wl,-flat_namespace -dynamiclib -undefined dynamic_lookup "$@" >$tmp 2>&1
status=$?
;;
esac
egrep -v ' (warning .*multiple definitions|definition) of ' $tmp >&2
exit $status
;;
ld) tmp=/tmp/cc.${USER:-$LOGNAME}.$$.err
trap "rm -f $tmp" EXIT
$CC -Wl,-m -DCLK_TCK=100 "$@" >$tmp 2>&1
status=$?
egrep -v ' (warning .*multiple definitions of|definition of|as lazy binding|not from earlier dynamic) ' $tmp >&2
exit $status
;;
esac

9
src/cmd/INIT/cc.freebsd Executable file
View file

@ -0,0 +1,9 @@
: FreeBSD cc wrapper
HOSTTYPE=freebsd.generic
case " $* " in
*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
esac
exec /usr/bin/cc -P "$@"

13
src/cmd/INIT/cc.hp.ia64 Executable file
View file

@ -0,0 +1,13 @@
: hp.ia64 cc wrapper for reasonable ansi C defaults : 2011-01-25 :
[ /usr/bin/cc -ef /usr/ccs/bin/cc ] || exit 1
: bundled cc -- really, in the face of gcc you ship a sub-par /usr/bin/cc? :
HOSTTYPE=hp.ia64
case " $* " in
*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
esac
/usr/bin/cc -D_HPUX_SOURCE -D_INCLUDE__STDC_A1_SOURCE -D_INCLUDE_XOPEN_SOURCE_500 "$@"

13
src/cmd/INIT/cc.hp.pa Executable file
View file

@ -0,0 +1,13 @@
: hp.pa cc wrapper for reasonable ansi C defaults : 2004-02-29 :
HOSTTYPE=hp.pa
case " $* " in
*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
esac
_AST_CC_hp_pa_DEFAULT=${_AST_CC_hp_pa_DEFAULT-"+DAportable"}
/opt/ansic/bin/cc -Ae +e -Wl,+s $_AST_CC_hp_pa_DEFAULT \
${INSTALLROOT:+-Wl,+cdp,${INSTALLROOT}/lib/:} \
-Wl,+vnocompatwarnings "$@"

11
src/cmd/INIT/cc.hp.pa64 Executable file
View file

@ -0,0 +1,11 @@
: hp.pa64 cc wrapper for reasonable ansi C defaults : 2001-02-11 :
HOSTTYPE=hp.pa64
case " $* " in
*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
esac
/opt/ansic/bin/cc +D2.0W -Ae +e -Wl,+s \
${INSTALLROOT:+-Wl,+cdp,${INSTALLROOT}/lib/:} \
-Wl,+vnocompatwarnings "$@"

63
src/cmd/INIT/cc.ibm.risc Executable file
View file

@ -0,0 +1,63 @@
: cc wrapper for aix risc xlc : 2012-04-17 :
hosttype=ibm.risc
case $HOSTTYPE in
$hosttype-64)
case " $* " in
*" -q64 "*) ;;
*) set -- -q64 "$@" ;;
esac
;;
*) case " $* " in
*" -q64 "*) HOSTTYPE=$hosttype-64 ;;
*) HOSTTYPE=$hosttype ;;
esac
;;
esac
case " $* " in
*" -dumpmachine "*)
echo $HOSTTYPE
exit
;;
esac
bin=/usr/vac/bin
cc=$bin/xlc
ccflags="-brtl -qhalt=e -qsuppress=1506-224:1506-507"
case " $@ " in
*" -G "*)
ccflags="$ccflags -berok"
;;
esac
if test -x $bin/c99
then # the xlc optimizer vintage that supports c99 is flawed and causes the ast build to fail #
case " $* " in
*" -O "*)
set '' "$@" ''
shift
while :
do a=$1
shift
case $a in
'') break ;;
-O) ;;
*) set '' "$@" $a ;;
esac
shift
done
;;
esac
$cc $ccflags "$@"
code=$?
else export PATH=/bin:$PATH LIBPATH=/usr/lib:/lib
ccflags="$ccflags -blibpath:$LIBPATH"
fi
$cc $ccflags "$@"
code=$?
case $code in
127|255) code=1 ;;
esac
exit $code

36
src/cmd/INIT/cc.ibm.risc.gcc Executable file
View file

@ -0,0 +1,36 @@
: cc wrapper for aix risc gcc : 2012-04-17 :
hosttype=ibm.risc
case $HOSTTYPE in
$hosttype-64)
case " $* " in
*" -maix64 "*) ;;
*) set -- -maix64 "$@" ;;
esac
;;
*) case " $* " in
*" -maix64 "*) HOSTTYPE=$hosttype-64 ;;
*) HOSTTYPE=$hosttype ;;
esac
;;
esac
case " $* " in
*" -dumpmachine "*)
echo $HOSTTYPE
exit
;;
esac
cc=gcc
ccflags=
case " $@ " in
*" -shared "*)
ccflags="$ccflags -shared -Wl,-G -Wl,-berok"
;;
*) ccflags="-Wl,-brtl"
;;
esac
$cc $ccflags "$@"

9
src/cmd/INIT/cc.linux.aarch64 Executable file
View file

@ -0,0 +1,9 @@
: linux.aarch64 cc wrapper : 2006-02-14 :
HOSTTYPE=linux.aarch64
case " $* " in
*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
esac
/usr/bin/cc -P "$@"

9
src/cmd/INIT/cc.linux.i386-64 Executable file
View file

@ -0,0 +1,9 @@
: linux.i386-64 cc wrapper : 2006-02-14 :
HOSTTYPE=linux.i386-64
case " $* " in
*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
esac
/usr/bin/cc -P "$@"

View file

@ -0,0 +1,22 @@
: linux.i386-64 icc wrapper : 2011-10-18 :
HOSTTYPE=linux.i386-64-icc
case " $* " in
*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
esac
icc=$(which icc 2>/dev/null)
case $icc in
"") if test -f /etc/profile.d/icc.sh
then . /etc/profile.d/icc.sh
fi
icc=$(which icc 2>/dev/null)
case $icc in
"") echo icc: not found >&2
exit 127
;;
esac
;;
esac
$icc "$@"

22
src/cmd/INIT/cc.linux.i386-icc Executable file
View file

@ -0,0 +1,22 @@
: linux.ia64 icc wrapper : 2011-10-18 :
HOSTTYPE=linux.ia64-icc
case " $* " in
*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
esac
icc=$(which icc 2>/dev/null)
case $icc in
"") if test -f /etc/profile.d/icc.sh
then . /etc/profile.d/icc.sh
fi
icc=$(which icc 2>/dev/null)
case $icc in
"") echo icc: not found >&2
exit 127
;;
esac
;;
esac
$icc "$@"

22
src/cmd/INIT/cc.linux.ia64-icc Executable file
View file

@ -0,0 +1,22 @@
: linux.ia64 icc wrapper : 2011-10-18 :
HOSTTYPE=linux.ia64-icc
case " $* " in
*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
esac
icc=$(which icc 2>/dev/null)
case $icc in
"") if test -f /etc/profile.d/icc.sh
then . /etc/profile.d/icc.sh
fi
icc=$(which icc 2>/dev/null)
case $icc in
"") echo icc: not found >&2
exit 127
;;
esac
;;
esac
$icc "$@"

81
src/cmd/INIT/cc.lynxos.i386 Executable file
View file

@ -0,0 +1,81 @@
: lynxos.i386 cc wrapper with -dynamic default : 2005-02-14 :
HOSTTYPE=lynxos.i386
case " $* " in
*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
esac
cc=gcc
link=1
static=0
set . "$@" /../
while :
do shift
case $1 in
/../) break ;;
esac
case $1 in
*.[cChHiI]|*.[cChHiI][pPxX][pPxX])
set . -D__NO_INCLUDE_WARN__ -I/sys/include/kernel -I/sys/include/family/x86 "$@"
shift
break
;;
-o) case $2 in
/../) ;;
*) x=$1
shift
set . "$@" "$x"
shift
;;
esac
;;
-static)static=1
;;
-l*) case $static in
0) static=n
set . -L/lib/shlib "$@"
shift
;;
esac
;;
-[cE]) link=0
;;
esac
x=$1
shift
set . "$@" "$x"
done
while :
do case $1 in
/../) shift
break
;;
-l*) case $static in
0) static=n
set . -L/lib/shlib "$@"
shift
;;
esac
;;
-[cE]) link=0
;;
esac
x=$1
shift
set . "$@" "$x"
shift
done
case $link:$static in
1:0) static=n ;;
esac
case $static in
n) specs=/tmp/cc$$.specs
trap 'status=$?; rm -f $specs; exit $status' 0 1 2
echo '*link: %{shared:-shared} %{static:-static} %{mshared|shared: %{static: %eerror: -shared and -static may not be combined. }}' > $specs
$cc -specs=$specs "$@"
;;
*) $cc "$@"
;;
esac

85
src/cmd/INIT/cc.lynxos.ppc Executable file
View file

@ -0,0 +1,85 @@
: lynxos.ppc cc wrapper with -mshared default : 2005-06-01 :
HOSTTYPE=lynxos.ppc
case " $* " in
*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
esac
cc=gcc
link=1
static=0
set . "$@" /../
while :
do shift
case $1 in
/../) break ;;
esac
case $1 in
*.[cChHiI]|*.[cChHiI][pPxX][pPxX])
set . -D__NO_INCLUDE_WARN__ -I/sys/include/kernel -I/sys/include/family/ppc "$@"
shift
break
;;
-o) case $2 in
/../) ;;
*) x=$1
shift
set . "$@" "$x"
shift
;;
esac
;;
-static)static=1
;;
-mshared)
static=n
continue
;;
-l*) case $static in
0) static=n
set . -L/lib/shlib "$@"
shift
;;
esac
;;
-[cE]) link=0
;;
esac
x=$1
shift
set . "$@" "$x"
done
while :
do case $1 in
/../) shift
break
;;
-l*) case $static in
0) static=n
set . -L/lib/shlib "$@"
shift
;;
esac
;;
-[cE]) link=0
;;
esac
x=$1
shift
set . "$@" "$x"
shift
done
case $link:$static in
1:0) static=n ;;
esac
case $static in
n) specs=/tmp/cc$$.specs
trap 'status=$?; rm -f $specs; exit $status' 0 1 2
echo '*link: %{shared:-shared} %{static:-static} %{mshared|shared: %{static: %eerror: -shared and -static may not be combined. }}' > $specs
$cc -specs=$specs -mshared "$@"
;;
*) $cc "$@"
;;
esac

279
src/cmd/INIT/cc.mvs.390 Executable file
View file

@ -0,0 +1,279 @@
: mvs.390 cc wrapper for unix message and exit code semantics : 2012-01-20 :
HOSTTYPE=mvs.390
case " $* " in
*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
esac
ar=ar
cc=/bin/c89
CC=/bin/c++
ccflags="-D_ALL_SOURCE -Wc,dll"
objmax=60
tmpfiles=
unbotch=
# -n as *first* arg shows but does not do
# -Wc,exportall => -Wl,dll
# -Bdynamic => .c,.o dynamic
# -Bstatic => .c,.o static
# *.C => cc=$CC
# *.cpp => cc=$CC
# *.cxx => cc=$CC
# no optimization until the optimizer is fixed:
# -O dropped (no optimization)
# -0 dropped (no optimization)
# -1 -O (default level 1 optimization)
# -2 -2 (maximal level 2 optimization)
let argc=0 cmp=0 dll=0 libc=0 dynamic=1 dynamic_objc=0 static_objc=0 relc=0 botched=0
case $1 in
-n) exec=print
shift
;;
*) exec=
;;
esac
export _CC_ACCEPTABLE_RC=1
export _C89_ACCEPTABLE_RC=$_CC_ACCEPTABLE_RC
export _CXX_ACCEPTABLE_RC=$_CC_ACCEPTABLE_RC
case " $* " in
*.C" "*)let dll=2
cc=$CC
export _CXXSUFFIX=C
;;
*.cpp" "*)let dll=2
cc=$CC
export _CXXSUFFIX=cpp
;;
*.cxx" "*)let dll=2
cc=$CC
export _CXXSUFFIX=cxx
;;
esac
exe=
xxx=
while :
do case $# in
0) break ;;
esac
arg=$1
case $arg in
-1) arg=-O
;;
-Bdynamic)
let dynamic=1
;;
-Bstatic)
let dynamic=0
;;
-c) let cmp=1
;;
-D_ALL_SOURCE|-D_ALL_SOURCE=*)
arg=
;;
-D*[\ \(\)]*)
arg=${arg#-D}
botch_macro[botched]=${arg%%=*}
botch_value[botched]=${arg#*=}
let botched=botched+1
arg=
;;
-o) argv[argc]=$arg
let argc=argc+1
shift
arg=$1
exe=$arg
rm -f "$exe"
;;
-[O0]) arg=
;;
-Wc,dll)arg=
;;
-Wc,exportall)
let dll=1
;;
-Wl,dll)arg=
let dll=1
;;
*.c) if [[ $botched != 0 ]]
then src=$arg
arg=${arg##*/}
unbotch="$unbotch ${arg%.c}.o"
arg=__$arg
tmpfiles="$tmpfiles $arg"
{
while [[ $botched != 0 ]]
do let botched=botched-1
print -r -- "#define ${botch_macro[botched]} ${botch_value[botched]}"
done
cat $src
} > $arg
fi
;;
*.o) if test 0 != $dynamic
then let dynamic_objc=dynamic_objc+1
else let static_objc=static_objc+1
fi
;;
*.x) a=${arg%.x}.a
if test -f $a
then argv[argc]=$a
let argc=argc+1
xxx=-Wl,dll
case $a in
ast.a|*/ast.a)
cc="$CC -u_ast_init"
;;
esac
fi
;;
esac
case $arg in
?*) argv[argc]=$arg
let argc=argc+1
;;
esac
shift
done
tmp=/tmp/cc.${USER:-$LOGNAME}.$$.err
tmpfiles="$tmp $tmpfiles"
# if any dll .o's are in .a then a .x gets generated
# but the native cc doesn't jcl for the .x
# -Wl,dll does that, so we nuke the .x and keep the exe
test 0 != $dll && xxx=
case $xxx in
?*) case $exe in
?*) a=${exe##*/}
a=${a%.*}
case $exe in
*/*) tmpfiles="$tmpfiles ${exe%/*}/${a}.x" ;;
*) tmpfiles="$tmpfiles ${a}.x" ;;
esac
;;
esac
;;
esac
if test 0 != $dll
then if test 0 != $cmp
then xxx="-D_SHARE_EXT_VARS $xxx"
else xxx="-Wl,dll $xxx"
fi
fi
set -- $xxx "${argv[@]}"
# can't handle more than objmax .o's
# -r into intermediates doesn't work, but the cat trick does
# also, the runtime dll file must be executable but cc -Wl,dll forgets
if test 0 != $dll -a \( $dynamic_objc -ge $objmax -o 0 != $static_objc \)
then unset argv
argc=0 libc=0 dynamic=1 dynamic_objc=0 static_objc=0 endc=0
while :
do case $# in
0) break ;;
esac
case $1 in
-Bdynamic)
let dynamic=1
;;
-Bstatic)
let dynamic=0
;;
*.o) if test 0 != $dynamic
then dynamic_objv[dynamic_objc]=$1
let dynamic_objc=dynamic_objc+1
else static_objv[static_objc]=$1
let static_objc=static_objc+1
fi
;;
-l*) libv[libc]=$1
let libc=libc+1
;;
-o) argv[argc]=$1
let argc=argc+1
shift
argv[argc]=$1
let argc=argc+1
exe=$1
;;
*) argv[argc]=$1
let argc=argc+1
;;
esac
shift
done
if test 0 != $static_objc
then case $exe in
?*) $exec $ar cr ${exe%.*}.a "${static_objv[@]}" ;;
esac
fi
if test 0 != $dynamic_objc
then cat=0.0.o
tmpfiles="$tmpfiles $cat"
cat "${dynamic_objv[@]}" > $cat || exit
else cat=
fi
set -- "${argv[@]}" $cat "${libv[@]}"
fi
# grep through the warning/error messages to get the true exit code
# some annoying messages are dropped while we're at it
trap 'rm -f $tmpfiles' 0 1 2 15
$exec $cc $ccflags "$@" 2> $tmp
code=$?
for i in $unbotch
do test -f __$i && mv __$i $i
done
typeset -l lc
while :
do if read line
then lc=$line
case $lc in
*'#include file'*'not found'*)
code=1
;;
*'#pragma ignored'*)
continue
;;
*'definition side file is not defined'*)
continue
;;
*'step ended with return code 4'*)
code=0
continue
;;
*'step ended with return code'*)
code=1
continue
;;
*'try again'*)
code=1
continue
;;
*'unknown preprocessing directive'*)
code=1
case $lc in
'warning '*)
set -- $line
shift
line=$*
;;
esac
;;
*'unresolved writable static references are detected'*)
test 0 != $dll && continue
;;
esac
else case $code:$exe in
0:?*) $exec chmod +x $exe ;;
esac
exit $code
fi
echo "$line" >&2
done < $tmp

158
src/cmd/INIT/cc.next.i386 Executable file
View file

@ -0,0 +1,158 @@
: next.i386 cc wrapper for unix message and exit code semantics : 1995-05-09 :
HOSTTYPE=next.i386
case " $* " in
*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
esac
# 1995-05-09 -lposix termios.o waitpid.o setpgid.o *do* work
# 1994-11-04 -posix has old redirection hole bug
# -D_POSIX_SOURCE requires <sys/dirent.h> manual fixes
# libexpr/exeval.c bombs -O, no -O ok
command=cc
cc="/bin/cc -D_POSIX_SOURCE"
nooptimize="exeval"
# first check $INSTALLROOT/botch
case $INSTALLROOT in
"") echo "$command: INSTALLROOT: must be defined and exported" >&2; exit 1 ;;
esac
if test ! -d $INSTALLROOT/botch -a -dryrun != "$1"
then if mkdir $INSTALLROOT/botch
then : ok to initialize
else echo "$command: $INSTALLROOT/botch must be initialized by the owner of $INSTALLROOT" 2>&1
exit 1
fi
(
cd $INSTALLROOT/botch
dir=.
for i in lib . include sys
do case $i in
.) dir=.
;;
*) case $i in
/*) dir=$i ;;
*) dir=$dir/$i ;;
esac
test -d $dir || mkdir $dir
;;
esac
done
if test ! -f include/sys/dirent.h
then echo "#include <dirent.h>" > tmp.c
header=`$cc -E tmp.c | sed -e '/^#[ ]*1[ ].*\/sys\/dirent\.h"/!d' -e 's/.*"\(.*\)".*/\1/'`
sed -e 's/[ ]off_t[ ][ ]*d_off[ ]*;//' $header > include/sys/dirent.h
fi
if test ! -f lib/libbotch.a
then lipo /usr/lib/libposix.a -thin i386 -output tmp.a
ar x tmp.a termios.o waitpid.o setpgid.o
ar cr lib/libbotch.a *.o
ranlib lib/libbotch.a
fi
rm -f *.[aco]
)
fi
# now slip in our args
case $nooptimize in
"") nooptimize=.
;;
*) optimize=
for arg in $nooptimize
do case $optimize in
?*) optimize="$optimize|" ;;
esac
optimize="$optimize$arg.[ci]|*/$arg.[ci]"
done
nooptimize=$optimize
;;
esac
set . "$@" .
noexec=
library=
local=
optimize=
verbose=
while :
do shift
arg=$1
shift
case $arg in
.) break
;;
-[cES]) library=1
;;
-O) optimize=1
;;
-v) verbose=1
;;
-dryrun)noexec=1
verbose=1
;;
-I-) case $local in
"") local=1
set . "$@" -I$INSTALLROOT/botch/include -I- -I$INSTALLROOT/botch/include
;;
*) set . "$@" -I- -I$INSTALLROOT/botch/include
;;
esac
continue
;;
-I*|*.[cChHiI]|*.[cChHiI][pPxX][pPxX])
case $optimize in
1) eval "
case \$arg in
$nooptimize)
optimize=0
;;
esac
"
;;
esac
case $local in
"") local=1
set . "$@" -I$INSTALLROOT/botch/include "$arg"
continue
;;
esac
;;
-last|*/libast.a)
case $library in
"") library=1
set . "$@" $INSTALLROOT/botch/lib/libbotch.a "$arg" $INSTALLROOT/botch/lib/libbotch.a
continue
;;
esac
;;
esac
set . "$@" "$arg"
done
case $library in
"") set . "$@" $INSTALLROOT/botch/lib/libbotch.a
shift
;;
esac
case $optimize in
0) set . "$@" .
while :
do shift
arg=$1
shift
case $arg in
.) break ;;
-O) set . "$@" ;;
*) set . "$@" "$arg" ;;
esac
done
;;
esac
case $verbose in
?*) echo $cc "$@" ;;
esac
case $noexec in
"") $cc "$@" ;;
esac

9
src/cmd/INIT/cc.next.m68k Executable file
View file

@ -0,0 +1,9 @@
: next.m68k cc wrapper that enables posix : 2000-12-15 :
HOSTTYPE=next.m68k
case " $* " in
*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
esac
/bin/cc -posix -Xlinker -m "$@"

9
src/cmd/INIT/cc.openbsd Executable file
View file

@ -0,0 +1,9 @@
: OpenBSD cc wrapper
HOSTTYPE=openbsd.generic
case " $* " in
*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
esac
exec /usr/bin/cc -P "$@"

9
src/cmd/INIT/cc.osf.alpha Executable file
View file

@ -0,0 +1,9 @@
: osf.alpha cc wrapper with reasonable namespace defaults : 1998-02-04 :
HOSTTYPE=osf.alpha
case " $* " in
*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
esac
/usr/bin/cc -std -Dnoshare=_noshare_ -Dreadonly=_readonly_ "$@"

26
src/cmd/INIT/cc.pentium4 Executable file
View file

@ -0,0 +1,26 @@
: linux.pentium4 gcc wrapper : 2005-10-24 :
HOSTTYPE=linux.pentium4
case " $* " in
*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
esac
case " $* " in
*" -O "*)
set -A argv -- "$@"
set -A nargv
integer i j
for ((i = j = 0; i < ${#argv[@]}; i++))
do if [[ ${argv[i]} == -O ]]
then nargv[j++]=-O3
nargv[j++]=-march=pentium4
else nargv[j++]=${argv[i]}
fi
done
gcc "${nargv[@]}"
exit
;;
esac
gcc "$@"

9
src/cmd/INIT/cc.sco.i386 Executable file
View file

@ -0,0 +1,9 @@
: sco.i386 cc wrapper with reasonable binary and namespace : 1998-02-04 :
HOSTTYPE=sco.i386
case " $* " in
*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
esac
/bin/cc -b elf -D_SVID3 "$@"

68
src/cmd/INIT/cc.sgi.mips2 Executable file
View file

@ -0,0 +1,68 @@
: sgi.mips2 cc wrapper that generates mips2 binaries : 2006-02-14 :
HOSTTYPE=sgi.mips2
case " $* " in
*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
esac
cc=/usr/bin/cc
debug=
dynamic=-G0
flags=-OPT:Olimit=0
ignore=1685,733,1048,1155,1171,1184,1209,1343,3169,3170,3433
ldignore=15,84,85,13
optimize=
case $_AST_cc_OPTIONS in
?*) eval $_AST_cc_OPTIONS ;;
esac
case $ignore in
?*) ignore="-woff $ignore" ;;
esac
case $ldignore in
?*) ifs=$IFS
IFS=,
v=$ldignore
ldignore=
for i in $v
do ldignore="$ldignore -Wl,-woff,$i"
done
IFS=$ifs
;;
esac
case $debug in
?*) integer n=0
for i
do case $i in
-g*) case $debug in
-) continue ;;
esac
i=$debug
;;
esac
a[n++]=$i
done
set -- ${a[@]}
;;
esac
case $optimize in
?*) integer n=0
for i
do case $i in
-O*) case $optimize in
-) continue ;;
esac
i=$optimize
;;
esac
a[n++]=$i
done
set -- ${a[@]}
;;
esac
if test -d /usr/lib32
then LD_LIBRARYN32_PATH=/lib32 $cc -32 -mips2 $flags $dynamic $ldignore $ignore "$@"
else $cc -mips2 $flags $ignore "$@"
fi

110
src/cmd/INIT/cc.sgi.mips3 Executable file
View file

@ -0,0 +1,110 @@
: sgi.mips3 cc wrapper that generates mips3 binaries : 2007-04-27 :
HOSTTYPE=sgi.mips3
case " $* " in
*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
esac
# ld:
# 15
# 84
# 85
# 134
# cc:
# 1685 (first!!) Invalid error number: X.
# 1035 cpp #error -- 0 exit status by default - botch botch botch
# 1048
# 1155
# 1171 The indicated expression has no effect.
# 1184 "=" is used where where "==" may have been intended.
# 1209 The controlling expression is constant.
# 1343
# 3169 X not marked as intrinsic because it is not yet declared
# 3170 X not marked as intrinsic because it is not yet declared
# 3421 expecting function name #pragma intrinsic (X)
# 3433 X not marked as intrinsic because it is not yet declared
# 3434 X not marked as intrinsic because it is not yet declared
cc=/usr/bin/cc
debug=
dynamic=-G0
flags=-OPT:Olimit=0
fatal=1035
ignore=1685,733,1048,1155,1171,1184,1209,1343,3169,3170,3421,3433,3434
ldignore=15,84,85,13
optimize=
case $_AST_cc_OPTIONS in
?*) eval $_AST_cc_OPTIONS ;;
esac
case $fatal in
?*) fatal="-diag_error $fatal" ;;
esac
case $ignore in
?*) ignore="-woff $ignore" ;;
esac
case $ldignore in
?*) ifs=$IFS
IFS=,
v=$ldignore
ldignore=
for i in $v
do ldignore="$ldignore -Wl,-woff,$i"
done
IFS=$ifs
;;
esac
case $debug in
?*) integer n=0
for i
do case $i in
-g*) case $debug in
-) continue ;;
esac
i=$debug
;;
esac
a[n++]=$i
done
set -- ${a[@]}
;;
esac
case $optimize in
?*) integer n=0
for i
do case $i in
-O*) case $optimize in
-) continue ;;
esac
i=$optimize
;;
esac
a[n++]=$i
done
set -- ${a[@]}
;;
esac
case $1 in
-mips2) if test -d /usr/lib32
then LD_LIBRARYN32_PATH=/lib32 $cc -32 -mips2 $flags $dynamic $ldignore $ignore "$@"
else $cc -mips2 $flags $ignore "$@"
fi
;;
-mips4) case " $* " in
*" -ldl "*)
integer n=0
for i
do case $i in
-ldl) ;;
*) a[n++]=$i ;;
esac
done
set -- ${a[@]}
esac
$cc -64 -mips4 $flags $dynamic $fatal $ldignore $ignore "$@"
;;
*) $cc -n32 -mips3 $flags $dynamic $fatal $ldignore $ignore "$@"
;;
esac

65
src/cmd/INIT/cc.sgi.mips3-o32 Executable file
View file

@ -0,0 +1,65 @@
: sgi.mips3-o32 cc wrapper that generates mips3 o32 binaries : 2006-02-14 :
HOSTTYPE=sgi.mips3-o32
case " $* " in
*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
esac
cc=/usr/bin/cc
debug=
dynamic=-G0
flags=
ignore=1685,733,1048,1155,1171,1184,1209,1343,3169,3170,3433
ldignore=15,84,85,13
optimize=
case $_AST_cc_OPTIONS in
?*) eval $_AST_cc_OPTIONS ;;
esac
case $ignore in
?*) ignore="-woff $ignore" ;;
esac
case $ldignore in
?*) ifs=$IFS
IFS=,
v=$ldignore
ldignore=
for i in $v
do ldignore="$ldignore -Wl,-woff,$i"
done
IFS=$ifs
;;
esac
case $debug in
?*) integer n=0
for i
do case $i in
-g*) case $debug in
-) continue ;;
esac
i=$debug
;;
esac
a[n++]=$i
done
set -- ${a[@]}
;;
esac
case $optimize in
?*) integer n=0
for i
do case $i in
-O*) case $optimize in
-) continue ;;
esac
i=$optimize
;;
esac
a[n++]=$i
done
set -- ${a[@]}
;;
esac
$cc -o32 -mips3 $flags $dynamic $ldignore $ignore "$@"

90
src/cmd/INIT/cc.sgi.mips4 Executable file
View file

@ -0,0 +1,90 @@
: sgi.mips4 cc wrapper that generates mips4 binaries : 2007-04-27 :
HOSTTYPE=sgi.mips4
case " $* " in
*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
esac
cc=/usr/bin/cc
debug=
dynamic=-G0
flags=-OPT:Olimit=0
fatal=1035
ignore=1685,733,1048,1155,1171,1184,1209,1343,3169,3170,3433
ldignore=15,84,85,13
optimize=
case $_AST_cc_OPTIONS in
?*) eval $_AST_cc_OPTIONS ;;
esac
case $fatal in
?*) fatal="-diag_error $fatal" ;;
esac
case $ignore in
?*) ignore="-woff $ignore" ;;
esac
case $ldignore in
?*) ifs=$IFS
IFS=,
v=$ldignore
ldignore=
for i in $v
do ldignore="$ldignore -Wl,-woff,$i"
done
IFS=$ifs
;;
esac
case $debug in
?*) integer n=0
for i
do case $i in
-g*) case $debug in
-) continue ;;
esac
i=$debug
;;
esac
a[n++]=$i
done
set -- ${a[@]}
;;
esac
case $optimize in
?*) integer n=0
for i
do case $i in
-O*) case $optimize in
-) continue ;;
esac
i=$optimize
;;
esac
a[n++]=$i
done
set -- ${a[@]}
;;
esac
case $1 in
-mips2) if test -d /usr/lib32
then LD_LIBRARYN32_PATH=/lib32 $cc -32 -mips2 $flags $dynamic $ldignore $ignore "$@"
else $cc -mips2 $flags $ignore "$@"
fi
;;
-mips3) $cc -n32 -mips3 $flags $dynamic $fatal $ldignore $ignore "$@"
;;
*) case " $* " in
*" -ldl "*)
integer n=0
for i
do case $i in
-ldl) ;;
*) a[n++]=$i ;;
esac
done
set -- ${a[@]}
esac
$cc -64 -mips4 $flags $dynamic $fatal $ldignore $ignore "$@"
;;
esac

Some files were not shown because too many files have changed in this diff Show more