dtksh: Upgrade ksh93 to 1.0.0-beta.2 2021-12-28
Patch from current ksh93 maintainer <https://github.com/ksh93/ksh>. cde/programs/dtksh/ksh93/**: - Upgraded. A load of bugs fixed, some minor features added. See NEWS from 2021-02-01 upwards. cde/programs/dtksh/Makefile.am: - Don't cd into ksh93 any more to invoke the package or shtests scripts; they now automatically find their directories. - Pass $(CFLAGS) to build ksh with optimisation. - Remove -D_std_malloc flag as vmalloc is now deprecated and disabled by default. - Add a 'make check' target to Makefile.am that runs the ksh93 regression tests on dtksh to make sure the additions don't interfere with anything. It skips running the tests with shcomp because CDE doesn't use that. The tests all pass here on Slackware 14.2. :-) cde/programs/dtksh/init.patch: - Removed; I've upstreamed it. It was the only one that wasn't upstreamed yet, and more code cleanups are coming, breaking downstream patches. If something needs updating, just email me a diff. cde/programs/dtksh/dtkcmds.h: - Update the ADDBUILTIN macro to remove the __PROTO__ macro use. The proto(1) tool, responsible for all such pre-C89 K&R C compatibility voodoo, has been removed, so that macro is no longer defined. cde/programs/dtksh/setup.sh: - Workaround script removed. I rewrote 'bin/package flat make' in a way that works correctly and changed Makefile.am to use that instead. Hope this helps. Happy new year.
This commit is contained in:
committed by
Jon Trulson
parent
d5e651ecf3
commit
bf00d3b274
@@ -32,7 +32,7 @@ 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
|
||||
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>
|
||||
@@ -93,7 +93,7 @@ The development kit has three directories,
|
||||
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
|
||||
The <TT>include</TT> directory contains a subdirectory
|
||||
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
|
||||
@@ -128,7 +128,7 @@ 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.
|
||||
a pointer to 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>
|
||||
@@ -273,7 +273,7 @@ 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&R C<FONT SIZE=-6>[3]</FONT>,
|
||||
ANSI-C<FONT SIZE=-6>[4]</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><shell.h></TT>.
|
||||
@@ -285,7 +285,7 @@ services for your builtins.
|
||||
The header file <TT><ast.h></TT>
|
||||
provides prototypes for many <STRONG>libast</STRONG> functions
|
||||
and all the symbol and function definitions from the
|
||||
ANSI-C headers, <TT><stddef.h></TT>,
|
||||
ANSI C headers, <TT><stddef.h></TT>,
|
||||
<TT><stdlib.h></TT>, <TT><stdarg.h></TT>, <TT><limits.h></TT>,
|
||||
and <TT><string.h></TT>.
|
||||
It also provides all the symbols and definitions for the
|
||||
@@ -311,7 +311,7 @@ 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.
|
||||
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,
|
||||
@@ -412,7 +412,7 @@ 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
|
||||
to indicate the
|
||||
preceding option argument is not required.
|
||||
<DT><TT>[</TT>...<TT>]</TT><DD><BR>
|
||||
After a <TT>:</TT> or <TT>#</TT>, the characters contained
|
||||
@@ -458,7 +458,7 @@ while(1) switch(n=optget(argv,"xf:[file]"))
|
||||
break;
|
||||
case '?':
|
||||
error(ERROR_usage(2), opt_info.arg);
|
||||
break;
|
||||
UNREACHABLE();
|
||||
}
|
||||
</DIV>
|
||||
</PRE>
|
||||
@@ -521,7 +521,7 @@ 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>
|
||||
portions of the hierarchical 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
|
||||
@@ -544,7 +544,7 @@ 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
|
||||
The <TT>nv_getval()</TT> function returns a pointer to 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
|
||||
@@ -593,7 +593,7 @@ 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
|
||||
function is called 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.
|
||||
|
||||
@@ -101,7 +101,7 @@ the man page for ksh93 is kept up to date.
|
||||
|
||||
The only major new interactive features are key binding and tab completion.
|
||||
Major new language features are floating point arithmetic,
|
||||
associative arrays, complete ANSI-C printf, name reference
|
||||
associative arrays, complete ANSI C printf, name reference
|
||||
variables, new expansion operators, dynamic loading of
|
||||
built-in commands, active variables, and compound variables.
|
||||
Active and compound variables allow shell variables to
|
||||
@@ -164,7 +164,7 @@ bash compatibility mode.
|
||||
</UL>
|
||||
<LI>
|
||||
<EM>version</EM>--
|
||||
a lower-case letter signifying major release points.
|
||||
a lowercase letter signifying major release points.
|
||||
An optional <STRONG>-</STRONG> following <EM>features</EM> signifies an alpha release.
|
||||
The first stable release has no <STRONG>-</STRONG>.
|
||||
An optional <STRONG>+</STRONG> signifies a stable release with bug patches and minor enhancements.
|
||||
@@ -180,7 +180,7 @@ in a numeric context is an integer that encodes the release
|
||||
<DT>What new features are planned for ksh?<DD>
|
||||
|
||||
We are in the early stage of planning but the likely additions
|
||||
are namespaces, ability to read xml and json object into shell variables,
|
||||
are namespaces, ability to read XML and JSON object into shell variables,
|
||||
and handling of queued signals.
|
||||
Support for multi-threading is also being considered.
|
||||
|
||||
@@ -254,7 +254,7 @@ that supports a subset of the 1988 KornShell language.
|
||||
|
||||
ksh has been written to be portable.
|
||||
It has been ported to virtually run on every known UNIX system.
|
||||
In addition it runs on non-UNIX systems such as IBM's MVS using OpenEdition, and
|
||||
In addition, it runs on non-UNIX systems such as IBM's MVS using OpenEdition, and
|
||||
Microsoft's Windows 9X, Windows NT and Windows 2000.
|
||||
ksh is part of the UWIN (Unix for Windows)</A>
|
||||
software,
|
||||
@@ -389,7 +389,7 @@ If you run
|
||||
kill -l $?
|
||||
</DIV>
|
||||
</PRE>
|
||||
on this signal number, it will give the the name of the signal
|
||||
on this signal number, it will give the name of the signal
|
||||
that caused this exit.
|
||||
|
||||
<DT>When I type builtin, I notice that some of these are full pathnames. What does this mean?<DD>
|
||||
@@ -464,7 +464,7 @@ is to make the command a builtin. On systems in which the cmd
|
||||
library is installed, you can invoke 'builtin -f cmd mv' to make
|
||||
mv a shell builtin in which case the line length limit no longer
|
||||
applies. Another alternative is to use a for loop and invoke
|
||||
the mv command for each file, for exampe,
|
||||
the mv command for each file, for example,
|
||||
'for i in *;do mv $i ../elsewhere;done'.
|
||||
Starting with ksh93o+, a new feature was added to ksh to overcome
|
||||
this limit in some cases. If a command is preceded by
|
||||
@@ -549,9 +549,9 @@ read x
|
||||
The $'...' string literal syntax was added to ksh93 to solve the problem
|
||||
of entering special characters in scripts.
|
||||
It uses
|
||||
ANSI-C rules to translate the string between the '...'.
|
||||
ANSI C rules to translate the string between the '...'.
|
||||
It would have been cleaner to have all "..." strings handle
|
||||
ANSI-C escapes, but that would not be backward compatible.
|
||||
ANSI C escapes, but that would not be backward compatible.
|
||||
|
||||
<DT>What is the -n option used for?<DD>
|
||||
|
||||
@@ -600,7 +600,7 @@ hand side, which removes the special meaning of pattern match
|
||||
characters, then this becomes a string comparison so that
|
||||
[[ "$foo" == "bar" ]] and [[ "$bar" == "$foo" ]] are equivalent.
|
||||
|
||||
<DT>Why does ksh93 have print since echo already exists is is widely used?<DD>
|
||||
<DT>Why does ksh93 have print since echo already exists and is widely used?<DD>
|
||||
|
||||
The behavior of echo varies from system to system.
|
||||
The POSIX standard does not define the behavior of echo when
|
||||
@@ -620,7 +620,7 @@ as if you had invoked it as echo foo | (read bar).
|
||||
<DT>How can I access a substring of a variable?<DD>
|
||||
|
||||
The syntax ${varname:offset:len} can be used to generate
|
||||
the string of length len starting at the the specified
|
||||
the string of length len starting at the specified
|
||||
offset. String offsets start at 0. If :len is omitted,
|
||||
then the remainder of the string will be used. Both offset
|
||||
and len can be arithmetic expressions. A negative offset is
|
||||
@@ -771,9 +771,9 @@ or indexed, use ${!var[@]}.
|
||||
<DT>How do I do global substitutions on the contents of shell variables?<DD>
|
||||
|
||||
Use // instead of / for global substitution, ${var//aa/bb} will
|
||||
expand to the value of with each "aa" replace by "bb".
|
||||
expand to the value of var with each "aa" replaced by "bb".
|
||||
|
||||
<DT>How can I convert %XX values to ascii?<DD>
|
||||
<DT>How can I convert %XX values to ASCII?<DD>
|
||||
|
||||
You can convert this to a sequence of ANSI C strings and then eval that
|
||||
string, for example suppose the variable 'foo' contains %XX strings, then
|
||||
@@ -782,7 +782,7 @@ string, for example suppose the variable 'foo' contains %XX strings, then
|
||||
eval print -r -- "\$'${foo//'%'@(??)/'\x\1"'\$'"}'"
|
||||
</DIV>
|
||||
</PRE>
|
||||
will print out the string in ascii.
|
||||
will print out the string in ASCII.
|
||||
|
||||
<DT>I want to use exec to open a file. How do I prevent the script from exiting if the exec fails?<DD>
|
||||
|
||||
@@ -894,19 +894,19 @@ Alternatively, <# and ># can be followed by a shell pattern. In this
|
||||
case, the file will be positioned to beginning of the next line
|
||||
containing this pattern.
|
||||
|
||||
<DT>What is the the <<< redirection operator?<DD>
|
||||
<DT>What is the <<< redirection operator?<DD>
|
||||
|
||||
It denotes a here-document in which the document is contained the
|
||||
argument that follows <<< and therefore there is no delimiter.
|
||||
|
||||
<DT>What is the the >; redirection operator?<DD>
|
||||
<DT>What is the >; redirection operator?<DD>
|
||||
|
||||
This operator writes the output into a temporary file in the same
|
||||
directory as the file specified after >;. If the command completes
|
||||
successfully, then the the file is replaced. Otherwise, the
|
||||
successfully, then the file is replaced. Otherwise, the
|
||||
original file is unchanged and the temporary file removed.
|
||||
|
||||
<DT>What is the the <>; redirection operator?<DD>
|
||||
<DT>What is the <>; redirection operator?<DD>
|
||||
|
||||
The file is opened for reading and writing as with <>. However,
|
||||
when the file is closed it is truncated to the its current location.
|
||||
|
||||
@@ -21,7 +21,7 @@ dd { margin-left:3em; }
|
||||
<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&T Research (nee Bell Laboratories).
|
||||
by Morris Bolsky and David Korn of AT&T Research.
|
||||
The KornShell is a shell programming language,
|
||||
which is upward compatible with
|
||||
<EM>sh</EM>
|
||||
@@ -39,7 +39,7 @@ In addition,
|
||||
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
|
||||
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
|
||||
@@ -120,7 +120,7 @@ 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
|
||||
In addition, there is an arithmetic for command that works
|
||||
like the for statement in C.
|
||||
|
||||
<P>
|
||||
|
||||
Reference in New Issue
Block a user