On 11/3/06, Glenn Fowler <gsf at research.att.com> wrote:
>
> this should be the last alpha update before we post
> source and binary packages at the regular download site
>
> this update reflects patches and suggestions from the
> ast-user and opensolaris ksh integration groups
>
> the base archives and md5 sums are:
>
>   http://www.research.att.com/~gsf/download/alpha/INIT.2006-10-31.md5
>   http://www.research.att.com/~gsf/download/alpha/INIT.2006-10-31.tgz
>   http://www.research.att.com/~gsf/download/alpha/ast-ksh.2006-10-31.md5
>   http://www.research.att.com/~gsf/download/alpha/ast-ksh.2006-10-31.tgz
patch diff attached
-- 
      _        Felix Schulte
    _|_|_     mailto:felix.schulte at gmail.com
    (0 0)
ooO--(_)--Ooo
-------------- next part --------------
diff -r -N -u ksh93_2006_09_12/lib/package/ast-ksh.html 
ksh93_2006_10_31/lib/package/ast-ksh.html
--- ksh93_2006_09_12/lib/package/ast-ksh.html   2006-09-13 06:38:20.000000000 
+0200
+++ ksh93_2006_10_31/lib/package/ast-ksh.html   2006-11-02 20:54:15.000000000 
+0100
@@ -1,7 +1,7 @@
 <!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&T Labs Research) 2005-10-15">
+<META name="generator" content="mm2html (AT&T Labs Research) 2006-10-31">
 <META name="description" content="ast-ksh package">
 <META name="keywords" content="software, package">
 <TITLE> ast-ksh package </TITLE>
@@ -192,12 +192,45 @@
 <P><HR><CENTER><FONT color=red><FONT face=courier><H3><A name="ksh93 
changes">ksh93 changes</A></H3></FONT></FONT></CENTER>
 <PRE>
 
-06-09-08  --- Release ksh93s-  ---
-06-09-97  The -a option was added to typeset for indexed arrays.  This
+06-10-30  --- Release ksh93s-  ---
+06-10-30  The redirections &lt;# pattern, and &lt;## pattern have been added.
+         Both seek forward to the beginning of the next line that contains
+         the pattern.  The &lt;## form copies the skipped portion to standard
+         output.
+06-10-26  On systems that support stream control transport, the virtual file
+         name /dev/sctp/host/port can now be used to establish connections.
+06-10-26  The printf modifier # when used with d produces units in thousands
+         with a single letter suffix added.  The modifier # when used with
+         the i specification provides units of 1024 with a two letter suffix.
+06-10-24  The value of $! is now set to the process id of a job put
+         into the background with the bg command as required by POSIX.
+06-10-23  A bug in which the value of $! was affected by a background
+         job started from a subshell has been fixed.
+06-10-23  A bug in ${var:offset:len} in multibyte locales has been fixed.
+06-10-15  The remaining math functions from C99 were added for any system
+         that supports them.
+06-10-12  A bug when skipping over `...` with ${x:=`...`} when x is set
+         has been fixed.
+06-10-11  A bug in process floating constants produced by the %a format
+         of printf has been fixed.
+06-10-06  A bug in which IFS was not being restored correctly in some
+         cases after a subshell has been fixed.
+06-10-06  A bug in which pipefail was not detecting some failures in
+         pipelines with 3 or more states has been fixed.
+06-10-03  A bug in the processing of &gt;(...) with builtins which could
+         cause the builtin to hang has been fixed.
+06-10-03  A bug in the for loop optimizer which causes &gt;(...) process
+         substitution to be ignored has been fixed.
+06-09-17  The -a option was added to typeset for indexed arrays.  This
          is only needed when using the (&#0091;subscript&#0093;=value ...) 
form.
+06-09-06  The showme option was added.  Each simple command not beginning
+         with a redirection and not occurring with in the while, until, if,
+         select condition can be preceded by a semi-colon which will
+         be ignored when showme is off.  When showme is on, any command
+         preceded by a colon will be traced but not executed.
 06-08-16  As a new feature, a leading ~(N) on a pattern has no effect 
          except when used for file expansion.  In this case if not
-         matches are found, the pattern is replaced by nothing rathern
+         matches are found, the pattern is replaced by nothing rather
          than itself.
 06-08-11  A bug in the expansion of 
${.sh.match&#0091;i&#0093;:${#.shmatch&#0091;i&#0093;}} has
          been fixed.
@@ -231,7 +264,7 @@
 06-06-13  Internal change to use ordering for variables instead of hashing
          to speed up prefix matching.
 06-06-13  A window between fork/exec in which a signal could get lost
-         and cause a peogram to hang has been eliminated
+         and cause a program to hang has been eliminated
 06-06-13  A bug in edit completion with quoted strings has been fixed.
 06-06-07  The restricted options can now be enabled by set as well as on
          the command line.  Once set, it can not be disabled.
@@ -243,7 +276,7 @@
           and ksh88 when the stty lnext is control-v.  The sequence
          escape-control-v will display the shell version.
 06-05-31  Modified emacs and vi mode so that entering a TAB after a partial
-         TAB conpletion, generates a listing of possible completions.
+         TAB completion, generates a listing of possible completions.
          After the second TAB, a number followed by a TAB will perform
          the completion with the corresponding item.
 06-05-19  Modified arithmetic so that conversions to strings default to
@@ -286,7 +319,7 @@
 05-12-07  The aliases for integer and float have been changed to use attributes
          -li and -lE to handle long long and long double types.
 05-12-07  The histexpand (-H) option has been added which allows C-shell
-         style history expansios using the history character !.
+         style history expansions using the history character !.
 05-12-07  The multiline option was added which changes that way the edit
          modes handle lines longer than the window width.  Instead of
          horizontal scrolling, multiple lines on the screen are used.
@@ -436,7 +469,7 @@
          an integral number of seconds, for example even -t 'sin(.5)'
          is now valid.
 04-06-16  Two small memory leak problems were fixed.
-04-06-15  A bug in ${var/pattern/"string"} which occured when string
+04-06-15  A bug in ${var/pattern/"string"} which occurred when string
          contained pattern matching characters has been fixed.
 04-05-08  printf $'%d produced an erroneous error message and has
          been fixed.
@@ -492,7 +525,7 @@
 03-12-05  On some systems, if the KEYBD trap is set, then commands that use
          the meta key were not processed until return was hit.  This
          has been fixed.
-03-12-05  A problem which occured when the login shell was not a group
+03-12-05  A problem which occurred when the login shell was not a group
          leader that could cause it to fail has been fixed.
 03-12-05  A problem in which a shell could core dump after receiving a signal
          that should cause it to terminate while it was in the process
@@ -546,7 +579,7 @@
          used inside ${...} has been fixed.
 03-07-15  An error in which expanding an indexed array inside a compound
          variable could cause a core dump has been fixed.
-03-07-15  A bug in which under on rare ocassions a job completion interrupt
+03-07-15  A bug in which under on rare occassions a job completion interrupt
          could cause to core dump has been fixed.
 03-06-26  A bug in which process substitution embedded within command
          substitution would generate a syntax error has been fixed.
@@ -1575,6 +1608,39 @@
 <P><HR><CENTER><FONT color=red><FONT face=courier><H3><A name="libast 
changes">libast changes</A></H3></FONT></FONT></CENTER>
 <PRE>
 
+06-10-31 disc/sfdcseekable.c: add SFSK_DISCARD for seekable window control
+06-10-31 comp/spawnveg.c,features/lib: handle posix_spawn exit status 127
+06-10-30 features/lib: fix posix_spawn() fork() prototype conflicts
+06-10-30 string/fmtscale.c: fix 1024 rounding bugs
+06-10-27 disc/sfkeyprintf.c: handle 'i' (=='d') -- oops
+06-10-26 sfio/sfvprintf.c: %#d =&gt; fmtscale(1000), %#i =&gt; fmtscale(1024)
+06-10-26 features/map.c: _map_libc cleanup
+06-10-26 features/fcntl: add to the circle of trust
+06-10-26 features/sys: add &lt;sys/socket.h&gt; socklen_t
+06-10-26 include/regex.h: handle include before &lt;ast_map.h&gt;
+06-10-25 astconf "SHELL" =&gt; "SH" to avoid _POSIX_SHELL conflict
+06-10-25 comp/conf.*: drop no-op duplicate conftab.c entries
+06-10-18 string/fmtscale.c: 1000: n&#0091;.&#0093;n&#0091;n&#0093;(kMGTPE), 
1024: n&#0091;.&#0093;n&#0091;n&#0093;(KMGTPE)i
+06-10-11 ast_std.h: now implies &lt;sys/stat.h&gt; (did on most before anyway)
+06-10-11 strtoi.h: ignore sign for 0, validate scale shift
+06-10-11 strdup.c,vmstrdup.c: handle 0 arg
+06-10-11 add sfstruse()/sfstropen() error checks
+06-10-10 misc/procopen.c: envv==environ =&gt; don't modify environ
+06-10-10 misc/procclose.c: return valid exit(1) status
+06-10-06 port/astconf.c,comp/conf.sh,comp/conf.tab: play nice with getconf(1)
+06-10-01 comp/conf.tab: SHELL default checks { _CS_PATH } X { ksh ksh93 sh }
+06-10-01 comp/conf.sh: export CONF_getconf to shell actions
+06-10-01 comp/putenv.c: always enable setenv() for procopen()
+06-10-01 misc/procopen.c: use pathshell() or astconf("SHELL",0,0) if PARANOID
+06-10-01 path/pathshell.c: localize the shell path patterns and accept ksh93
+06-09-28 Makefile: avoid ast &lt;stdio.h&gt; vix iffe -X ast -- doh
+06-09-27 regex/regdecomp.c: add
+06-09-26 regex/regcomp.c: handle KRE ~(...)&lt;invalid-kre&gt;
+06-09-25 reorganize to avoid native header intercepts
+06-09-15 uwin/crypt.c: _UWIN only!
+06-09-14 Makefile: tweak the ast_common.h bootstrap again (finally?)
+06-09-14 misc/optget.c: noncommercial =&gt; OPT_proprietary
+06-09-12 string/strelapsed.c: fix multi-char qualifier parse
 06-09-12 string/strtoi.h: drop &#0091;cClLqQwW&#0093; multipliers
 06-09-11 misc/optget.c: add numeric arg validity check
 06-09-07 misc/optget.c,tm/tmfix.c: fix uninitialzed var refs
@@ -2917,6 +2983,22 @@
 <P><HR><CENTER><FONT color=red><FONT face=courier><H3><A name="libcmd 
changes">libcmd changes</A></H3></FONT></FONT></CENTER>
 <PRE>
 
+06-10-31 global edit to eliminate most non-const static data0
+06-10-31 use &lt;cmd.h&gt; for all b_*() implementations; drop 
&lt;cmdlib.h&gt; 
+06-10-31 cmd.h: add CMD_ prefix to { BUILTIN DYNAMIC STANDALONE } 
+06-10-31 join.c: tone down /tmp usage vi SFSK_DISCARD
+06-10-31 cp.c,rm.c: update to &lt;fts.h&gt; to accomodate non-static data
+06-10-29 date.c: "...%H%..." =&gt; "...%H" "%..." to avoid SCCS conflict
+06-10-26 fds.c: handle sctp
+06-10-18 tail.c: fix invalid suffix infinite loop
+06-10-11 chgrp.c,cp.c: add sfstruse() error checks
+06-10-10 tee.c: add --linebuffer, -l
+06-10-06 getconf.c: preserve native getconf(1) known variable behavior
+06-10-04 sync.c: add (thanks to Roland Mainz)
+06-10-04 getconf.c: add -v specification =&gt; run native getconf(1)
+06-09-28 stty.c: static setmode() =&gt; set() for darwin.i386
+06-09-27 head.c: handle -1c =&gt; -c1
+06-09-19 pathchk.c: pathconf() =&gt; astconf()
 06-09-11 tail.c: handle compatibility corner cases
 06-09-08 date.c: add output write error diagnostic
 06-09-04 tail.c: fix initial position for -n0, no args =&gt; no -f
@@ -3105,6 +3187,7 @@
 <P><HR><CENTER><FONT color=red><FONT face=courier><H3><A name="libdll 
changes">libdll changes</A></H3></FONT></FONT></CENTER>
 <PRE>
 
+06-10-11 dllscan.c: check sfstruse() return values -- doh
 06-01-25 dllplug.c: add errorf() library message for dlopen() error
 05-02-14 dllscan.c: "" || "-" =&gt; NiL
 04-10-01 dllfind.c: drop ksh "builtin" workaround
@@ -3151,7 +3234,7 @@
 <TR>
 <TD align=left></TD>
 <TD align=center></TD>
-<TD align=right>September 13, 2006</TD>
+<TD align=right>November 02, 2006</TD>
 </TR>
 </TABLE>
 <P>
diff -r -N -u ksh93_2006_09_12/lib/package/ast-ksh.README 
ksh93_2006_10_31/lib/package/ast-ksh.README
--- ksh93_2006_09_12/lib/package/ast-ksh.README 2006-09-13 06:38:14.000000000 
+0200
+++ ksh93_2006_10_31/lib/package/ast-ksh.README 2006-11-02 20:53:59.000000000 
+0100
@@ -74,6 +74,9 @@
   (4) If the bin/package script does not exist then manually read the INIT
       source package:
                gunzip < lib/package/tgz/INIT.YYYY-MM-DD.tgz | tar xvf -
+      Note that some browsers automatically unzip downloaded without warning.
+      If the gunzip fails try:
+               tar xvf - lib/package/tgz/INIT.YYYY-MM-DD.tgz
       If your system does not have tar(1) or gunzip(1) then download the ratz
       source package, compile it, and manually read the INIT
       source package:
@@ -89,12 +92,45 @@
 
 :::::::: ksh93 ::::::::
 
-06-09-08  --- Release ksh93s-  ---
-06-09-97  The -a option was added to typeset for indexed arrays.  This
+06-10-30  --- Release ksh93s-  ---
+06-10-30  The redirections <# pattern, and <## pattern have been added.
+         Both seek forward to the beginning of the next line that contains
+         the pattern.  The <## form copies the skipped portion to standard
+         output.
+06-10-26  On systems that support stream control transport, the virtual file
+         name /dev/sctp/host/port can now be used to establish connections.
+06-10-26  The printf modifier # when used with d produces units in thousands
+         with a single letter suffix added.  The modifier # when used with
+         the i specification provides units of 1024 with a two letter suffix.
+06-10-24  The value of $! is now set to the process id of a job put
+         into the background with the bg command as required by POSIX.
+06-10-23  A bug in which the value of $! was affected by a background
+         job started from a subshell has been fixed.
+06-10-23  A bug in ${var:offset:len} in multibyte locales has been fixed.
+06-10-15  The remaining math functions from C99 were added for any system
+         that supports them.
+06-10-12  A bug when skipping over `...` with ${x:=`...`} when x is set
+         has been fixed.
+06-10-11  A bug in process floating constants produced by the %a format
+         of printf has been fixed.
+06-10-06  A bug in which IFS was not being restored correctly in some
+         cases after a subshell has been fixed.
+06-10-06  A bug in which pipefail was not detecting some failures in
+         pipelines with 3 or more states has been fixed.
+06-10-03  A bug in the processing of >(...) with builtins which could
+         cause the builtin to hang has been fixed.
+06-10-03  A bug in the for loop optimizer which causes >(...) process
+         substitution to be ignored has been fixed.
+06-09-17  The -a option was added to typeset for indexed arrays.  This
          is only needed when using the ([subscript]=value ...) form.
+06-09-06  The showme option was added.  Each simple command not beginning
+         with a redirection and not occurring with in the while, until, if,
+         select condition can be preceded by a semi-colon which will
+         be ignored when showme is off.  When showme is on, any command
+         preceded by a colon will be traced but not executed.
 06-08-16  As a new feature, a leading ~(N) on a pattern has no effect 
          except when used for file expansion.  In this case if not
-         matches are found, the pattern is replaced by nothing rathern
+         matches are found, the pattern is replaced by nothing rather
          than itself.
 06-08-11  A bug in the expansion of ${.sh.match[i]:${#.shmatch[i]}} has
          been fixed.
@@ -128,7 +164,7 @@
 06-06-13  Internal change to use ordering for variables instead of hashing
          to speed up prefix matching.
 06-06-13  A window between fork/exec in which a signal could get lost
-         and cause a peogram to hang has been eliminated
+         and cause a program to hang has been eliminated
 06-06-13  A bug in edit completion with quoted strings has been fixed.
 06-06-07  The restricted options can now be enabled by set as well as on
          the command line.  Once set, it can not be disabled.
@@ -140,7 +176,7 @@
           and ksh88 when the stty lnext is control-v.  The sequence
          escape-control-v will display the shell version.
 06-05-31  Modified emacs and vi mode so that entering a TAB after a partial
-         TAB conpletion, generates a listing of possible completions.
+         TAB completion, generates a listing of possible completions.
          After the second TAB, a number followed by a TAB will perform
          the completion with the corresponding item.
 06-05-19  Modified arithmetic so that conversions to strings default to
@@ -183,7 +219,7 @@
 05-12-07  The aliases for integer and float have been changed to use attributes
          -li and -lE to handle long long and long double types.
 05-12-07  The histexpand (-H) option has been added which allows C-shell
-         style history expansios using the history character !.
+         style history expansions using the history character !.
 05-12-07  The multiline option was added which changes that way the edit
          modes handle lines longer than the window width.  Instead of
          horizontal scrolling, multiple lines on the screen are used.
@@ -333,7 +369,7 @@
          an integral number of seconds, for example even -t 'sin(.5)'
          is now valid.
 04-06-16  Two small memory leak problems were fixed.
-04-06-15  A bug in ${var/pattern/"string"} which occured when string
+04-06-15  A bug in ${var/pattern/"string"} which occurred when string
          contained pattern matching characters has been fixed.
 04-05-08  printf $'%d\n' produced an erroneous error message and has
          been fixed.
@@ -389,7 +425,7 @@
 03-12-05  On some systems, if the KEYBD trap is set, then commands that use
          the meta key were not processed until return was hit.  This
          has been fixed.
-03-12-05  A problem which occured when the login shell was not a group
+03-12-05  A problem which occurred when the login shell was not a group
          leader that could cause it to fail has been fixed.
 03-12-05  A problem in which a shell could core dump after receiving a signal
          that should cause it to terminate while it was in the process
@@ -443,7 +479,7 @@
          used inside ${...} has been fixed.
 03-07-15  An error in which expanding an indexed array inside a compound
          variable could cause a core dump has been fixed.
-03-07-15  A bug in which under on rare ocassions a job completion interrupt
+03-07-15  A bug in which under on rare occassions a job completion interrupt
          could cause to core dump has been fixed.
 03-06-26  A bug in which process substitution embedded within command
          substitution would generate a syntax error has been fixed.
@@ -1469,6 +1505,39 @@
 
 :::::::: libast ::::::::
 
+06-10-31 disc/sfdcseekable.c: add SFSK_DISCARD for seekable window control
+06-10-31 comp/spawnveg.c,features/lib: handle posix_spawn exit status 127
+06-10-30 features/lib: fix posix_spawn() fork() prototype conflicts
+06-10-30 string/fmtscale.c: fix 1024 rounding bugs
+06-10-27 disc/sfkeyprintf.c: handle 'i' (=='d') -- oops
+06-10-26 sfio/sfvprintf.c: %#d => fmtscale(1000), %#i => fmtscale(1024)
+06-10-26 features/map.c: _map_libc cleanup
+06-10-26 features/fcntl: add to the circle of trust
+06-10-26 features/sys: add <sys/socket.h> socklen_t
+06-10-26 include/regex.h: handle include before <ast_map.h>
+06-10-25 astconf "SHELL" => "SH" to avoid _POSIX_SHELL conflict
+06-10-25 comp/conf.*: drop no-op duplicate conftab.c entries
+06-10-18 string/fmtscale.c: 1000: n[.]n[n](kMGTPE), 1024: n[.]n[n](KMGTPE)i
+06-10-11 ast_std.h: now implies <sys/stat.h> (did on most before anyway)
+06-10-11 strtoi.h: ignore sign for 0, validate scale shift
+06-10-11 strdup.c,vmstrdup.c: handle 0 arg
+06-10-11 add sfstruse()/sfstropen() error checks
+06-10-10 misc/procopen.c: envv==environ => don't modify environ
+06-10-10 misc/procclose.c: return valid exit(1) status
+06-10-06 port/astconf.c,comp/conf.sh,comp/conf.tab: play nice with getconf(1)
+06-10-01 comp/conf.tab: SHELL default checks { _CS_PATH } X { ksh ksh93 sh }
+06-10-01 comp/conf.sh: export CONF_getconf to shell actions
+06-10-01 comp/putenv.c: always enable setenv() for procopen()
+06-10-01 misc/procopen.c: use pathshell() or astconf("SHELL",0,0) if PARANOID
+06-10-01 path/pathshell.c: localize the shell path patterns and accept ksh93
+06-09-28 Makefile: avoid ast <stdio.h> vix iffe -X ast -- doh
+06-09-27 regex/regdecomp.c: add
+06-09-26 regex/regcomp.c: handle KRE ~(...)<invalid-kre>
+06-09-25 reorganize to avoid native header intercepts
+06-09-15 uwin/crypt.c: _UWIN only!
+06-09-14 Makefile: tweak the ast_common.h bootstrap again (finally?)
+06-09-14 misc/optget.c: noncommercial => OPT_proprietary
+06-09-12 string/strelapsed.c: fix multi-char qualifier parse
 06-09-12 string/strtoi.h: drop [cClLqQwW] multipliers
 06-09-11 misc/optget.c: add numeric arg validity check
 06-09-07 misc/optget.c,tm/tmfix.c: fix uninitialzed var refs
@@ -2808,6 +2877,22 @@
 
 :::::::: libcmd ::::::::
 
+06-10-31 global edit to eliminate most non-const static data0
+06-10-31 use <cmd.h> for all b_*() implementations; drop <cmdlib.h> 
+06-10-31 cmd.h: add CMD_ prefix to { BUILTIN DYNAMIC STANDALONE } 
+06-10-31 join.c: tone down /tmp usage vi SFSK_DISCARD
+06-10-31 cp.c,rm.c: update to <fts.h> to accomodate non-static data
+06-10-29 date.c: "...%H%..." => "...%H" "%..." to avoid SCCS conflict
+06-10-26 fds.c: handle sctp
+06-10-18 tail.c: fix invalid suffix infinite loop
+06-10-11 chgrp.c,cp.c: add sfstruse() error checks
+06-10-10 tee.c: add --linebuffer, -l
+06-10-06 getconf.c: preserve native getconf(1) known variable behavior
+06-10-04 sync.c: add (thanks to Roland Mainz)
+06-10-04 getconf.c: add -v specification => run native getconf(1)
+06-09-28 stty.c: static setmode() => set() for darwin.i386
+06-09-27 head.c: handle -1c => -c1
+06-09-19 pathchk.c: pathconf() => astconf()
 06-09-11 tail.c: handle compatibility corner cases
 06-09-08 date.c: add output write error diagnostic
 06-09-04 tail.c: fix initial position for -n0, no args => no -f
@@ -2993,6 +3078,7 @@
 
 :::::::: libdll ::::::::
 
+06-10-11 dllscan.c: check sfstruse() return values -- doh
 06-01-25 dllplug.c: add errorf() library message for dlopen() error
 05-02-14 dllscan.c: "" || "-" => NiL
 04-10-01 dllfind.c: drop ksh "builtin" workaround
diff -r -N -u ksh93_2006_09_12/lib/package/ast-ksh.ver 
ksh93_2006_10_31/lib/package/ast-ksh.ver
--- ksh93_2006_09_12/lib/package/ast-ksh.ver    2006-09-13 06:38:10.000000000 
+0200
+++ ksh93_2006_10_31/lib/package/ast-ksh.ver    2006-10-30 19:09:26.000000000 
+0100
@@ -1 +1 @@
-ast-ksh 2006-09-12 2006-09-12 1
+ast-ksh 2006-10-31 2006-10-31 1
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/bltins/mkservice.c 
ksh93_2006_10_31/src/cmd/ksh93/bltins/mkservice.c
--- ksh93_2006_09_12/src/cmd/ksh93/bltins/mkservice.c   2006-02-16 
04:49:53.000000000 +0100
+++ ksh93_2006_10_31/src/cmd/ksh93/bltins/mkservice.c   2006-10-26 
20:00:10.000000000 +0200
@@ -26,7 +26,7 @@
  */
 
 static const char mkservice_usage[] =
-"[-?\n@(#)$Id: mkservice (AT&T Labs Research) 2001-06-13 $\n]"
+"[-?\n@(#)$Id: mkservice (AT&T Research) 2001-06-13 $\n]"
 USAGE_LICENSE
 "[+NAME? mkservice - create a shell server ]"
 "[+DESCRIPTION?\bmkservice\b creates a tcp or udp server that is "
@@ -67,7 +67,7 @@
 
 
 static const char eloop_usage[] =
-"[-?\n@(#)$Id: eloop (AT&T Labs Research) 2001-06-13 $\n]"
+"[-?\n@(#)$Id: eloop (AT&T Research) 2001-06-13 $\n]"
 USAGE_LICENSE
 "[+NAME? eloop - process event loop]"
 "[+DESCRIPTION?\beloop\b causes the shell to block waiting for events "
@@ -86,9 +86,10 @@
 ;
 
 
+#include       "defs.h"
+
 #include       <cmd.h>
 #include       <error.h>
-#include       <shell.h>
 #include       <nval.h>
 #include       <sys/socket.h>
 #include       <netinet/in.h>
@@ -127,7 +128,6 @@
 static short           *file_list;
 static Sfio_t          **poll_list;
 static Service_t       **service_list;
-static int             max_fd;
 static int             npoll;
 static int             nready;
 static int             ready;
@@ -186,8 +186,8 @@
        Service_t * sp = service_list[fd];
        if(fd==sp->fd)  /* connection socket */
        {
-               struct sockaddr_in addr;
-               int addrlen = sizeof(addr);
+               struct sockaddr addr;
+               socklen_t addrlen = sizeof(addr);
                fd = accept(fd, &addr, &addrlen);
                service_list[fd] = sp;
                sp->refcount++;
@@ -262,10 +262,6 @@
 
 static int service_init(void)
 {
-       int n =  sysconf(_SC_OPEN_MAX);
-       if(n < 0)
-               n = OPEN_MAX;
-       max_fd = n;
        file_list =  newof(NULL,short,n,0);
        poll_list =  newof(NULL,Sfio_t*,n,0);
        service_list =  newof(NULL,Service_t*,n,0);
@@ -385,7 +381,7 @@
        if (!val)
        {
                register int i;
-               for(i=0; i< max_fd; i++)
+               for(i=0; i< sh.lim.open_max; i++)
                {
                        if(service_list[i]==sp)
                        {
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/bltins/print.c 
ksh93_2006_10_31/src/cmd/ksh93/bltins/print.c
--- ksh93_2006_09_12/src/cmd/ksh93/bltins/print.c       2006-08-25 
17:39:25.000000000 +0200
+++ ksh93_2006_10_31/src/cmd/ksh93/bltins/print.c       2006-10-13 
22:16:05.000000000 +0200
@@ -144,6 +144,7 @@
 {
        struct print prdata;
        NOT_USED(argc);
+       memset(&prdata,0,sizeof(prdata));
        prdata.sh = (Shell_t*)extra;
        prdata.options = sh_optprintf;
        return(b_print(-1,argv,&prdata));
@@ -161,7 +162,7 @@
        register Shell_t *shp = (Shell_t*)extra;
        const char *options, *msg = e_file+4;
        char *format = 0;
-       int sflag = 0, nflag, rflag;
+       int sflag = 0, nflag=0, rflag=0;
        if(argc>0)
        {
                options = sh_optprint;
@@ -296,10 +297,8 @@
                /* printf style print */
                Sfio_t *pool;
                struct printf pdata;
-               pdata.sh = shp;
-               pdata.err = 0;
-               pdata.cescape = 0;
                memset(&pdata, 0, sizeof(pdata));
+               pdata.sh = shp;
                pdata.hdr.version = SFIO_VERSION;
                pdata.hdr.extf = extend;
                pdata.nextarg = argv;
@@ -755,10 +754,13 @@
                value->s = sh_fmtqf(value->s, !!(fe->flags & SFFMT_ALTER), 
fold);
                break;
        case 'P':
-               value->s = fmtmatch(value->s);
-               if(*value->s==0)
+       {
+               char *s = fmtmatch(value->s);
+               if(!s || *s==0)
                        errormsg(SH_DICT,ERROR_exit(1),e_badregexp,value->s);
+               value->s = s;
                break;
+       }
        case 'R':
                value->s = fmtre(value->s);
                if(*value->s==0)
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/bltins/shopen.c 
ksh93_2006_10_31/src/cmd/ksh93/bltins/shopen.c
--- ksh93_2006_09_12/src/cmd/ksh93/bltins/shopen.c      2001-10-29 
23:52:25.000000000 +0100
+++ ksh93_2006_10_31/src/cmd/ksh93/bltins/shopen.c      2006-10-13 
05:58:32.000000000 +0200
@@ -18,7 +18,7 @@
 *                                                                      *
 ***********************************************************************/
 
-static const char id[] = "\n@(#)$Id: open (AT&T Labs) 1998-07-07 $\0\n";
+static const char id[] = "\n@(#)$Id: open (AT&T Research) 1998-07-07 $\0\n";
 
 #include       <sys/stat.h>
 #include       <fcntl.h>
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/bltins/test.c 
ksh93_2006_10_31/src/cmd/ksh93/bltins/test.c
--- ksh93_2006_09_12/src/cmd/ksh93/bltins/test.c        2006-07-29 
04:20:00.000000000 +0200
+++ ksh93_2006_10_31/src/cmd/ksh93/bltins/test.c        2006-10-12 
16:47:50.000000000 +0200
@@ -40,15 +40,10 @@
 #include       "FEATURE/poll"
 #include       <tmx.h>
 
-#ifndef _lib_setregid
+#if !_lib_setregid
 #   undef _lib_setreuid
 #endif /* _lib_setregid */
 
-#ifdef _lib_setreuid
-    extern int setreuid(uid_t,uid_t);
-    extern int setregid(uid_t,uid_t);
-#endif /* _lib_setreuid */
-
 #ifdef S_ISSOCK
 #   if _pipe_socketpair
 #       if _socketpair_shutdown_mode
@@ -250,13 +245,13 @@
        register int op;
        char *binop;
        arg=nxtarg(tp,0);
-       if(c_eq(arg, '!'))
+       if(arg && c_eq(arg, '!'))
                return(!e3(tp));
        if(c_eq(arg, '('))
        {
                op = expr(tp,1);
                cp = nxtarg(tp,0);
-               if(!c_eq(cp, ')'))
+               if(!cp || !c_eq(cp, ')'))
                        errormsg(SH_DICT,ERROR_exit(2),e_missing,"')'");
                return(op);
        }
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/bltins/trap.c 
ksh93_2006_10_31/src/cmd/ksh93/bltins/trap.c
--- ksh93_2006_09_12/src/cmd/ksh93/bltins/trap.c        2005-06-01 
06:28:23.000000000 +0200
+++ ksh93_2006_10_31/src/cmd/ksh93/bltins/trap.c        2006-10-12 
16:36:53.000000000 +0200
@@ -306,6 +306,7 @@
        {
                /* print the traps */
                register char *trap,*sname,**trapcom;
+               char name[6];
                sig = shp->st.trapmax;
                /* use parent traps if otrapcom is set (for $(trap)  */
                trapcom = (shp->st.otrapcom?shp->st.otrapcom:shp->st.trapcom);
@@ -315,6 +316,7 @@
                                continue;
                        if(!(sname=(char*)names[sig+1]))
                        {
+                               sname = name;
                                sname[0] = 'S';
                                sname[1] = 'I';
                                sname[2] = 'G';
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/data/builtins.c 
ksh93_2006_10_31/src/cmd/ksh93/data/builtins.c
--- ksh93_2006_09_12/src/cmd/ksh93/data/builtins.c      2006-09-05 
03:26:57.000000000 +0200
+++ ksh93_2006_10_31/src/cmd/ksh93/data/builtins.c      2006-10-27 
21:10:30.000000000 +0200
@@ -100,7 +100,7 @@
        "jobs",         NV_BLTIN|BLT_ENV,               bltin(jobs),
 #endif /* JOBS */
        "false",        NV_BLTIN|BLT_ENV,               bltin(false),
-       "getconf",      NV_BLTIN|BLT_ENV,               bltin(getconf),
+       "/bin/getconf", NV_BLTIN|BLT_ENV,               bltin(getconf),
        "getopts",      NV_BLTIN|BLT_ENV,               bltin(getopts),
        "print",        NV_BLTIN|BLT_ENV,               bltin(print),
        "printf",       NV_BLTIN|NV_NOFREE,             bltin(printf),
@@ -132,28 +132,13 @@
        "/bin/dirname", NV_BLTIN|NV_NOFREE,             bltin(dirname),
        "/bin/head",    NV_BLTIN|NV_NOFREE,             bltin(head),
        "/bin/mkdir",   NV_BLTIN|NV_NOFREE,             bltin(mkdir),
-#   if defined(_usr_bin_logname)  && !defined(_bin_logname)
-       "/usr/bin/logname",     NV_BLTIN|NV_NOFREE,     bltin(logname),
-#   else
        "/bin/logname", NV_BLTIN|NV_NOFREE,             bltin(logname),
-#   endif
        "/bin/cat",     NV_BLTIN|NV_NOFREE,             bltin(cat),
        "/bin/cmp",     NV_BLTIN|NV_NOFREE,             bltin(cmp),
-#   if defined(_usr_bin_cut)  && !defined(_bin_cut)
-       "/usr/bin/cut", NV_BLTIN|NV_NOFREE,             bltin(cut),
-#   else
        "/bin/cut",     NV_BLTIN|NV_NOFREE,             bltin(cut),
-#   endif
        "/bin/uname",   NV_BLTIN|NV_NOFREE,             bltin(uname),
-#   if defined(_usr_bin_wc)  && !defined(_bin_wc)
-       "/usr/bin/wc",  NV_BLTIN|NV_NOFREE,             bltin(wc),
-#   else
-#      if defined(_usr_ucb_wc)  && !defined(_bin_wc)
-          "/usr/ucb/wc", NV_BLTIN|NV_NOFREE,           bltin(wc),
-#      else
-          "/bin/wc",   NV_BLTIN|NV_NOFREE,             bltin(wc),
-#      endif
-#   endif
+       "/bin/wc",      NV_BLTIN|NV_NOFREE,             bltin(wc),
+       "/bin/sync",    NV_BLTIN|NV_NOFREE,             bltin(sync),
 #endif
        "",             0, 0 
 };
@@ -282,7 +267,7 @@
 ;
 
 const char sh_optbreak[] =
-"[-1c?\n@(#)$Id: break (AT&T Labs Research) 1999-04-07 $\n]"
+"[-1c?\n@(#)$Id: break (AT&T Research) 1999-04-07 $\n]"
 USAGE_LICENSE
 "[+NAME?break - break out of loop ]"
 "[+DESCRIPTION?\bbreak\b is a shell special built-in that exits the "
@@ -300,7 +285,7 @@
 ;
 
 const char sh_optcont[] =
-"[-1c?\n@(#)$Id: continue (AT&T Labs Research) 1999-04-07 $\n]"
+"[-1c?\n@(#)$Id: continue (AT&T Research) 1999-04-07 $\n]"
 USAGE_LICENSE
 "[+NAME?continue - continue execution at top of the loop]"
 "[+DESCRIPTION?\bcontinue\b is a shell special built-in that continues " 
@@ -319,7 +304,7 @@
 
 const char sh_optalarm[]       = "r [varname seconds]";
 const char sh_optalias[] =
-"[-1c?\n@(#)$Id: alias (AT&T Labs Research) 1999-07-07 $\n]"
+"[-1c?\n@(#)$Id: alias (AT&T Research) 1999-07-07 $\n]"
 USAGE_LICENSE
 "[+NAME?alias - define or display aliases]"
 "[+DESCRIPTION?\balias\b creates or redefines alias definitions "
@@ -361,7 +346,7 @@
 ;
 
 const char sh_optbuiltin[] =
-"[-1c?\n@(#)$Id: builtin (AT&T Labs Research) 1999-07-10 $\n]"
+"[-1c?\n@(#)$Id: builtin (AT&T Research) 1999-07-10 $\n]"
 USAGE_LICENSE
 "[+NAME?builtin - add, delete, or display shell built-ins]"
 "[+DESCRIPTION?\bbuiltin\b can be used to add, delete, or display "
@@ -414,7 +399,7 @@
 ;
 
 const char sh_optcd[] =
-"[-1c?\n@(#)$Id: cd (AT&T Labs Research) 1999-06-05 $\n]"
+"[-1c?\n@(#)$Id: cd (AT&T Research) 1999-06-05 $\n]"
 USAGE_LICENSE
 "[+NAME?cd - change working directory ]"
 "[+DESCRIPTION?\bcd\b changes the current working directory of the "
@@ -467,7 +452,7 @@
 ;
 
 const char sh_optcommand[] =
-"[-1c?\n@(#)$Id: command (AT&T Labs Research) 2003-08-01 $\n]"
+"[-1c?\n@(#)$Id: command (AT&T Research) 2003-08-01 $\n]"
 USAGE_LICENSE
 "[+NAME?command - execute a simple command]"
 "[+DESCRIPTION?Without \b-v\b or \b-V\b,  \bcommand\b executes \acommand\a "
@@ -503,7 +488,7 @@
 ;
 
 const char sh_optdot[]  =
-"[-1c?@(#)$Id: \b.\b (AT&T Labs Research) 2000-04-02 $\n]"
+"[-1c?@(#)$Id: \b.\b (AT&T Research) 2000-04-02 $\n]"
 USAGE_LICENSE
 "[+NAME?\b.\b - execute commands in the current environment]"
 "[+DESCRIPTION?\b.\b is a special built-in command that executes commands "
@@ -539,7 +524,7 @@
 #endif /* !ECHOPRINT */
 
 const char sh_opteval[] =
-"[-1c?\n@(#)$Id: eval (AT&T Labs Research) 1999-07-07 $\n]"
+"[-1c?\n@(#)$Id: eval (AT&T Research) 1999-07-07 $\n]"
 USAGE_LICENSE
 "[+NAME?eval - create a shell command and process it]"
 "[+DESCRIPTION?\beval\b is a shell special built-in command that constructs "
@@ -559,7 +544,7 @@
 ;
 
 const char sh_optexec[] =
-"[-1c?\n@(#)$Id: exec (AT&T Labs Research) 1999-07-10 $\n]"
+"[-1c?\n@(#)$Id: exec (AT&T Research) 1999-07-10 $\n]"
 USAGE_LICENSE
 "[+NAME?exec - execute command, open/close and duplicate file descriptors]"
 "[+DESCRIPTION?\bexec\b is a special built-in command that can be used to "
@@ -598,7 +583,7 @@
 
 
 const char sh_optexit[] =
-"[-1c?\n@(#)$Id: exit (AT&T Labs Research) 1999-07-07 $\n]"
+"[-1c?\n@(#)$Id: exit (AT&T Research) 1999-07-07 $\n]"
 USAGE_LICENSE
 "[+NAME?exit - exit the current shell]"
 "[+DESCRIPTION?\bexit\b is shell special built-in that causes the "
@@ -616,7 +601,7 @@
 ;
 
 const char sh_optexport[] =
-"[-1c?\n@(#)$Id: export (AT&T Labs Research) 1999-07-07 $\n]"
+"[-1c?\n@(#)$Id: export (AT&T Research) 1999-07-07 $\n]"
 USAGE_LICENSE
 "[+NAME?export - set export attribute on variables]"
 "[+DESCRIPTION?\bexport\b sets the export attribute on each of "
@@ -643,7 +628,7 @@
 ;
 
 const char sh_optgetopts[] =
-":[-1c?\n@(#)$Id: getopts (AT&T Labs Research) 2005-01-01 $\n]"
+":[-1c?\n@(#)$Id: getopts (AT&T Research) 2005-01-01 $\n]"
 "[-author?Glenn Fowler <gsf at research.att.com>]"
 USAGE_LICENSE
 "[+NAME?\f?\f - parse utility options]"
@@ -800,7 +785,7 @@
 ;
 
 const char sh_optbg[] =
-"[-1c?@(#)$Id: bg (AT&T Labs Research) 2000-04-02 $\n]"
+"[-1c?@(#)$Id: bg (AT&T Research) 2000-04-02 $\n]"
 USAGE_LICENSE
 "[+NAME?bg - resume jobs in the background]"
 "[+DESCRIPTION?\bbg\b places the given \ajob\as into the background "
@@ -829,7 +814,7 @@
 ;
 
 const char sh_optfg[] =
-"[-1c?@(#)$Id: fg (AT&T Labs Research) 2000-04-02 $\n]"
+"[-1c?@(#)$Id: fg (AT&T Research) 2000-04-02 $\n]"
 USAGE_LICENSE
 "[+NAME?fg - move jobs to the foreground]"
 "[+DESCRIPTION?\bfg\b places the given \ajob\as into the foreground "
@@ -858,7 +843,7 @@
 ;
 
 const char sh_optdisown[] =
-"[-1c?@(#)$Id: disown (AT&T Labs Research) 2000-04-02 $\n]"
+"[-1c?@(#)$Id: disown (AT&T Research) 2000-04-02 $\n]"
 USAGE_LICENSE
 "[+NAME?disown - disassociate a job with the current shell]"
 "[+DESCRIPTION?\bdisown\b prevents the current shell from sending "
@@ -887,7 +872,7 @@
 ;
 
 const char sh_optjobs[] =
-"[-1c?@(#)$Id: jobs (AT&T Labs Research) 2000-04-02 $\n]"
+"[-1c?@(#)$Id: jobs (AT&T Research) 2000-04-02 $\n]"
 USAGE_LICENSE
 "[+NAME?jobs - display status of jobs]"
 "[+DESCRIPTION?\bjobs\b displays information about specified \ajob\as "
@@ -926,7 +911,7 @@
 ;
 
 const char sh_opthist[]        = 
-"[-1c?@(#)$Id: hist (AT&T Labs Research) 2000-04-02 $\n]"
+"[-1c?@(#)$Id: hist (AT&T Research) 2000-04-02 $\n]"
 USAGE_LICENSE
 "[+NAME?\f?\f - process command history list]"
 "[+DESCRIPTION?\b\f?\f\b lists, edits, or re-executes, commands  "
@@ -994,7 +979,7 @@
 ;
 
 const char sh_optkill[]         = 
-"[-1c?\n@(#)$Id: kill (AT&T Labs Research) 1999-06-17 $\n]"
+"[-1c?\n@(#)$Id: kill (AT&T Research) 1999-06-17 $\n]"
 USAGE_LICENSE
 "[+NAME?kill - terminate or signal process]"
 "[+DESCRIPTION?With the first form in which \b-l\b is not specified, "
@@ -1051,7 +1036,7 @@
 ;
 
 const char sh_optlet[] =
-"[-1c?@(#)$Id: let (AT&T Labs Research) 2000-04-02 $\n]"
+"[-1c?@(#)$Id: let (AT&T Research) 2000-04-02 $\n]"
 USAGE_LICENSE
 "[+NAME?let - evaluate arithmetic expressions]"
 "[+DESCRIPTION?\blet\b evaluates each \aexpr\a in the current "
@@ -1074,7 +1059,7 @@
 ;
 
 const char sh_optprint[] =
-"[-1c?\n@(#)$Id: print (AT&T Labs Research) 1999-04-07 $\n]"
+"[-1c?\n@(#)$Id: print (AT&T Research) 1999-04-07 $\n]"
 USAGE_LICENSE
 "[+NAME?print - write arguments to standard output]"
 "[+DESCRIPTION?By default, \bprint\b writes each \astring\a operand to "
@@ -1125,7 +1110,7 @@
 ;
 
 const char sh_optprintf[] =
-"[-1c?\n@(#)$Id: printf (AT&T Labs Research) 1999-06-21 $\n]"
+"[-1c?\n@(#)$Id: printf (AT&T Research) 2006-10-26 $\n]"
 USAGE_LICENSE
 "[+NAME?printf - write formatted output]"
 "[+DESCRIPTION?\bprintf\b writes each \astring\a operand to "
@@ -1187,7 +1172,15 @@
                "character corresponding to the hexidecimal value \ahex\a.]"
        "[+-?Each of the integral format specifiers can have a third "
                "modifier after width and precision that specifies the "
-               "base of the conversion from 2 to 64.]"
+               "base of the conversion from 2 to 64.  In this case the "
+               "\b#\b modifier will cause \abase\a\b#\b to be prepended to "
+               "the value.]"
+       "[+-?The \b#\b modifier can be used with the \bd\b specifier when "
+               "no base is specified cause the output to be written in units "
+               "of \b1000\b with a suffix of one of \bk M G T P E\b.]"
+       "[+-?The \b#\b modifier can be used with the \bi\b specifier to "
+               "cause the output to be written in units of \b1024\b with "
+               "a suffix of one of \bKi Mi Gi Ti Pi Ei\b.]"
        "}"
 "[+?If there are more \astring\a operands than format specifiers, the "
        "\aformat\a string is reprocessed from the beginning.  If there are "
@@ -1208,7 +1201,7 @@
 ;
 
 const char sh_optpwd[] =
-"[-1c?\n@(#)$Id: pwd (AT&T Labs Research) 1999-06-07 $\n]"
+"[-1c?\n@(#)$Id: pwd (AT&T Research) 1999-06-07 $\n]"
 USAGE_LICENSE
 "[+NAME?pwd - write working directory name]"
 "[+DESCRIPTION?\bpwd\b writes an absolute pathname of the current working "
@@ -1232,7 +1225,7 @@
 ;
 
 const char sh_optread[] =
-"[-1c?\n@(#)$Id: read (AT&T Labs Research) 2003-05-19 $\n]"
+"[-1c?\n@(#)$Id: read (AT&T Research) 2003-05-19 $\n]"
 USAGE_LICENSE
 "[+NAME?read - read a line from standard input]"
 "[+DESCRIPTION?\bread\b reads a line from standard input and breaks it "
@@ -1276,7 +1269,7 @@
 ;
 
 const char sh_optreadonly[] =
-"[-1c?\n@(#)$Id: readonly (AT&T Labs Research) 1999-07-07 $\n]"
+"[-1c?\n@(#)$Id: readonly (AT&T Research) 1999-07-07 $\n]"
 USAGE_LICENSE
 "[+NAME?readonly - set readonly attribute on variables]"
 "[+DESCRIPTION?\breadonly\b sets the readonly attribute on each of "
@@ -1304,7 +1297,7 @@
 ;
 
 const char sh_optreturn[] =
-"[-1c?\n@(#)$Id: return (AT&T Labs Research) 1999-07-07 $\n]"
+"[-1c?\n@(#)$Id: return (AT&T Research) 1999-07-07 $\n]"
 USAGE_LICENSE
 "[+NAME?return - return from a function or dot script ]"
 "[+DESCRIPTION?\breturn\b is a shell special built-in that causes the "
@@ -1327,7 +1320,7 @@
 
 
 const char sh_optksh[] =
-"+[-1c?\n@(#)$Id: sh (AT&T Labs Research) "SH_RELEASE" $\n]"
+"+[-1c?\n@(#)$Id: sh (AT&T Research) "SH_RELEASE" $\n]"
 USAGE_LICENSE
 "[+NAME?\b\f?\f\b - Shell, the standard command language interpreter]"
 "[+DESCRIPTION?\b\f?\f\b is a command language interpreter that "
@@ -1401,7 +1394,7 @@
 "[+SEE ALSO?\bset\b(1), \bbuiltin\b(1)]"
 ;
 const char sh_optset[] =
-"+[-1c?\n@(#)$Id: set (AT&T Labs Research) 1999-09-28 $\n]"
+"+[-1c?\n@(#)$Id: set (AT&T Research) 1999-09-28 $\n]"
 USAGE_LICENSE
 "[+NAME?set - set/unset options and positional parameters]"
 "[+DESCRIPTION?\bset\b sets or unsets options and positional parameters.  "
@@ -1439,7 +1432,7 @@
 
 
 const char sh_optshift[] =
-"[-1c?\n@(#)$Id: shift (AT&T Labs Research) 1999-07-07 $\n]"
+"[-1c?\n@(#)$Id: shift (AT&T Research) 1999-07-07 $\n]"
 USAGE_LICENSE
 "[+NAME?shift - shift positional parameters]"
 "[+DESCRIPTION?\bshift\b is a shell special built-in that shifts the "
@@ -1462,7 +1455,7 @@
 ;
 
 const char sh_optsleep[] =
-"[-1c?\n@(#)$Id: sleep (AT&T Labs Research) 1999-04-07 $\n]"
+"[-1c?\n@(#)$Id: sleep (AT&T Research) 1999-04-07 $\n]"
 USAGE_LICENSE
 "[+NAME?sleep - suspend execution for an interval]"
 "[+DESCRIPTION?\bsleep\b suspends execution for at least the time specified "
@@ -1482,7 +1475,7 @@
 ;
 
 const char sh_opttrap[] =
-"[-1c?\n@(#)$Id: trap (AT&T Labs Research) 1999-07-17 $\n]"
+"[-1c?\n@(#)$Id: trap (AT&T Research) 1999-07-17 $\n]"
 USAGE_LICENSE
 "[+NAME?trap - trap signals and conditions]"
 "[+DESCRIPTION?\btrap\b is a special built-in that defines actions to be "
@@ -1535,7 +1528,7 @@
 ;
 
 const char sh_opttypeset[] =
-"+[-1c?\n@(#)$Id: typeset (AT&T Labs Research) 2003-01-15 $\n]"
+"+[-1c?\n@(#)$Id: typeset (AT&T Research) 2003-01-15 $\n]"
 USAGE_LICENSE
 "[+NAME?\f?\f - declare or display variables with attributes]"
 "[+DESCRIPTION?Without the \b-f\b option, \b\f?\f\b sets, unsets, "
@@ -1633,7 +1626,7 @@
 ;
 
 const char sh_optulimit[] =
-"[-1c?@(#)$Id: ulimit (AT&T Labs Research) 2003-06-21 $\n]"
+"[-1c?@(#)$Id: ulimit (AT&T Research) 2003-06-21 $\n]"
 USAGE_LICENSE
 "[+NAME?ulimit - set or display resource limits]"
 "[+DESCRIPTION?\bulimit\b sets or displays resource limits.  These "
@@ -1669,7 +1662,7 @@
 ;
 
 const char sh_optumask[] =
-"[-1c?\n@(#)$Id: umask (AT&T Labs Research) 1999-04-07 $\n]"
+"[-1c?\n@(#)$Id: umask (AT&T Research) 1999-04-07 $\n]"
 USAGE_LICENSE
 "[+NAME?umask - get or set the file creation mask]"
 "[+DESCRIPTION?\bumask\b sets the file creation mask of the current "
@@ -1696,7 +1689,7 @@
 ;
 const char sh_optuniverse[]    = " [name]";
 const char sh_optunset[] =
-"[-1c?\n@(#)$Id: unset (AT&T Labs Research) 1999-07-07 $\n]"
+"[-1c?\n@(#)$Id: unset (AT&T Research) 1999-07-07 $\n]"
 USAGE_LICENSE
 "[+NAME?unset - unset values and attributes of variables and functions]"
 "[+DESCRIPTION?For each \aname\a specified, \bunset\b  unsets the variable, "
@@ -1722,7 +1715,7 @@
 ;
 
 const char sh_optunalias[] =
-"[-1c?\n@(#)$Id: unalias (AT&T Labs Research) 1999-07-07 $\n]"
+"[-1c?\n@(#)$Id: unalias (AT&T Research) 1999-07-07 $\n]"
 USAGE_LICENSE
 "[+NAME?unalias - remove alias definitions]"
 "[+DESCRIPTION?\bunalias\b removes the definition of each named alias "
@@ -1744,7 +1737,7 @@
 ;
 
 const char sh_optwait[]        =
-"[-1c?\n@(#)$Id: wait (AT&T Labs Research) 1999-06-17 $\n]"
+"[-1c?\n@(#)$Id: wait (AT&T Research) 1999-06-17 $\n]"
 USAGE_LICENSE
 "[+NAME?wait - wait for process or job completion]"
 "[+DESCRIPTION?\bwait\b with no operands, waits until all jobs "
@@ -1785,7 +1778,7 @@
 #endif /* SHOPT_FS_3D */
 
 const char sh_optwhence[] =
-"[-1c?\n@(#)$Id: whence (AT&T Labs Research) 1999-07-07 $\n]"
+"[-1c?\n@(#)$Id: whence (AT&T Research) 1999-07-07 $\n]"
 USAGE_LICENSE
 "[+NAME?whence - locate a command and describe its type]"
 "[+DESCRIPTION?Without \b-v\b, \bwhence\b writes on standard output an "
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/data/math.tab 
ksh93_2006_10_31/src/cmd/ksh93/data/math.tab
--- ksh93_2006_09_12/src/cmd/ksh93/data/math.tab        1970-01-01 
01:00:00.000000000 +0100
+++ ksh93_2006_10_31/src/cmd/ksh93/data/math.tab        2006-10-19 
08:00:14.000000000 +0200
@@ -0,0 +1,64 @@
+# <return type: i:integer f:floating-point> <#floating-point-args> 
<function-name> [<alias> ...]
+# <function-name>l variants are handled by features/math.sh
+# @(#)math.tab (AT&T Research) 2006-10-18
+f 1 acos
+f 1 acosh
+f 1 asin
+f 1 asinh
+f 1 atan
+f 2 atan2
+f 1 atanh
+f 1 cbrt
+f 2 copysign
+f 1 cos
+f 1 cosh
+f 1 erf
+f 1 erfc
+f 1 exp
+f 1 exp2
+f 1 expm1
+f 1 fabs abs
+f 2 fdim
+f 1 finite
+f 1 floor int
+f 3 fma
+f 2 fmax
+f 2 fmin
+f 2 fmod
+i 1 fpclassify
+f 2 hypot
+i 1 ilogb
+i 1 isfinite
+i 2 isgreater
+i 2 isgreaterequal
+i 1 isinf
+i 2 isless
+i 2 islessequal
+i 2 islessgreater
+i 1 isnan
+i 1 isnormal
+i 1 issubnormal
+i 2 isunordered
+i 1 iszero
+f 1 lgamma
+f 1 log
+f 1 log1p
+f 1 log2
+f 1 logb
+f 1 nearbyint
+f 2 nextafter
+f 2 nexttoward
+f 2 pow
+f 2 remainder
+f 1 rint
+f 1 round
+f 1 scanb
+f 1 scanbn
+i 1 signbit
+f 1 sin
+f 1 sinh
+f 1 sqrt
+f 1 tan
+f 1 tanh
+f 1 tgamma
+f 1 trunc
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/data/strdata.c 
ksh93_2006_10_31/src/cmd/ksh93/data/strdata.c
--- ksh93_2006_09_12/src/cmd/ksh93/data/strdata.c       2006-06-26 
23:17:32.000000000 +0200
+++ ksh93_2006_10_31/src/cmd/ksh93/data/strdata.c       2006-10-24 
15:56:39.000000000 +0200
@@ -22,8 +22,8 @@
  * data for string evaluator library
  */
 
+#include       "FEATURE/isoc"
 #include       "FEATURE/options"
-#include       "FEATURE/math"
 #include       "streval.h"
 
 const unsigned char strval_precedence[35] =
@@ -84,7 +84,7 @@
 };
 
 
-const char e_argcount[]                = "%s: funcion has wrong number of 
arguments";
+const char e_argcount[]                = "%s: function has wrong number of 
arguments";
 const char e_badnum[]          = "%s: bad number";
 const char e_moretokens[]      = "%s: more tokens expected";
 const char e_paren[]           = "%s: unbalanced parenthesis";
@@ -101,416 +101,4 @@
 const char e_singularity[]     = "%s: singularity exception";
 const char e_charconst[]       = "%s: invalid character constant";
 
-#ifdef __NeXT
-extern double  hypot(double, double);
-#endif
-
-typedef Sfdouble_t (*mathf)(Sfdouble_t,...);
-typedef int (*mathif)(Sfdouble_t);
-
-#ifdef _ast_fltmax_double
-
-#   define     fabsl   fabs
-#   define     acosl   acos
-#   define     asinl   asin
-#   define     atanl   atan
-#   define     atan2l  atan2
-#   define     cosl    cos
-#   define     coshl   cosh
-#   define     expl    exp
-#   define     finitel finite
-#   define     fmodl   fmod
-#   define     hypotl  hypot
-#   define     isinfl  isinf
-#   define     isnanl  isnan
-#   define     isnormall       isnormal
-#   define     floorl  floor
-#   define     logl    log
-#   define     powl    pow
-#   define     sinl    sin
-#   define     sinhl   sinh
-#   define     sqrtl   sqrt
-#   define     tanl    tan
-#   define     tanhl   tanh
-
-#endif
-
-#ifdef __STDARG__
-#   define fundef(name)                static _ast_fltmax_t 
local_##name(_ast_fltmax_t d){ return(name(d));}
-#   define protodef(name)      extern _ast_fltmax_t name(_ast_fltmax_t);
-#   define macdef(name,x)      ((Sfdouble_t)name((double)(x)))
-#   define fundef2(name)       static _ast_fltmax_t local_##name(_ast_fltmax_t 
x, _ast_fltmax_t y){ return(name(x,y));}
-#   define protodef2(name)     extern _ast_fltmax_t 
name(_ast_fltmax_t,_ast_fltmax_t);
-#   define macdef2(name,x,y)   ((Sfdouble_t)name((double)(x),(double)(y)))
-#else
-#   define fundef(name)                static _ast_fltmax_t local_##name(d) 
_ast_fltmax_t d;{ return(name(d));}
-#   define protodef(name)      extern _ast_fltmax_t name();
-#   define macdef(name,x)      ((Sfdouble_t)name((double)(x)))
-#   define fundef2(name)       static _ast_fltmax_t local_##name(x,y) 
_ast_fltmax_t x,y;{ return(name(x,y));}
-#   define protodef2(name)     extern _ast_fltmax_t name();
-#   define macdef2(name,x,y)   ((Sfdouble_t)name((double)(x),(double)(y)))
-#endif
-
-#if 0 /* proto bug workaround */
-{
-#endif
-
-#if defined(acosl) || !_lib_acosl
-#   ifndef acosl
-#       define acosl(x) macdef(acos,x)
-#   endif
-    fundef(acosl)
-#   undef acosl
-#   define acosl local_acosl
-#else
-#   if _npt_acosl
-       protodef(acosl)
-#   endif
-#endif 
-
-#if defined(asinl) || !_lib_asinl
-#   ifndef asinl
-#       define asinl(x) macdef(asin,x)
-#   endif
-    fundef(asinl)
-#   undef asinl
-#   define asinl local_asinl
-#else
-#   if _npt_asinl
-       protodef(asinl)
-#   endif
-#endif 
-
-#if defined(atanl) || !_lib_atanl
-#   ifndef atanl
-#       define atanl(x) macdef(atan,x)
-#   endif
-    fundef(atanl)
-#   undef atanl
-#   define atanl local_atanl
-#else
-#   if _npt_atanl
-       protodef(atanl)
-#   endif
-#endif 
-
-#if defined(atan2l) || !_lib_atan2l
-#   ifndef atan2l
-#       define atan2l(x,y) macdef2(atan2,x,y)
-#   endif
-    fundef2(atan2l)
-#   undef atan2l
-#   define atan2l local_atan2l
-#else
-#   if _npt_atan2l
-       protodef2(atan2l)
-#   endif
-#endif 
-
-#if defined(expl) || !_lib_expl
-#   ifndef expl
-#       define expl(x) macdef(exp,x)
-#   endif
-    fundef(expl)
-#   undef expl
-#   define expl local_expl
-#else
-#   if _npt_expl
-       protodef(expl)
-#   endif
-#endif 
-
-#if defined(cosl) || !_lib_cosl
-#   ifndef cosl
-#       define cosl(x) macdef(cos,x)
-#   endif
-    fundef(cosl)
-#   undef cosl
-#   define cosl local_cosl
-#else
-#   if _npt_cosl
-       protodef(cosl)
-#   endif
-#endif 
-
-#if defined(coshl) || !_lib_coshl
-#   ifndef coshl
-#       define coshl(x) macdef(cosh,x)
-#   endif
-    fundef(coshl)
-#   undef coshl
-#   define coshl local_coshl
-#else
-#   if _npt_coshl
-       protodef(coshl)
-#   endif
-#endif 
-
-#if defined(hypotl) || !_lib_hypotl
-#   ifndef hypotl
-#       define hypotl(x,y) macdef2(hypot,x,y)
-#   endif
-    fundef2(hypotl)
-#   undef hypotl
-#   define hypotl local_hypotl
-#else
-#   if _npt_hypotl
-       protodef2(hypotl)
-#   endif
-#endif 
-
-#if defined(finitel) || !_lib_finitel
-#   ifndef finitel
-#       define finitel(x) macdef(finite,x)
-#   endif
-#   ifdef _lib_finitel
-       fundef(finitel)
-#   else
-#       ifdef __STDARG__
-       static int local_finitel(_ast_fltmax_t d)
-#       else
-       static int local_finitel(d)
-       _ast_fltmax_t d;
-#       endif
-       {
-#     if _lib_isfinite
-           return(isfinite(d));
-#     else
-#       if _lib_isinfl
-           return(!isinfl(d) && !isnan(d));
-#       else
-#         if _lib_isinf
-           return(!isinf(d) && !isnan(d));
-#         else
-           return(!isnan(d));
-#         endif
-#       endif
-#     endif
-       }
-#   endif
-#   undef finitel
-#   define finitel local_finitel
-#else
-#   if _npt_finitel
-       protodef(finitel)
-#   endif
-#endif 
-
-#if defined(floorl) || !_lib_floorl
-#   ifndef floorl
-#       define floorl(x) macdef(floor,x)
-#   endif
-    fundef(floorl)
-#   undef floorl
-#   define floorl local_floorl
-#else
-#   if _npt_floorl
-       protodef(floorl)
-#   endif
-#endif 
-
-#if defined(fmodl) || !_lib_fmodl
-#   ifndef fmodl
-#       define fmodl(x,y) macdef2(fmod,x,y)
-#   endif
-    fundef2(fmodl)
-#   undef fmodl
-#   define fmodl local_fmodl
-#else
-#   if _npt_fmodl
-       protodef2(fmodl)
-#   endif
-#endif 
-
-#if defined(isinfl) || !_lib_isinfl
-#   ifndef isinfl
-#       define isinfl(x) macdef(isinf,x)
-#   endif
-#   ifdef _lib_isinf
-       fundef(isinfl)
-#   else
-#       ifdef __STDARG__
-       static int local_isinfl(_ast_fltmax_t d)
-#       else
-       static int local_isinfl(d)
-       _ast_fltmax_t d;
-#       endif
-       { return(!finitel(d) && !isnan(d)); }
-#   endif
-#   undef isinfl
-#   define isinfl local_isinfl
-#else
-#   if _npt_isinfl
-       protodef(isinfl)
-#   endif
-#endif 
-
-#if defined(isnanl) || !_lib_isnanl
-#   ifndef isnanl
-#       define isnanl(x) macdef(isnan,x)
-#   endif
-    fundef(isnanl)
-#   undef isnanl
-#   define isnanl local_isnanl
-#else
-#   if _npt_isnanl
-       protodef(isnanl)
-#   endif
-#endif 
-
-#if defined(isnormall) || !_lib_isnormall
-#   ifndef isnormall
-#       define isnormall(x) macdef(isnormal,x)
-#   endif
-#   ifdef _lib_isnormal
-       fundef(isnormall)
-#   endif
-#   undef isnormall
-#   define isnormall local_isnormall
-#else
-#   if _npt_isnormall
-       protodef(isnormall)
-#   endif
-#endif 
-
-#if defined(logl) || !_lib_logl
-#   ifndef logl
-#       define logl(x) macdef(log,x)
-#   endif
-    fundef(logl)
-#   undef logl
-#   define logl local_logl
-#else
-#   if _npt_logl
-       protodef(logl)
-#   endif
-#endif 
-
-#if defined(sinl) || !_lib_sinl
-#   ifndef sinl
-#       define sinl(x) macdef(sin,x)
-#   endif
-    fundef(sinl)
-#   undef sinl
-#   define sinl local_sinl
-#else
-#   if _npt_sinl
-       protodef(sinl)
-#   endif
-#endif 
-
-#if defined(sinhl) || !_lib_sinhl
-#   ifndef sinhl
-#       define sinhl(x) macdef(sinh,x)
-#   endif
-    fundef(sinhl)
-#   undef sinhl
-#   define sinhl local_sinhl
-#else
-#   if _npt_sinhl
-       protodef(sinhl)
-#   endif
-#endif 
-
-#if defined(sqrtl) || !_lib_sqrtl
-#   ifndef sqrtl
-#       define sqrtl(x) macdef(sqrt,x)
-#   endif
-    fundef(sqrtl)
-#   undef sqrtl
-#   define sqrtl local_sqrtl
-#else
-#   if _npt_sqrtl
-       protodef(sqrtl)
-#   endif
-#endif 
-
-#if defined(tanl) || !_lib_tanl
-#   ifndef tanl
-#       define tanl(x) macdef(tan,x)
-#   endif
-    fundef(tanl)
-#   undef tanl
-#   define tanl local_tanl
-#else
-#   if _npt_tanl
-       protodef(tanl)
-#   endif
-#endif 
-
-#if defined(tanhl) || !_lib_tanhl
-#   ifndef tanhl
-#       define tanhl(x) macdef(tanh,x)
-#   endif
-    fundef(tanhl)
-#   undef tanhl
-#   define tanhl local_tanhl
-#else
-#   if _npt_tanhl
-       protodef(tanhl)
-#   endif
-#endif 
-
-#if defined(powl) || !_lib_powl
-#   ifndef powl
-#       define powl(x,y) macdef2(pow,x,y)
-#   endif
-    fundef2(powl)
-#   undef powl
-#   define powl local_powl
-#else
-#   if _npt_powl
-       protodef2(powl)
-#   endif
-#endif 
-
-#if defined(fabsl) || !_lib_fabsl
-#   ifndef fabsl
-#       define fabsl(x) macdef(fabs,x)
-#   endif
-    fundef(fabsl)
-#   undef fabsl
-#   define fabsl local_fabsl
-#else
-#   if _npt_fabsl
-       protodef(fabsl)
-#   endif
-#endif 
-
-#if 0 /* proto bug workaround */
-}
-#endif
-
-/*
- * first byte is two-digit octal number.  Last digit is number of args
- * first digit is 0 if return value is double, 1 for integer
- */
-const struct mathtab shtab_math[] =
-{
-       "\01abs",               (mathf)fabsl,
-       "\01acos",              (mathf)acosl,
-       "\01asin",              (mathf)asinl,
-       "\01atan",              (mathf)atanl,
-       "\02atan2",             (mathf)atan2l,
-       "\01cos",               (mathf)cosl,
-       "\01cosh",              (mathf)coshl,
-       "\01exp",               (mathf)expl,
-       "\011finite",           (mathf)finitel,
-       "\01floor",             (mathf)floorl,
-       "\02fmod",              (mathf)fmodl,
-       "\02hypot",             (mathf)hypotl,
-       "\01int",               (mathf)floorl,
-       "\011isinf",            (mathf)isinfl,
-       "\011isnan",            (mathf)isnanl,
-#ifdef _lib_isnormal
-       "\011isnormal",         (mathf)isnormall,
-#endif
-       "\01log",               (mathf)logl,
-       "\02pow",               (mathf)powl,
-       "\01sin",               (mathf)sinl,
-       "\01sinh",              (mathf)sinhl,
-       "\01sqrt",              (mathf)sqrtl,
-       "\01tan",               (mathf)tanl,    
-       "\01tanh",              (mathf)tanhl,
-       "",                     (mathf)0 
-};
+#include       "FEATURE/math"
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/data/testops.c 
ksh93_2006_10_31/src/cmd/ksh93/data/testops.c
--- ksh93_2006_09_12/src/cmd/ksh93/data/testops.c       2006-05-08 
23:06:23.000000000 +0200
+++ ksh93_2006_10_31/src/cmd/ksh93/data/testops.c       2006-10-13 
05:59:07.000000000 +0200
@@ -56,7 +56,7 @@
 };
 
 const char sh_opttest[] =
-"[-1c?\n@(#)$Id: test (AT&T Labs Research) 2003-03-18 $\n]"
+"[-1c?\n@(#)$Id: test (AT&T Research) 2003-03-18 $\n]"
 USAGE_LICENSE
 "[+NAME?test - evaluate expression]"
 "[+DESCRIPTION?\btest\b evaluates expressions and indicates its "
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/edit/edit.c 
ksh93_2006_10_31/src/cmd/ksh93/edit/edit.c
--- ksh93_2006_09_12/src/cmd/ksh93/edit/edit.c  2006-09-08 21:52:16.000000000 
+0200
+++ ksh93_2006_10_31/src/cmd/ksh93/edit/edit.c  2006-10-05 08:46:18.000000000 
+0200
@@ -739,7 +739,7 @@
                        ep->e_term = nv_search("TERM",sh.var_tree,0);
                if(ep->e_term && (term=nv_getval(ep->e_term)) && 
strlen(term)<sizeof(ep->e_termname) && strcmp(term,ep->e_termname))
                {
-                       sh_trap("eval .sh.subscript=$(infocmp -1C | sed -e 
'/:up=/!d' -e 's/.*:up=//' -e 's/:\\\\*$//' -e \"s/[']/\\'/g\" -e 
\"s/.*/$'&'/\")",0);
+                       sh_trap("eval .sh.subscript=$(infocmp -1C 2>/dev/null | 
sed -e '/:up=/!d' -e 's/.*:up=//' -e 's/:\\\\*$//' -e \"s/[']/\\'/g\" -e 
\"s/.*/$'&'/\")",0);
                        if(pp=nv_getval(SH_SUBSCRNOD))
                                strncpy(CURSOR_UP,pp,sizeof(CURSOR_UP)-1);
                        nv_unset(SH_SUBSCRNOD);
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/edit/history.c 
ksh93_2006_10_31/src/cmd/ksh93/edit/history.c
--- ksh93_2006_09_12/src/cmd/ksh93/edit/history.c       2006-07-14 
17:41:01.000000000 +0200
+++ ksh93_2006_10_31/src/cmd/ksh93/edit/history.c       2006-10-13 
20:00:12.000000000 +0200
@@ -185,7 +185,7 @@
        register History_t *hp;
        register char *histname;
        char *fname=0;
-       int histmask, maxlines, hist_start;
+       int histmask, maxlines, hist_start=0;
        register char *cp;
        register off_t hsize = 0;
 
@@ -837,6 +837,7 @@
        Histloc_t location;
        location.hist_command = -1;
        location.hist_char = 0;
+       location.hist_line = 0;
        if(!hp)
                return(location);
        /* leading ^ means beginning of line unless escaped */
@@ -1057,8 +1058,6 @@
                }
                command = -1;
        }
-       next.hist_command = command;
-       return(next);
 done:
        next.hist_line = line;
        next.hist_command = command;
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/features/externs 
ksh93_2006_10_31/src/cmd/ksh93/features/externs
--- ksh93_2006_09_12/src/cmd/ksh93/features/externs     2003-04-17 
18:27:45.000000000 +0200
+++ ksh93_2006_10_31/src/cmd/ksh93/features/externs     2006-10-07 
15:15:30.000000000 +0200
@@ -1,15 +1,12 @@
+set    prototyped
 hdr    nc,exec_attr
 mem    exception.name,_exception.name math.h
-lib    setreuid,setregid,nice,confstr,sigflag,fork,spawnveg
+lib    setreuid,setregid,nice,sigflag,fork,spawnveg
 lib    pathnative,pathposix,uwin_path,uwin_unpath,fts_notify
-lib    attropen,fchdir
-lib  attropen64 -D_LARGEFILE64_SOURCE
-cat{
-     #if _lib_attropen64
-     #define attropen  attropen64
-     #ifndef __USE_LARGEFILE64
-       extern int      attropen64(const char*, const char*, int, ...);
-     #endif
-     #endif
-}end
+lib    fchdir
 
+reference      unistd.h
+
+extern nice            int     (int)
+extern setreuid        int     (uid_t,uid_t)
+extern setregid        int     (gid_t,gid_t)
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/features/isoc 
ksh93_2006_10_31/src/cmd/ksh93/features/isoc
--- ksh93_2006_09_12/src/cmd/ksh93/features/isoc        1970-01-01 
01:00:00.000000000 +0100
+++ ksh93_2006_10_31/src/cmd/ksh93/features/isoc        2006-10-24 
15:55:39.000000000 +0200
@@ -0,0 +1,9 @@
+if tst note{ -D_ISOC99_SOURCE cooperates with <stdlib.h> and <math.h> }end 
-D_ISOC99_SOURCE compile{
+               #include <stdlib.h>
+               #include <math.h>
+       }end {
+               #ifndef _ISOC99_SOURCE
+               #define _ISOC99_SOURCE          1
+               #endif
+       }
+endif
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/features/math 
ksh93_2006_10_31/src/cmd/ksh93/features/math
--- ksh93_2006_09_12/src/cmd/ksh93/features/math        2006-06-26 
20:25:43.000000000 +0200
+++ ksh93_2006_10_31/src/cmd/ksh93/features/math        1970-01-01 
01:00:00.000000000 +0100
@@ -1,4 +0,0 @@
-lib,npt        absl,acosl,acoshl,asinl,asinhl,atanl,atan2l,expl,cosl,coshl     
math.h
-lib,npt        fabsl,powl,hypotl,fmodl,logl,sinl,sinhl,sqrtl,tanl,tanhl        
math.h
-lib,npt        strtold,isinf,isinfl,isnan,isnanl,isnormal,isnormall            
math.h
-lib,npt        finite,finitel,isfinite                                         
math.h
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/features/math.sh 
ksh93_2006_10_31/src/cmd/ksh93/features/math.sh
--- ksh93_2006_09_12/src/cmd/ksh93/features/math.sh     1970-01-01 
01:00:00.000000000 +0100
+++ ksh93_2006_10_31/src/cmd/ksh93/features/math.sh     2006-10-26 
18:39:12.000000000 +0200
@@ -0,0 +1,191 @@
+########################################################################
+#                                                                      #
+#               This software is part of the ast package               #
+#           Copyright (c) 1982-2006 AT&T Knowledge Ventures            #
+#                      and is licensed under the                       #
+#                  Common Public License, Version 1.0                  #
+#                      by AT&T Knowledge Ventures                      #
+#                                                                      #
+#                A copy of the License is available at                 #
+#            http://www.opensource.org/licenses/cpl1.0.txt             #
+#         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         #
+#                                                                      #
+#              Information and Software Systems Research               #
+#                            AT&T Research                             #
+#                           Florham Park NJ                            #
+#                                                                      #
+#                  David Korn <dgk at research.att.com>                   #
+#                                                                      #
+########################################################################
+: generate the ksh math builtin table
+: include math.tab
+: include FEATURE/isoc
+
+# @(#)math.sh (AT&T Research) 2006-10-26
+
+command=$0
+iffeflags="-n -v"
+iffehdrs="math.h ieeefp.h"
+ifferefs=""
+iffelibs="-lm"
+table=/dev/null
+
+eval $1
+shift
+while  :
+do     case $# in
+       0)      break ;;
+       esac
+       case $1 in
+       *.tab)  table=$1 ;;
+       */isoc) ifferefs=`sed -e '1,/-D/d' -e '/#define/!d' -e 's/#define.\([^  
      ]*\).*/-D\1/' $1` ;;
+       esac
+       shift
+done
+
+names=
+tests=
+
+: read the table
+
+exec < $table
+while  read type args name aka comment
+do     case $type in
+       [fi])   names="$names $name"
+               tests="$tests,$name,${name}l"
+               eval TYPE_$name=$type ARGS_$name=$args AKA_$name=$aka
+               ;;
+       esac
+done
+
+: check the math library
+
+eval `iffe $iffeflags -c "$cc" - lib $tests $iffehdrs $ifferefs $iffelibs 
2>&$stderr`
+tests=
+for name in $names
+do     eval x='$'_lib_${name}l y='$'_lib_${name}
+       case $x:$y in
+       1:*)    tests="$tests,${name}l" ;;
+       *:1)    tests="$tests,${name}" ;;
+       esac
+done
+eval `iffe $iffeflags -c "$cc" - dat $tests $iffehdrs $ifferefs $iffelibs 
2>&$stderr`
+tests=
+for name in $names
+do     eval x='$'_dat_${name}l y='$'_dat_${name}
+       case $x:$y in
+       1:*)    tests="$tests,${name}l" ;;
+       *:1)    tests="$tests,${name}" ;;
+       esac
+done
+eval `iffe $iffeflags -c "$cc" - npt $tests $iffehdrs $ifferefs 2>&$stderr`
+tests=
+for name in $names
+do     eval x='$'_lib_${name}l y='$'_lib_${name}
+       case $x in
+       '')     tests="$tests,${name}l" ;;
+       esac
+       case $y in
+       '')     tests="$tests,${name}" ;;
+       esac
+done
+eval `iffe $iffeflags -c "$cc" - mac $tests $iffehdrs $ifferefs 2>&$stderr`
+
+cat <<!
+#pragma prototyped
+
+/* : : generated by $command from $table : : */
+
+typedef Sfdouble_t (*Math_f)(Sfdouble_t,...);
+
+!
+case $_hdr_ieeefp in
+1)     echo "#include <ieeefp.h>"
+       echo
+       ;;
+esac
+
+: generate the intercept functions and table entries
+
+nl='
+'
+ht='   '
+tab=
+ldouble=
+for name in $names
+do     eval x='$'_lib_${name}l y='$'_lib_${name}
+       case $x:$y in
+       1:1)    ldouble=1
+               break
+               ;;
+       esac
+done
+for name in $names
+do     eval x='$'_lib_${name}l y='$'_lib_${name} r='$'TYPE_${name} 
a='$'ARGS_${name} aka='$'AKA_${name}
+       case $x:$y in
+       1:*)    f=${name}l
+               t=Sfdouble_t
+               local=
+               ;;
+       *:1)    f=${name}
+               t=double
+               local=$ldouble
+               ;;
+       *)      continue
+               ;;
+       esac
+       eval n='$'_npt_$f m='$'_mac_$f d='$'_dat_$f
+       case $r in
+       i)      L=int r=int R=1 ;;
+       *)      L=Sfdouble_t r=$t R=0 ;;
+       esac
+       case $d:$m:$n in
+       1:*:*|*:1:*)
+               ;;
+       *:*:1)  code="extern $r $f("
+               sep=
+               for p in 1 2 3 4 5 6 7
+               do      code="$code${sep}$t"
+                       case $a in
+                       $p)     break ;;
+                       esac
+                       sep=","
+               done
+               code="$code);"
+               echo "$code"
+               ;;
+       esac
+       case $local:$m:$d in
+       1:*:*|*:1:*|*:*:)
+               args=
+               code="static $L local_$f("
+               sep=
+               for p in 1 2 3 4 5 6 7 8 9
+               do      args="$args${sep}a$p"
+                       code="$code${sep}Sfdouble_t a$p"
+                       case $a in
+                       $p)     break ;;
+                       esac
+                       sep=","
+               done
+               code="$code){return $f($args);}"
+               echo "$code"
+               f=local_$f
+               ;;
+       esac
+       for x in $name $aka
+       do      tab="$tab$nl$ht\"\\0${R}${a}${x}\",$ht(Math_f)$f,"
+       done
+done
+tab="$tab$nl$ht\"\",$ht$ht(Math_f)0"
+
+cat <<!
+
+/*
+ * first byte is two-digit octal number.  Last digit is number of args
+ * first digit is 0 if return value is double, 1 for integer
+ */
+const struct mathtab shtab_math[] =
+{$tab
+};
+!
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/include/defs.h 
ksh93_2006_10_31/src/cmd/ksh93/include/defs.h
--- ksh93_2006_09_12/src/cmd/ksh93/include/defs.h       2006-08-30 
17:31:36.000000000 +0200
+++ ksh93_2006_10_31/src/cmd/ksh93/include/defs.h       2006-10-17 
04:20:34.000000000 +0200
@@ -75,7 +75,7 @@
        short           optchar;
        short           opterror;
        int             ioset;
-       short           trapmax;
+       unsigned short  trapmax;
        char            *trap[SH_DEBUGTRAP+1];
        char            **trapcom;
        char            **otrapcom;
@@ -84,6 +84,7 @@
 
 struct limits
 {
+       long            arg_max;        /* max arg+env exec() size */
        int             open_max;       /* maximum number of file descriptors */
        int             clk_tck;        /* number of ticks per second */
        int             child_max;      /* maxumum number of children */
@@ -159,6 +160,7 @@
        int             xargmin; \
        int             xargmax; \
        int             xargexit; \
+       mode_t          mask; \
        long            nforks; \
        Env_t           *env; \
        void            *init_context; \
@@ -277,6 +279,10 @@
 #   define SH_HISTVERIFY       62
 #endif
 
+#ifndef PIPE_BUF
+#   define PIPE_BUF            512
+#endif
+
 #define MATCH_MAX              64
 
 extern int             sh_addlib(void*);
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/include/jobs.h 
ksh93_2006_10_31/src/cmd/ksh93/include/jobs.h
--- ksh93_2006_09_12/src/cmd/ksh93/include/jobs.h       2004-12-24 
04:05:53.000000000 +0100
+++ ksh93_2006_10_31/src/cmd/ksh93/include/jobs.h       2006-09-14 
19:22:11.000000000 +0200
@@ -81,6 +81,7 @@
        pid_t           mypgid;         /* process group id of shell */
        pid_t           mytgid;         /* terminal group id of shell */
        unsigned int    in_critical;    /* >0 => in critical region */
+       int             savesig;        /* active signal */
        int             numpost;        /* number of posted jobs */
        short           fd;             /* tty descriptor number */
 #ifdef JOBS
@@ -103,6 +104,10 @@
 extern struct jobs job;
 
 #ifdef JOBS
+
+#define job_lock()     (job.in_critical++)
+#define job_unlock()   
do{if(!--job.in_critical&&job.savesig)job_reap(job.savesig);}while(0)
+
 extern const char      e_jobusage[];
 extern const char      e_done[];
 extern const char      e_running[];
@@ -143,6 +148,7 @@
        extern int      job_terminate(struct process*,int);
        extern int      job_switch(struct process*,int);
        extern void     job_fork(pid_t);
+       extern int      job_reap(int);
 #else
 #      define job_init(flag)
 #      define job_close()      (0)
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/include/name.h 
ksh93_2006_10_31/src/cmd/ksh93/include/name.h
--- ksh93_2006_09_12/src/cmd/ksh93/include/name.h       2006-08-16 
07:57:23.000000000 +0200
+++ ksh93_2006_10_31/src/cmd/ksh93/include/name.h       2006-09-12 
22:40:04.000000000 +0200
@@ -64,6 +64,7 @@
                                   bound exceeded.  Must be a power of 2 */
 #define ARRAY_FILL     (8L<<ARRAY_BITS)        /* used with nv_putsub() */
 #define ARRAY_NOCLONE  (16L<<ARRAY_BITS)       /* do not clone array disc */
+#define ARRAY_NOCHILD   (32L<<ARRAY_BITS)      /* skip compound arrays */
 
 /* These flags are used as options to array_get() */
 #define ARRAY_ASSIGN   0
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/include/path.h 
ksh93_2006_10_31/src/cmd/ksh93/include/path.h
--- ksh93_2006_09_12/src/cmd/ksh93/include/path.h       2005-01-18 
00:07:58.000000000 +0100
+++ ksh93_2006_10_31/src/cmd/ksh93/include/path.h       2006-10-06 
20:49:10.000000000 +0200
@@ -41,7 +41,7 @@
 #define PATH_BFPATH            0010
 #define PATH_SKIP              0020
 #define PATH_BUILTIN_LIB       0040
-#define PATH_BUILTIN_SH                0100
+#define PATH_STD_DIR           0100    /* directory is on  $(getconf PATH) */
 
 #define PATH_OFFSET    2               /* path offset for path_join */
 #define MAXDEPTH       (sizeof(char*)==2?64:4096) /* maximum recursion depth*/
@@ -57,6 +57,7 @@
        ino_t           ino;
        char            *name;
        char            *lib;
+       char            *blib;
        void            *bltin_lib;
        unsigned short  len;
        unsigned short  flags;
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/include/shell.h 
ksh93_2006_10_31/src/cmd/ksh93/include/shell.h
--- ksh93_2006_09_12/src/cmd/ksh93/include/shell.h      2006-08-02 
18:32:21.000000000 +0200
+++ ksh93_2006_10_31/src/cmd/ksh93/include/shell.h      2006-10-26 
19:48:36.000000000 +0200
@@ -180,6 +180,7 @@
 extern int             sh_dup(int);
 extern void            sh_exit(int);
 extern int             sh_fcntl(int, int, ...);
+extern Sfio_t          *sh_fd2sfio(int);
 extern int             (*sh_fdnotify(int(*)(int,int)))(int,int);
 extern Shell_t         *sh_getinterp(void);
 extern int             sh_open(const char*, int, ...);
@@ -189,6 +190,7 @@
 extern ssize_t                 sh_write(int, const void*, size_t);
 extern off_t           sh_seek(int, off_t, int);
 extern int             sh_pipe(int[]);
+extern mode_t          sh_umask(mode_t);
 extern void            *sh_waitnotify(Shwait_f);
 extern Shscope_t       *sh_getscope(int,int);
 extern Shscope_t       *sh_setscope(Shscope_t*);
@@ -224,6 +226,7 @@
 #   define pipe(a)     sh_pipe(a)
 #   define read(a,b,c) sh_read(a,b,c)
 #   define write(a,b,c)        sh_write(a,b,c)
+#   define umask(a)    sh_umask(a)
 #   define dup         sh_dup
 #   if _lib_lseek64
 #      define open64   sh_open
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/include/shlex.h 
ksh93_2006_10_31/src/cmd/ksh93/include/shlex.h
--- ksh93_2006_09_12/src/cmd/ksh93/include/shlex.h      2006-08-02 
16:54:50.000000000 +0200
+++ ksh93_2006_10_31/src/cmd/ksh93/include/shlex.h      2006-10-31 
16:45:10.000000000 +0100
@@ -97,6 +97,7 @@
 #define SYMGT          0100000 /* trailing '>' */
 #define SYMSEMI                0110000 /* trailing ';' */
 #define SYMSHARP       0120000 /* trailing '#' */
+#define IOSEEKSYM      (SYMSHARP|'<')
 #define IOMOV0SYM      (SYMAMP|'<')
 #define IOMOV1SYM      (SYMAMP|'>')
 #define FALLTHRUSYM    (SYMAMP|';')
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/include/shnodes.h 
ksh93_2006_10_31/src/cmd/ksh93/include/shnodes.h
--- ksh93_2006_09_12/src/cmd/ksh93/include/shnodes.h    2006-08-15 
16:18:14.000000000 +0200
+++ ksh93_2006_10_31/src/cmd/ksh93/include/shnodes.h    2006-10-24 
04:23:59.000000000 +0200
@@ -183,6 +183,7 @@
 #define IOVNM  0x10000         /* iovname field is non-zero */
 #define IOLSEEK        0x20000         /* seek operators <# or >#  */
 #define IOARITH        0x40000         /* arithmetic seek <# ((expr))  */
+#define IOCOPY IOCLOB          /* copy skipped lines onto standard output */
 
 union Shnode_u
 {
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/include/streval.h 
ksh93_2006_10_31/src/cmd/ksh93/include/streval.h
--- ksh93_2006_09_12/src/cmd/ksh93/include/streval.h    2006-07-25 
16:15:35.000000000 +0200
+++ ksh93_2006_10_31/src/cmd/ksh93/include/streval.h    2006-10-13 
17:44:24.000000000 +0200
@@ -82,7 +82,7 @@
 
 struct mathtab
 {
-       char            fname[10];
+       char            fname[16];
        Sfdouble_t      (*fnptr)(Sfdouble_t,...);
 };
 
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/Makefile 
ksh93_2006_10_31/src/cmd/ksh93/Makefile
--- ksh93_2006_09_12/src/cmd/ksh93/Makefile     2006-08-21 16:15:23.000000000 
+0200
+++ ksh93_2006_10_31/src/cmd/ksh93/Makefile     2006-10-18 20:20:32.000000000 
+0200
@@ -184,7 +184,7 @@
        echo ";" >> $(<)
 end
 
-:: syscall.s mamexec mamstate.c deparse.c shopen.c $(DOCFILES) \
+:: math.tab syscall.s mamexec mamstate.c deparse.c shopen.c $(DOCFILES) \
        bash.c bash_pre_rc.sh hexpand.c mkservice.c
 
 :: shtests \
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/Mamfile 
ksh93_2006_10_31/src/cmd/ksh93/Mamfile
--- ksh93_2006_09_12/src/cmd/ksh93/Mamfile      2006-09-13 06:38:27.000000000 
+0200
+++ ksh93_2006_10_31/src/cmd/ksh93/Mamfile      2006-11-03 03:05:02.000000000 
+0100
@@ -48,53 +48,44 @@
 done ${PACKAGE_ast_INCLUDE}/ast_map.h dontcare
 done ${PACKAGE_ast_INCLUDE}/ast_common.h dontcare
 make ${PACKAGE_ast_INCLUDE}/ast_std.h implicit
-make ${PACKAGE_ast_INCLUDE}/ast_botch.h implicit
-done ${PACKAGE_ast_INCLUDE}/ast_botch.h dontcare
-make ${PACKAGE_ast_INCLUDE}/ast_unistd.h implicit
-done ${PACKAGE_ast_INCLUDE}/ast_unistd.h dontcare
-make ${PACKAGE_ast_INCLUDE}/re_comp.h implicit
+make ${PACKAGE_ast_INCLUDE}/regex.h implicit
+prev ${PACKAGE_ast_INCLUDE}/ast_common.h implicit
 make ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
 make ${INSTALLROOT}/include/prototyped.h implicit
 done ${INSTALLROOT}/include/prototyped.h dontcare
 done ${PACKAGE_ast_INCLUDE}/prototyped.h dontcare
-done ${PACKAGE_ast_INCLUDE}/re_comp.h dontcare
-make ${PACKAGE_ast_INCLUDE}/getopt.h implicit
-make ${PACKAGE_ast_INCLUDE}/ast_getopt.h implicit
-prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
-done ${PACKAGE_ast_INCLUDE}/ast_getopt.h dontcare
-prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
-done ${PACKAGE_ast_INCLUDE}/getopt.h dontcare
+done ${PACKAGE_ast_INCLUDE}/regex.h dontcare
+prev ${PACKAGE_ast_INCLUDE}/ast_map.h implicit
+make ${PACKAGE_ast_INCLUDE}/ast_botch.h implicit
+done ${PACKAGE_ast_INCLUDE}/ast_botch.h dontcare
+make ${PACKAGE_ast_INCLUDE}/ast_limits.h implicit
+done ${PACKAGE_ast_INCLUDE}/ast_limits.h dontcare
 make ${PACKAGE_ast_INCLUDE}/ast_fcntl.h implicit
-make ${PACKAGE_ast_INCLUDE}/ls.h implicit
-make ${PACKAGE_ast_INCLUDE}/ast_mode.h implicit
-done ${PACKAGE_ast_INCLUDE}/ast_mode.h dontcare
 make ${PACKAGE_ast_INCLUDE}/ast_fs.h implicit
 make error?--?old?ethernet?address?at?wrong?offset implicit
 done error?--?old?ethernet?address?at?wrong?offset dontcare virtual
 done ${PACKAGE_ast_INCLUDE}/ast_fs.h dontcare
-prev ${PACKAGE_ast_INCLUDE}/ast_std.h implicit
-prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
-done ${PACKAGE_ast_INCLUDE}/ls.h dontcare
-prev ${PACKAGE_ast_INCLUDE}/ast_fs.h implicit
 done ${PACKAGE_ast_INCLUDE}/ast_fcntl.h dontcare
-make ${PACKAGE_ast_INCLUDE}/ast_types.h implicit
-done ${PACKAGE_ast_INCLUDE}/ast_types.h dontcare
-prev ${PACKAGE_ast_INCLUDE}/ast_map.h implicit
+make ${PACKAGE_ast_INCLUDE}/ast_getopt.h implicit
+prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
+done ${PACKAGE_ast_INCLUDE}/ast_getopt.h dontcare
+make ${PACKAGE_ast_INCLUDE}/ast_sys.h implicit
+make ${PACKAGE_ast_INCLUDE}/re_comp.h implicit
+prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
+done ${PACKAGE_ast_INCLUDE}/re_comp.h dontcare
+make ${PACKAGE_ast_INCLUDE}/getopt.h implicit
+prev ${PACKAGE_ast_INCLUDE}/ast_getopt.h implicit
+prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
+done ${PACKAGE_ast_INCLUDE}/getopt.h dontcare
 make ${PACKAGE_ast_INCLUDE}/stdio.h implicit
 make ${PACKAGE_ast_INCLUDE}/ast_stdio.h implicit
 make ${PACKAGE_ast_INCLUDE}/sfio_s.h implicit
 done ${PACKAGE_ast_INCLUDE}/sfio_s.h dontcare
-prev ${PACKAGE_ast_INCLUDE}/ast_common.h implicit
+prev ${PACKAGE_ast_INCLUDE}/ast_std.h implicit
 done ${PACKAGE_ast_INCLUDE}/ast_stdio.h dontcare
 done ${PACKAGE_ast_INCLUDE}/stdio.h dontcare
 prev ${PACKAGE_ast_INCLUDE}/getopt.h implicit
-make ${PACKAGE_ast_INCLUDE}/limits.h implicit
-make ${PACKAGE_ast_INCLUDE}/ast_limits.h implicit
-done ${PACKAGE_ast_INCLUDE}/ast_limits.h dontcare
-done ${PACKAGE_ast_INCLUDE}/limits.h dontcare
-make ${PACKAGE_ast_INCLUDE}/ast_hdr.h implicit
-done ${PACKAGE_ast_INCLUDE}/ast_hdr.h dontcare
-prev ${PACKAGE_ast_INCLUDE}/ast_getopt.h implicit
+done ${PACKAGE_ast_INCLUDE}/ast_sys.h dontcare
 make ${PACKAGE_ast_INCLUDE}/ast_lib.h implicit
 done ${PACKAGE_ast_INCLUDE}/ast_lib.h dontcare
 prev ${PACKAGE_ast_INCLUDE}/ast_common.h implicit
@@ -206,7 +197,7 @@
 done +lintl dontcare virtual
 make ${mam_libdl}
 done ${mam_libdl} dontcare virtual
-exec - iffe -v -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '  ref 
${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib} -I${PACKAGE_ast_INCLUDE} 
-I${INSTALLROOT}/include ${mam_libdll} ${mam_libcmd} ${mam_libast} ${mam_libm} 
${mam_libast} : run features/time
+exec - iffe -v -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '  ref 
${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib} -I${PACKAGE_ast_INCLUDE} 
-I${INSTALLROOT}/include ${mam_libdll} ${mam_libcmd} ${mam_libast} ${mam_libm} 
${mam_libast}  : run features/time
 make ${PACKAGE_ast_INCLUDE}/times.h implicit
 make ${PACKAGE_ast_INCLUDE}/ast_time.h implicit
 done ${PACKAGE_ast_INCLUDE}/ast_time.h dontcare
@@ -226,7 +217,7 @@
 prev ${mam_libsecdb}
 prev +lintl
 prev ${mam_libdl}
-exec - iffe -v -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '  ref 
${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib} -I${PACKAGE_ast_INCLUDE} 
-I${INSTALLROOT}/include ${mam_libdll} ${mam_libcmd} ${mam_libast} ${mam_libm} 
${mam_libast} : run features/dynamic
+exec - iffe -v -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '  ref 
${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib} -I${PACKAGE_ast_INCLUDE} 
-I${INSTALLROOT}/include ${mam_libdll} ${mam_libcmd} ${mam_libast} ${mam_libm} 
${mam_libast}  : run features/dynamic
 make ${PACKAGE_ast_INCLUDE}/fs3d.h implicit
 prev ${PACKAGE_ast_INCLUDE}/ast_fs.h implicit
 prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
@@ -242,7 +233,7 @@
 prev ${mam_libsecdb}
 prev +lintl
 prev ${mam_libdl}
-exec - iffe -v -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '  ref 
${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib} -I${PACKAGE_ast_INCLUDE} 
-I${INSTALLROOT}/include ${mam_libdll} ${mam_libcmd} ${mam_libast} ${mam_libm} 
${mam_libast} : run features/options
+exec - iffe -v -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '  ref 
${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib} -I${PACKAGE_ast_INCLUDE} 
-I${INSTALLROOT}/include ${mam_libdll} ${mam_libcmd} ${mam_libast} ${mam_libm} 
${mam_libast}  : run features/options
 done FEATURE/options dontcare generated
 prev ${PACKAGE_ast_INCLUDE}/option.h implicit
 done include/builtins.h
@@ -266,7 +257,7 @@
 prev ${mam_libsecdb}
 prev +lintl
 prev ${mam_libdl}
-exec - iffe -v -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '  ref 
${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib} -I${PACKAGE_ast_INCLUDE} 
-I${INSTALLROOT}/include ${mam_libdll} ${mam_libcmd} ${mam_libast} ${mam_libm} 
${mam_libast} : run features/sigfeatures
+exec - iffe -v -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '  ref 
${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib} -I${PACKAGE_ast_INCLUDE} 
-I${INSTALLROOT}/include ${mam_libdll} ${mam_libcmd} ${mam_libast} ${mam_libm} 
${mam_libast}  : run features/sigfeatures
 done FEATURE/sigfeatures dontcare generated
 make FEATURE/setjmp implicit
 meta FEATURE/setjmp features/%>FEATURE/% features/setjmp setjmp
@@ -278,7 +269,7 @@
 prev ${mam_libsecdb}
 prev +lintl
 prev ${mam_libdl}
-exec - iffe -v -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '  ref 
${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib} -I${PACKAGE_ast_INCLUDE} 
-I${INSTALLROOT}/include ${mam_libdll} ${mam_libcmd} ${mam_libast} ${mam_libm} 
${mam_libast} : run features/setjmp
+exec - iffe -v -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '  ref 
${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib} -I${PACKAGE_ast_INCLUDE} 
-I${INSTALLROOT}/include ${mam_libdll} ${mam_libcmd} ${mam_libast} ${mam_libm} 
${mam_libast}  : run features/setjmp
 done FEATURE/setjmp dontcare generated
 prev ${PACKAGE_ast_INCLUDE}/sfio.h implicit
 prev ${PACKAGE_ast_INCLUDE}/error.h implicit
@@ -302,7 +293,13 @@
 done alarm.o generated
 make cd_pwd.o
 make bltins/cd_pwd.c
-prev ${PACKAGE_ast_INCLUDE}/ls.h implicit
+make ${PACKAGE_ast_INCLUDE}/ls.h implicit
+make ${PACKAGE_ast_INCLUDE}/ast_mode.h implicit
+done ${PACKAGE_ast_INCLUDE}/ast_mode.h dontcare
+prev ${PACKAGE_ast_INCLUDE}/ast_fs.h implicit
+prev ${PACKAGE_ast_INCLUDE}/ast_std.h implicit
+prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
+done ${PACKAGE_ast_INCLUDE}/ls.h
 prev include/builtins.h implicit
 prev include/name.h implicit
 make include/path.h implicit
@@ -314,7 +311,7 @@
 prev ${mam_libsecdb}
 prev +lintl
 prev ${mam_libdl}
-exec - iffe -v -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '  ref 
${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib} -I${PACKAGE_ast_INCLUDE} 
-I${INSTALLROOT}/include ${mam_libdll} ${mam_libcmd} ${mam_libast} ${mam_libm} 
${mam_libast} : def acct
+exec - iffe -v -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '  ref 
${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib} -I${PACKAGE_ast_INCLUDE} 
-I${INSTALLROOT}/include ${mam_libdll} ${mam_libcmd} ${mam_libast} ${mam_libm} 
${mam_libast}  : def acct
 done FEATURE/acct dontcare generated
 prev include/nval.h implicit
 prev FEATURE/options implicit
@@ -388,7 +385,7 @@
 prev ${mam_libsecdb}
 prev +lintl
 prev ${mam_libdl}
-exec - iffe -v -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '  ref 
${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib} -I${PACKAGE_ast_INCLUDE} 
-I${INSTALLROOT}/include ${mam_libdll} ${mam_libcmd} ${mam_libast} ${mam_libm} 
${mam_libast} : run features/ttys
+exec - iffe -v -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '  ref 
${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib} -I${PACKAGE_ast_INCLUDE} 
-I${INSTALLROOT}/include ${mam_libdll} ${mam_libcmd} ${mam_libast} ${mam_libm} 
${mam_libast}  : run features/ttys
 done FEATURE/ttys dontcare generated
 done include/terminal.h dontcare
 prev FEATURE/setjmp implicit
@@ -403,7 +400,7 @@
 prev ${mam_libsecdb}
 prev +lintl
 prev ${mam_libdl}
-exec - iffe -v -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '  ref 
${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib} -I${PACKAGE_ast_INCLUDE} 
-I${INSTALLROOT}/include ${mam_libdll} ${mam_libcmd} ${mam_libast} ${mam_libm} 
${mam_libast} : run features/locale
+exec - iffe -v -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '  ref 
${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib} -I${PACKAGE_ast_INCLUDE} 
-I${INSTALLROOT}/include ${mam_libdll} ${mam_libcmd} ${mam_libast} ${mam_libm} 
${mam_libast}  : run features/locale
 done FEATURE/locale dontcare generated
 prev FEATURE/options implicit
 done include/edit.h dontcare
@@ -512,7 +509,7 @@
 prev ${mam_libsecdb}
 prev +lintl
 prev ${mam_libdl}
-exec - iffe -v -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '  ref 
${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib} -I${PACKAGE_ast_INCLUDE} 
-I${INSTALLROOT}/include ${mam_libdll} ${mam_libcmd} ${mam_libast} ${mam_libm} 
${mam_libast} : run features/poll
+exec - iffe -v -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '  ref 
${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib} -I${PACKAGE_ast_INCLUDE} 
-I${INSTALLROOT}/include ${mam_libdll} ${mam_libcmd} ${mam_libast} ${mam_libm} 
${mam_libast}  : run features/poll
 make cell_sys_headers.h implicit
 done cell_sys_headers.h dontcare virtual
 done FEATURE/poll generated
@@ -549,7 +546,7 @@
 prev ${mam_libsecdb}
 prev +lintl
 prev ${mam_libdl}
-exec - iffe -v -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '  ref 
${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib} -I${PACKAGE_ast_INCLUDE} 
-I${INSTALLROOT}/include ${mam_libdll} ${mam_libcmd} ${mam_libast} ${mam_libm} 
${mam_libast} : run features/externs
+exec - iffe -v -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '  ref 
${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib} -I${PACKAGE_ast_INCLUDE} 
-I${INSTALLROOT}/include ${mam_libdll} ${mam_libcmd} ${mam_libast} ${mam_libm} 
${mam_libast}  : run features/externs
 done FEATURE/externs generated
 prev include/builtins.h implicit
 prev include/test.h implicit
@@ -591,7 +588,7 @@
 prev ${mam_libsecdb}
 prev +lintl
 prev ${mam_libdl}
-exec - iffe -v -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '  ref 
${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib} -I${PACKAGE_ast_INCLUDE} 
-I${INSTALLROOT}/include ${mam_libdll} ${mam_libcmd} ${mam_libast} ${mam_libm} 
${mam_libast} : run features/rlimits
+exec - iffe -v -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '  ref 
${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib} -I${PACKAGE_ast_INCLUDE} 
-I${INSTALLROOT}/include ${mam_libdll} ${mam_libcmd} ${mam_libast} ${mam_libm} 
${mam_libast}  : run features/rlimits
 done FEATURE/rlimits dontcare generated
 prev FEATURE/time implicit
 done include/ulimit.h
@@ -658,7 +655,7 @@
 prev ${mam_libsecdb}
 prev +lintl
 prev ${mam_libdl}
-exec - iffe -v -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '  ref 
${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib} -I${PACKAGE_ast_INCLUDE} 
-I${INSTALLROOT}/include ${mam_libdll} ${mam_libcmd} ${mam_libast} ${mam_libm} 
${mam_libast} : def execargs
+exec - iffe -v -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '  ref 
${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib} -I${PACKAGE_ast_INCLUDE} 
-I${INSTALLROOT}/include ${mam_libdll} ${mam_libcmd} ${mam_libast} ${mam_libm} 
${mam_libast}  : def execargs
 done FEATURE/execargs generated
 make FEATURE/pstat implicit
 meta FEATURE/pstat >FEATURE/%  pstat
@@ -668,7 +665,7 @@
 prev ${mam_libsecdb}
 prev +lintl
 prev ${mam_libdl}
-exec - iffe -v -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '  ref 
${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib} -I${PACKAGE_ast_INCLUDE} 
-I${INSTALLROOT}/include ${mam_libdll} ${mam_libcmd} ${mam_libast} ${mam_libm} 
${mam_libast} : def pstat
+exec - iffe -v -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '  ref 
${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib} -I${PACKAGE_ast_INCLUDE} 
-I${INSTALLROOT}/include ${mam_libdll} ${mam_libcmd} ${mam_libast} ${mam_libm} 
${mam_libast}  : def pstat
 done FEATURE/pstat generated
 prev FEATURE/time implicit
 make include/timeout.h implicit
@@ -790,7 +787,7 @@
 prev ${mam_libsecdb}
 prev +lintl
 prev ${mam_libdl}
-exec - iffe -v -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '  ref 
${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib} -I${PACKAGE_ast_INCLUDE} 
-I${INSTALLROOT}/include ${mam_libdll} ${mam_libcmd} ${mam_libast} ${mam_libm} 
${mam_libast} : run features/cmds
+exec - iffe -v -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '  ref 
${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib} -I${PACKAGE_ast_INCLUDE} 
-I${INSTALLROOT}/include ${mam_libdll} ${mam_libcmd} ${mam_libast} ${mam_libm} 
${mam_libast}  : run features/cmds
 done FEATURE/cmds generated
 prev FEATURE/time implicit
 prev FEATURE/options implicit
@@ -918,10 +915,7 @@
 prev include/io.h implicit
 prev include/path.h implicit
 prev include/variables.h implicit
-make ${PACKAGE_ast_INCLUDE}/regex.h implicit
-prev ${PACKAGE_ast_INCLUDE}/ast_common.h implicit
-prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
-done ${PACKAGE_ast_INCLUDE}/regex.h
+prev ${PACKAGE_ast_INCLUDE}/regex.h implicit
 prev ${PACKAGE_ast_INCLUDE}/ls.h implicit
 prev include/fcin.h implicit
 prev include/defs.h implicit
@@ -981,7 +975,7 @@
 done sh/macro.c
 meta macro.o %.c>%.o sh/macro.c macro
 prev sh/macro.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -Iinclude -I${PACKAGE_ast_INCLUDE} 
-DSHOPT_BRACEPAT -DKSHELL -DSHOPT_FILESCAN -DSHOPT_MULTIBYTE -D_PACKAGE_ast 
-DSHOPT_SUID_EXEC -D_BLD_shell -DSHOPT_PFSH -DSHOPT_KIA -DSHOPT_HISTEXPAND 
-DSHOPT_DYNAMIC -DSHOPT_ESH -c sh/macro.c
+exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -Iinclude -I${PACKAGE_ast_INCLUDE} 
-DSHOPT_BRACEPAT -DKSHELL -DSHOPT_OPTIMIZE -DSHOPT_FILESCAN -DSHOPT_MULTIBYTE 
-D_PACKAGE_ast -DSHOPT_SUID_EXEC -D_BLD_shell -DSHOPT_PFSH -DSHOPT_KIA 
-DSHOPT_HISTEXPAND -DSHOPT_DYNAMIC -DSHOPT_ESH -c sh/macro.c
 done macro.o generated
 make name.o
 make sh/name.c
@@ -1046,7 +1040,7 @@
 done sh/path.c
 meta path.o %.c>%.o sh/path.c path
 prev sh/path.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -Iinclude -I${PACKAGE_ast_INCLUDE} 
-D_PACKAGE_ast -DSHOPT_SUID_EXEC -DSHOPT_PFSH -DSHOPT_MULTIBYTE -DSHOPT_ESH 
-D_BLD_shell -DKSHELL -DSHOPT_BRACEPAT -DSHOPT_HISTEXPAND -DSHOPT_DYNAMIC -c 
sh/path.c
+exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -Iinclude -I${PACKAGE_ast_INCLUDE} 
-DSH_CMDLIB_DIR=\""/opt/ast/bin"\" -D_PACKAGE_ast -DSHOPT_SUID_EXEC 
-DSHOPT_PFSH -DSHOPT_MULTIBYTE -DSHOPT_ESH -D_BLD_shell -DKSHELL 
-DSHOPT_BRACEPAT -DSHOPT_HISTEXPAND -DSHOPT_DYNAMIC -c sh/path.c
 done path.o generated
 make string.o
 make sh/string.c
@@ -1200,20 +1194,35 @@
 done msg.o generated
 make strdata.o
 make data/strdata.c
-prev include/streval.h implicit
 make FEATURE/math implicit
-meta FEATURE/math features/%>FEATURE/% features/math math
-make features/math
-done features/math
+meta FEATURE/math features/%.sh>FEATURE/% features/math.sh math
+make features/math.sh
+make FEATURE/isoc implicit
+meta FEATURE/isoc features/%>FEATURE/% features/isoc isoc
+make features/isoc
+done features/isoc
 prev shell.req
 prev +ljobs
 prev +li
 prev ${mam_libsecdb}
 prev +lintl
 prev ${mam_libdl}
-exec - iffe -v -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '  ref 
${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib} -I${PACKAGE_ast_INCLUDE} 
-I${INSTALLROOT}/include ${mam_libdll} ${mam_libcmd} ${mam_libast} ${mam_libm} 
${mam_libast} : run features/math
+exec - iffe -v -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '  ref 
${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib} -I${PACKAGE_ast_INCLUDE} 
-I${INSTALLROOT}/include ${mam_libdll} ${mam_libcmd} ${mam_libast} ${mam_libm} 
${mam_libast}  : run features/isoc
+done FEATURE/isoc generated
+make data/math.tab implicit
+done data/math.tab
+done features/math.sh dontcare
+prev shell.req
+prev +ljobs
+prev +li
+prev ${mam_libsecdb}
+prev +lintl
+prev ${mam_libdl}
+exec - iffe -v -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '  ref 
${mam_cc_L+-L.} ${mam_cc_L+-L${INSTALLROOT}/lib} -I${PACKAGE_ast_INCLUDE} 
-I${INSTALLROOT}/include ${mam_libdll} ${mam_libcmd} ${mam_libast} ${mam_libm} 
${mam_libast}  : run features/math.sh FEATURE/isoc data/math.tab
 done FEATURE/math generated
+prev include/streval.h implicit
 prev FEATURE/options implicit
+prev FEATURE/isoc implicit
 done data/strdata.c
 meta strdata.o %.c>%.o data/strdata.c strdata
 prev data/strdata.c
@@ -1482,7 +1491,7 @@
 make ${PACKAGE_ast_INCLUDE}/nval.h
 prev ${PACKAGE_ast_INCLUDE}
 prev include/nval.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1982,author=dgk'  include/nval.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1982,author=dgk'  include/nval.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${PACKAGE_ast_INCLUDE}/nval.h 1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${PACKAGE_ast_INCLUDE}/nval.h
@@ -1490,7 +1499,7 @@
 done ${PACKAGE_ast_INCLUDE}/nval.h generated
 make ${PACKAGE_ast_INCLUDE}/shell.h
 prev include/shell.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1982,author=dgk'  include/shell.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1982,author=dgk'  include/shell.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${PACKAGE_ast_INCLUDE}/shell.h 1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${PACKAGE_ast_INCLUDE}/shell.h
@@ -1498,7 +1507,7 @@
 done ${PACKAGE_ast_INCLUDE}/shell.h generated
 make ${PACKAGE_ast_INCLUDE}/history.h
 prev include/history.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1982,author=dgk'  include/history.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1982,author=dgk'  include/history.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${PACKAGE_ast_INCLUDE}/history.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${PACKAGE_ast_INCLUDE}/history.h
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/RELEASE 
ksh93_2006_10_31/src/cmd/ksh93/RELEASE
--- ksh93_2006_09_12/src/cmd/ksh93/RELEASE      2006-09-08 18:28:57.000000000 
+0200
+++ ksh93_2006_10_31/src/cmd/ksh93/RELEASE      2006-10-31 03:11:18.000000000 
+0100
@@ -1,9 +1,42 @@
-06-09-08  --- Release ksh93s-  ---
-06-09-97  The -a option was added to typeset for indexed arrays.  This
+06-10-30  --- Release ksh93s-  ---
+06-10-30  The redirections <# pattern, and <## pattern have been added.
+         Both seek forward to the beginning of the next line that contains
+         the pattern.  The <## form copies the skipped portion to standard
+         output.
+06-10-26  On systems that support stream control transport, the virtual file
+         name /dev/sctp/host/port can now be used to establish connections.
+06-10-26  The printf modifier # when used with d produces units in thousands
+         with a single letter suffix added.  The modifier # when used with
+         the i specification provides units of 1024 with a two letter suffix.
+06-10-24  The value of $! is now set to the process id of a job put
+         into the background with the bg command as required by POSIX.
+06-10-23  A bug in which the value of $! was affected by a background
+         job started from a subshell has been fixed.
+06-10-23  A bug in ${var:offset:len} in multibyte locales has been fixed.
+06-10-15  The remaining math functions from C99 were added for any system
+         that supports them.
+06-10-12  A bug when skipping over `...` with ${x:=`...`} when x is set
+         has been fixed.
+06-10-11  A bug in process floating constants produced by the %a format
+         of printf has been fixed.
+06-10-06  A bug in which IFS was not being restored correctly in some
+         cases after a subshell has been fixed.
+06-10-06  A bug in which pipefail was not detecting some failures in
+         pipelines with 3 or more states has been fixed.
+06-10-03  A bug in the processing of >(...) with builtins which could
+         cause the builtin to hang has been fixed.
+06-10-03  A bug in the for loop optimizer which causes >(...) process
+         substitution to be ignored has been fixed.
+06-09-17  The -a option was added to typeset for indexed arrays.  This
          is only needed when using the ([subscript]=value ...) form.
+06-09-06  The showme option was added.  Each simple command not beginning
+         with a redirection and not occurring with in the while, until, if,
+         select condition can be preceded by a semi-colon which will
+         be ignored when showme is off.  When showme is on, any command
+         preceded by a colon will be traced but not executed.
 06-08-16  As a new feature, a leading ~(N) on a pattern has no effect 
          except when used for file expansion.  In this case if not
-         matches are found, the pattern is replaced by nothing rathern
+         matches are found, the pattern is replaced by nothing rather
          than itself.
 06-08-11  A bug in the expansion of ${.sh.match[i]:${#.shmatch[i]}} has
          been fixed.
@@ -37,7 +70,7 @@
 06-06-13  Internal change to use ordering for variables instead of hashing
          to speed up prefix matching.
 06-06-13  A window between fork/exec in which a signal could get lost
-         and cause a peogram to hang has been eliminated
+         and cause a program to hang has been eliminated
 06-06-13  A bug in edit completion with quoted strings has been fixed.
 06-06-07  The restricted options can now be enabled by set as well as on
          the command line.  Once set, it can not be disabled.
@@ -49,7 +82,7 @@
           and ksh88 when the stty lnext is control-v.  The sequence
          escape-control-v will display the shell version.
 06-05-31  Modified emacs and vi mode so that entering a TAB after a partial
-         TAB conpletion, generates a listing of possible completions.
+         TAB completion, generates a listing of possible completions.
          After the second TAB, a number followed by a TAB will perform
          the completion with the corresponding item.
 06-05-19  Modified arithmetic so that conversions to strings default to
@@ -92,7 +125,7 @@
 05-12-07  The aliases for integer and float have been changed to use attributes
          -li and -lE to handle long long and long double types.
 05-12-07  The histexpand (-H) option has been added which allows C-shell
-         style history expansios using the history character !.
+         style history expansions using the history character !.
 05-12-07  The multiline option was added which changes that way the edit
          modes handle lines longer than the window width.  Instead of
          horizontal scrolling, multiple lines on the screen are used.
@@ -242,7 +275,7 @@
          an integral number of seconds, for example even -t 'sin(.5)'
          is now valid.
 04-06-16  Two small memory leak problems were fixed.
-04-06-15  A bug in ${var/pattern/"string"} which occured when string
+04-06-15  A bug in ${var/pattern/"string"} which occurred when string
          contained pattern matching characters has been fixed.
 04-05-08  printf $'%d\n' produced an erroneous error message and has
          been fixed.
@@ -298,7 +331,7 @@
 03-12-05  On some systems, if the KEYBD trap is set, then commands that use
          the meta key were not processed until return was hit.  This
          has been fixed.
-03-12-05  A problem which occured when the login shell was not a group
+03-12-05  A problem which occurred when the login shell was not a group
          leader that could cause it to fail has been fixed.
 03-12-05  A problem in which a shell could core dump after receiving a signal
          that should cause it to terminate while it was in the process
@@ -352,7 +385,7 @@
          used inside ${...} has been fixed.
 03-07-15  An error in which expanding an indexed array inside a compound
          variable could cause a core dump has been fixed.
-03-07-15  A bug in which under on rare ocassions a job completion interrupt
+03-07-15  A bug in which under on rare occassions a job completion interrupt
          could cause to core dump has been fixed.
 03-06-26  A bug in which process substitution embedded within command
          substitution would generate a syntax error has been fixed.
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/sh/args.c 
ksh93_2006_10_31/src/cmd/ksh93/sh/args.c
--- ksh93_2006_09_12/src/cmd/ksh93/sh/args.c    2006-08-30 15:45:56.000000000 
+0200
+++ ksh93_2006_10_31/src/cmd/ksh93/sh/args.c    2006-10-06 03:13:26.000000000 
+0200
@@ -392,13 +392,13 @@
        on_option(&newflags,SH_NOEMPTYCMDCOMPL);
 
        if(!is_option(&newflags,SH_XPG_ECHO) && sh_isoption(SH_XPG_ECHO))
-               astgetconf("UNIVERSE", 0, "ucb", 0);
+               astconf("UNIVERSE", 0, "ucb");
        if(is_option(&newflags,SH_XPG_ECHO) && !sh_isoption(SH_XPG_ECHO))
-               astgetconf("UNIVERSE", 0, "att", 0);
+               astconf("UNIVERSE", 0, "att");
        if(!is_option(&newflags,SH_PHYSICAL) && sh_isoption(SH_PHYSICAL))
-               astgetconf("PATH_RESOLVE", 0, "metaphysical", 0);
+               astconf("PATH_RESOLVE", 0, "metaphysical");
        if(is_option(&newflags,SH_PHYSICAL) && !sh_isoption(SH_PHYSICAL))
-               astgetconf("PATH_RESOLVE", 0, "physical", 0);
+               astconf("PATH_RESOLVE", 0, "physical");
        if(is_option(&newflags,SH_HISTORY2) && !sh_isoption(SH_HISTORY2))
        {
                sh_onstate(SH_HISTORY);
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/sh/arith.c 
ksh93_2006_10_31/src/cmd/ksh93/sh/arith.c
--- ksh93_2006_09_12/src/cmd/ksh93/sh/arith.c   2006-07-21 14:54:23.000000000 
+0200
+++ ksh93_2006_10_31/src/cmd/ksh93/sh/arith.c   2006-10-11 22:26:21.000000000 
+0200
@@ -247,7 +247,7 @@
                        {
                                while(*val=='0')
                                        val++;
-                               if(*val==0 || *val=='.')
+                               if(*val==0 || *val=='.' || *val=='x' || 
*val=='X')
                                        val--;
                        }
                        if(r==LONGLONG_MAX && errno)
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/sh/array.c 
ksh93_2006_10_31/src/cmd/ksh93/sh/array.c
--- ksh93_2006_09_12/src/cmd/ksh93/sh/array.c   2006-09-08 00:53:12.000000000 
+0200
+++ ksh93_2006_10_31/src/cmd/ksh93/sh/array.c   2006-10-12 03:35:40.000000000 
+0200
@@ -87,6 +87,8 @@
        return (i>ARRAY_MAX?ARRAY_MAX:i);
 }
 
+static struct index_array *array_grow(Namval_t*, struct index_array*,int);
+
 /* return index of highest element of an array */
 int array_maxindex(Namval_t *np)
 {
@@ -125,23 +127,53 @@
        register struct index_array *ap = (struct index_array*)arp;
        register union Value    *up;
        Namval_t                *mp;
+       int                     wasundef;
+       if(wasundef = ap->header.nelem&ARRAY_UNDEF)
+       {
+               ap->header.nelem &= ~ARRAY_UNDEF;
+               /* delete array is the same as delete arr...@] */
+               if(flag&ARRAY_DELETE)
+               {
+                       nv_putsub(np, NIL(char*), ARRAY_SCAN);
+                       ap->header.nelem |= ARRAY_SCAN;
+               }
+               else /* same as array[0] */
+               {
+                       if(is_associative(ap))
+                               
(*ap->header.fun)(np,"0",flag==ARRAY_ASSIGN?NV_AADD:0);
+                       else
+                               ap->cur = 0;
+               }
+       }
        if(is_associative(ap))
        {
                mp = (Namval_t*)((*arp->fun)(np,NIL(char*),NV_ACURRENT));
                if(!mp)
                        up = (union Value*)&mp;
                else if(nv_isattr(mp,NV_CHILD))
+               {
+                       if(wasundef && nv_isarray(mp->nvalue.np))
+                               nv_putsub(mp->nvalue.np,NIL(char*),ARRAY_UNDEF);
                        return(mp->nvalue.np);
+               }
                else
                        up =  &mp->nvalue;
        }
        else
        {
+               if(!(ap->header.nelem&ARRAY_SCAN) && ap->cur >= ap->maxi)
+                       ap = array_grow(np, ap, (int)ap->cur);
+               if(ap->cur>=ap->maxi)
+                       errormsg(SH_DICT,ERROR_exit(1),e_subscript, 
nv_name(np));
                if(ap->cur >= ap->maxi)
                        errormsg(SH_DICT,ERROR_exit(1),e_subscript,nv_name(np));
                up = &(ap->val[ap->cur]);
                if(up->np && array_isbit(ap->bits,ap->cur))
+               {
+                       if(wasundef && nv_isarray(up->np))
+                               nv_putsub(up->np,NIL(char*),ARRAY_UNDEF);
                        return(up->np);
+               }
        }
        np->nvalue.cp = up->cp;
        if(!up->cp)
@@ -198,7 +230,7 @@
                                        nq->nvalue.np = mp;
                                        nv_onattr(nq,NV_CHILD);
                                }
-                               else
+                               else if(aq)
                                {
                                        array_setbit(aq->bits,aq->cur);
                                        aq->val[aq->cur].np = mq;
@@ -224,13 +256,10 @@
        return(nv_stack(mp,(Namfun_t*)0));
 }
 
-static Namarr_t *array_check(Namval_t*, Namarr_t*, int);
-
 static char *array_getval(Namval_t *np, Namfun_t *disc)
 {
        register Namarr_t *ap = (Namarr_t*)disc;
        register Namval_t *mp;
-       ap = array_check(np,ap,ARRAY_LOOKUP);
        if((mp=array_find(np,ap,ARRAY_LOOKUP))!=np)
                return(mp?nv_getval(mp):0);
        return(nv_getv(np,&ap->hdr));
@@ -240,7 +269,6 @@
 {
        register Namarr_t *ap = (Namarr_t*)disc;
        register Namval_t *mp;
-       ap = array_check(np,ap,ARRAY_LOOKUP);
        if((mp=array_find(np,ap,ARRAY_LOOKUP))!=np)
                return(mp?nv_getnum(mp):0);
        return(nv_getn(np,&ap->hdr));
@@ -252,7 +280,6 @@
        register union Value    *up;
        register Namval_t       *mp;
        register struct index_array *aq = (struct index_array*)ap;
-       ap = array_check(np,ap,string?ARRAY_ASSIGN:ARRAY_DELETE);
        do
        {
                mp = array_find(np,ap,string?ARRAY_ASSIGN:ARRAY_DELETE);
@@ -377,41 +404,6 @@
        return(ap);
 }
 
-/*
- * Change ARRAY_UNDEF as appropriate
- * Allocate the space if necessary, if flag is ARRAY_ASSIGN
- * Check for bounds violation for indexed array
- */
-static Namarr_t *array_check(Namval_t *np, Namarr_t *arp, int flag)
-{
-       register struct index_array *ap = (struct index_array*)arp;
-       if(ap->header.nelem&ARRAY_UNDEF)
-       {
-               ap->header.nelem &= ~ARRAY_UNDEF;
-               /* delete array is the same as delete arr...@] */
-               if(flag&ARRAY_DELETE)
-               {
-                       nv_putsub(np, NIL(char*), ARRAY_SCAN);
-                       ap->header.nelem |= ARRAY_SCAN;
-               }
-               else /* same as array[0] */
-               {
-                       if(is_associative(ap))
-                               
(*ap->header.fun)(np,"0",flag==ARRAY_ASSIGN?NV_AADD:0);
-                       else
-                               ap->cur = 0;
-               }
-       }
-       if(!is_associative(ap))
-       {
-               if(!(ap->header.nelem&ARRAY_SCAN) && ap->cur >= ap->maxi)
-                       ap = array_grow(np, ap, (int)ap->cur);
-               if(ap->cur>=ap->maxi)
-                       errormsg(SH_DICT,ERROR_exit(1),e_subscript, 
nv_name(np));
-       }
-       return((Namarr_t*)ap);
-}
-
 Namarr_t *nv_arrayptr(register Namval_t *np)
 {
        if(nv_isattr(np,NV_ARRAY))
@@ -515,6 +507,8 @@
        np->nvalue.cp = up->cp;
        ap->nelem |= ARRAY_NOCLONE;
        nv_clone(np, nq, NV_NODISC);
+       nv_offattr(nq,NV_ARRAY);
+       ap->nelem &= ~ARRAY_NOCLONE;
        if(ap->fun)
        {
                up->np = (Namval_t*)((*ap->fun)(np,NIL(char*),NV_ACURRENT));
@@ -552,7 +546,7 @@
                                
nv_putsub(aq->cur->nvalue.np,NIL(char*),ARRAY_UNDEF);
                        return(1);
                }
-               ap->header.nelem &= ~ ARRAY_SCAN;
+               ap->header.nelem &= ~(ARRAY_SCAN|ARRAY_NOCHILD);
                return(0);
        }
        for(dot=ap->cur+1; dot <  (unsigned)ap->maxi; dot++)
@@ -561,11 +555,16 @@
                {
                        ap->cur = dot;
                        if(array_isbit(ap->bits, dot))
+                       {
+                               
+                               if(ap->header.nelem&ARRAY_NOCHILD)
+                                       continue;
                                
nv_putsub(ap->val[dot].np,NIL(char*),ARRAY_UNDEF);
+                       }
                        return(1);
                }
        }
-       ap->header.nelem &= ~ ARRAY_SCAN;
+       ap->header.nelem &= ~(ARRAY_SCAN|ARRAY_NOCHILD);
        ap->cur = 0;
        return(0);
 }
@@ -604,7 +603,7 @@
                        nv_onattr(np,NV_ARRAY);
                }
                ap->header.nelem &= ~ARRAY_UNDEF;
-               ap->header.nelem |= (mode&(ARRAY_SCAN|ARRAY_UNDEF));
+               ap->header.nelem |= 
(mode&(ARRAY_SCAN|ARRAY_NOCHILD|ARRAY_UNDEF));
                ap->cur = size;
                if((mode&ARRAY_SCAN) && !ap->val[size].cp && !nv_nextsub(np))
                        np = 0;
@@ -641,7 +640,7 @@
        ap->header.nelem &= ~ARRAY_UNDEF;
        if(!(mode&ARRAY_FILL))
                ap->header.nelem &= ~ARRAY_SCAN;
-       ap->header.nelem |= (mode&(ARRAY_SCAN|ARRAY_UNDEF));
+       ap->header.nelem |= (mode&(ARRAY_SCAN|ARRAY_NOCHILD|ARRAY_UNDEF));
        if(sp)
        {
                union Value *up;
@@ -715,8 +714,7 @@
        register struct index_array *ap;
        register unsigned dot, n;
        register char *cp = &numbuff[NUMSIZE];
-       ap = (struct index_array*)nv_arrayptr(np);
-       if(!np || !ap)
+       if(!np || !(ap = (struct index_array*)nv_arrayptr(np)))
                return(NIL(char*));
        if(is_associative(ap))
                return((char*)((*ap->header.fun)(np,NIL(char*),NV_ANAME)));
@@ -792,7 +790,11 @@
                {
                        ap->nextpos = (Namval_t*)dtnext(ap->table,ap->pos);
                        if(ap->cur->nvalue.cp)
+                       {
+                               if((ap->header.nelem&ARRAY_NOCHILD) && 
nv_isattr(ap->cur,NV_CHILD))
+                                       continue;
                                return((void*)ap);
+                       }
                }
                return(NIL(void*));
            case NV_ACURRENT:
@@ -833,7 +835,7 @@
        if(nv_isarray(np))
        {
                ap = (struct index_array*)nv_arrayptr(np);
-               if(is_associative(ap))
+               if(ap && is_associative(ap))
                        errormsg(SH_DICT,ERROR_exit(1),"cannot append index 
array to associate array %s",nv_name(np));
        }
        if(append)
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/sh/bash.c 
ksh93_2006_10_31/src/cmd/ksh93/sh/bash.c
--- ksh93_2006_09_12/src/cmd/ksh93/sh/bash.c    2005-03-31 21:31:08.000000000 
+0200
+++ ksh93_2006_10_31/src/cmd/ksh93/sh/bash.c    2006-10-13 05:59:11.000000000 
+0200
@@ -74,7 +74,7 @@
 "[06:version?Print version number and exit.]";
 
 const char sh_optshopt[] =
-"+[-1c?\n@(#)$Id: shopt (AT&T Labs Research) 2003-02-13 $\n]"
+"+[-1c?\n@(#)$Id: shopt (AT&T Research) 2003-02-13 $\n]"
 "[-author?Karsten Fleischer <K.Fleischer at omnium.de>]"
 USAGE_LICENSE
 "[+NAME?shopt - set/unset variables controlling optional shell behavior]"
@@ -343,13 +343,13 @@
                sh_onoption(SH_NOEMPTYCMDCOMPL);
                if(sh.login_sh==2)
                        sh_onoption(SH_LOGIN_SHELL);
-               if(strcmp(astgetconf("CONFORMANCE",0,0,0),"standard")==0)
+               if(strcmp(astconf("CONFORMANCE",0,0),"standard")==0)
                        sh_onoption(SH_POSIX);
-               if(strcmp(astgetconf("UNIVERSE",0,0,0),"att")==0)
+               if(strcmp(astconf("UNIVERSE",0,0),"att")==0)
                        sh_onoption(SH_XPG_ECHO);
                else
                        sh_offoption(SH_XPG_ECHO);
-               if(strcmp(astgetconf("PATH_RESOLVE",0,0,0),"physical")==0)
+               if(strcmp(astconf("PATH_RESOLVE",0,0),"physical")==0)
                        sh_onoption(SH_PHYSICAL);
                else
                        sh_offoption(SH_PHYSICAL);
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/sh/expand.c 
ksh93_2006_10_31/src/cmd/ksh93/sh/expand.c
--- ksh93_2006_09_12/src/cmd/ksh93/sh/expand.c  2006-08-16 17:24:33.000000000 
+0200
+++ ksh93_2006_10_31/src/cmd/ksh93/sh/expand.c  2006-10-04 21:17:49.000000000 
+0200
@@ -385,7 +385,7 @@
                        {
                                apin = ap->argchn.ap;
                                if(!sh_isoption(SH_NOGLOB))
-                                       brace = 
(brace=path_expand(ap->argval,arghead));
+                                       brace=path_expand(ap->argval,arghead);
                                else
                                {
                                        ap->argchn.ap = *arghead;
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/sh/init.c 
ksh93_2006_10_31/src/cmd/ksh93/sh/init.c
--- ksh93_2006_09_12/src/cmd/ksh93/sh/init.c    2006-08-11 18:21:34.000000000 
+0200
+++ ksh93_2006_10_31/src/cmd/ksh93/sh/init.c    2006-10-20 06:40:09.000000000 
+0200
@@ -98,6 +98,9 @@
     extern char        **environ;
 #endif
 
+#undef getconf
+#define getconf(x)     strtol(astconf(x,NiL,NiL),NiL,0)
+
 struct seconds
 {
        Namfun_t        hdr;
@@ -215,15 +218,12 @@
                goto done;
        /* turn on vi or emacs option if editor name is either*/
        cp = path_basename(cp);
-       if(strmatch(cp,"*vi"))
+       if(strmatch(cp,"*[Vv][Ii]*"))
                sh_onoption(SH_VI);
-       if(strmatch(cp,"*macs"))
-       {
-               if(*cp=='g')
-                       sh_onoption(SH_GMACS);
-               else
-                       sh_onoption(SH_EMACS);
-       }
+       else if(strmatch(cp,"*gmacs*"))
+               sh_onoption(SH_GMACS);
+       else if(strmatch(cp,"*macs*"))
+               sh_onoption(SH_EMACS);
 done:
        nv_putv(np, val, flags, fp);
 }
@@ -834,6 +834,7 @@
 #else
        init_ebcdic();
 #endif
+       umask(umask(0));
        sh.mac_context = sh_macopen(&sh);
        sh.arg_context = sh_argopen(&sh);
        sh.lex_context = (void*)sh_lexopen(0,&sh,1);
@@ -861,14 +862,15 @@
                        break;
                }
        }
-#ifdef _SC_CLK_TCK
-       sh.lim.clk_tck = sysconf(_SC_CLK_TCK);
-#endif
-       sh.lim.open_max = sysconf(_SC_OPEN_MAX);
-       sh.lim.child_max = sysconf(_SC_CHILD_MAX);
-       sh.lim.ngroups_max = sysconf(_SC_NGROUPS_MAX);
-       sh.lim.posix_version = sysconf(_SC_VERSION);
-       sh.lim.posix_jobcontrol = sysconf(_SC_JOB_CONTROL);
+       sh.lim.clk_tck = getconf("CLK_TCK");
+       sh.lim.arg_max = getconf("ARG_MAX");
+       sh.lim.open_max = getconf("OPEN_MAX");
+       sh.lim.child_max = getconf("CHILD_MAX");
+       sh.lim.ngroups_max = getconf("NGROUPS_MAX");
+       sh.lim.posix_version = getconf("VERSION");
+       sh.lim.posix_jobcontrol = getconf("JOB_CONTROL");
+       if(sh.lim.arg_max <=0)
+               sh.lim.arg_max = ARG_MAX;
        if(sh.lim.child_max <=0)
                sh.lim.child_max = CHILD_MAX;
        if(sh.lim.open_max <0)
@@ -1001,6 +1003,7 @@
 #endif /* _WINIX */
                }
        }
+#if SHOPT_PFSH
        if (sh_isoption(SH_PFSH))
        {
                struct passwd *pw = getpwuid(sh.userid);
@@ -1008,6 +1011,7 @@
                        sh.user = strdup(pw->pw_name);
                
        }
+#endif
        /* set[ug]id scripts require the -p flag */
        if(sh.userid!=sh.euserid || sh.groupid!=sh.egroupid)
        {
@@ -1248,8 +1252,8 @@
        shp->fun_tree = dtopen(&_Nvdisc,Dtoset);
        dtview(shp->fun_tree,shp->bltin_tree);
 #if SHOPT_NAMESPACE
-       np = nv_mount(DOTSHNOD, "global", shp->var_tree);
-       nv_onattr(np,NV_RDONLY);
+       if(np = nv_mount(DOTSHNOD, "global", shp->var_tree))
+               nv_onattr(np,NV_RDONLY);
        np = nv_search("namespace",nv_dict(DOTSHNOD),NV_ADD);
        nv_putval(np,".sh.global",NV_RDONLY|NV_NOFREE);
        nv_stack(np, &NSPACE_init);
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/sh/io.c 
ksh93_2006_10_31/src/cmd/ksh93/sh/io.c
--- ksh93_2006_09_12/src/cmd/ksh93/sh/io.c      2006-08-14 20:37:16.000000000 
+0200
+++ ksh93_2006_10_31/src/cmd/ksh93/sh/io.c      2006-11-01 17:23:50.000000000 
+0100
@@ -376,7 +376,9 @@
        mode_t                  mode;
        char                    *e;
 #ifdef SOCKET
+       int                     type = -1;
        int                     prot = -1;
+       int                     info = 0;
        struct sockaddr_in      addr;
 #endif /* SOCKET */
        va_list                 ap;
@@ -417,15 +419,31 @@
                                                fd = 1;
                                        break;
                                }
+#if defined(SOCKET) && defined(IPPROTO_SCTP)
+                       else if (path[6]=='c' && path[7]=='t' && path[8]=='p' 
&& path[9]=='/')
+                       {
+                               type = SOCK_STREAM;
+                               prot = IPPROTO_SCTP;
+                               info = 10;
+                       }
+#endif
                        break;
 #ifdef SOCKET
                case 't':
                        if (path[6]=='c' && path[7]=='p' && path[8]=='/')
-                               prot = SOCK_STREAM;
+                       {
+                               type = SOCK_STREAM;
+                               prot = 0;
+                               info = 9;
+                       }
                        break;
                case 'u':
                        if (path[6]=='d' && path[7]=='p' && path[8]=='/')
-                               prot = SOCK_DGRAM;
+                       {
+                               type = SOCK_DGRAM;
+                               prot = 0;
+                               info = 9;
+                       }
                        break;
 #endif
                }
@@ -442,9 +460,9 @@
                        return(-1);
        }
 #ifdef SOCKET
-       else if (prot > 0 && str2inet(path + 5, &addr))
+       else if (type > 0 && str2inet(path+info, &addr))
        {
-               if ((fd = socket(AF_INET, prot, 0)) >= 0)
+               if ((fd = socket(AF_INET, type, prot)) >= 0)
                {
                        if(flags&O_SERVICE)
                        {
@@ -532,6 +550,58 @@
        return(0);
 }
 
+static int pat_seek(void *handle, const char *str, size_t sz)
+{
+       char **bp = (char**)handle;
+       *bp = (char*)str;
+       return(-1);
+}
+
+static int pat_line(const regex_t* rp, const char *buff, register size_t n)
+{
+       register const char *cp=buff, *sp;
+       while(n>0)
+       {
+               for(sp=cp; n-->0 && *cp++ != '\n';);
+               if(regnexec(rp,sp,cp-sp, 0, (regmatch_t*)0, 0)==0)
+                       return(sp-buff);
+       }
+       return(cp-buff);
+}
+
+static int io_patseek(regex_t *rp, Sfio_t* sp, int flags)
+{
+       char    *cp, *match;
+       int     r, close_exec = sh.fdstatus[sffileno(sp)]&IOCLEX;
+       int     s=(PIPE_BUF>SF_BUFSIZE?SF_BUFSIZE:PIPE_BUF);
+       size_t  n,m;
+       sh.fdstatus[sffileno(sp)] |= IOCLEX;
+       while((cp=sfreserve(sp, -s, SF_LOCKR)) || (cp=sfreserve(sp,SF_UNBOUND, 
SF_LOCKR)))
+       {
+               m = n = sfvalue(sp);
+               while(n>0 && cp[n-1]!='\n')
+                       n--;
+               if(n)
+                       m = n;
+               r = regrexec(rp,cp,m,0,(regmatch_t*)0, 0, '\n', (void*)&match, 
pat_seek);
+               if(r<0)
+                       m = match-cp;
+               else if(r==2)
+               {
+                       if((m = pat_line(rp,cp,m)) < n)
+                               r = -1;
+               }
+               if(m && (flags&IOCOPY))
+                       sfwrite(sfstdout,cp,m);
+               sfread(sp,cp,m);
+               if(r<0)
+                       break;
+       }
+       if(!close_exec)
+               sh.fdstatus[sffileno(sp)] &= ~IOCLEX;
+       return(0);
+}
+
 static Sfoff_t file_offset(int fn, char *fname)
 {
        Sfio_t          *sp = sh.sftable[fn];
@@ -610,6 +680,7 @@
                }
                io_op[2] = 0;
                io_op[3] = 0;
+               io_op[4] = 0;
                fname = iop->ioname;
                if(!(iof&IORAW))
                {
@@ -625,19 +696,29 @@
                                
fname=sh_mactrim(fname,(!sh_isoption(SH_NOGLOB)&&sh_isoption(SH_INTERACTIVE))?2:0);
                }
                errno=0;
+               if(iop->iovname)
+               {
+                       np = 
nv_open(iop->iovname,sh.var_tree,NV_NOASSIGN|NV_VARNAME);
+                       if(nv_isattr(np,NV_RDONLY))
+                               errormsg(SH_DICT,ERROR_exit(1),e_readonly, 
nv_name(np));
+                       io_op[0] = '}';
+                       if((iof&IOMOV) && *fname=='-')
+                               fn = nv_getnum(np);
+               }
+               if(iof&IOLSEEK)
+               {
+                       io_op[2] = '#';
+                       if(iof&IOARITH)
+                       {
+                               strcpy(&io_op[3]," ((");
+                               after = "))";
+                       }
+                       else if(iof&IOCOPY)
+                               io_op[3] = '#';
+                       goto traceit;
+               }
                if(*fname)
                {
-                       if(iop->iovname)
-                       {
-                               np = 
nv_open(iop->iovname,sh.var_tree,NV_NOASSIGN|NV_VARNAME);
-                               if(nv_isattr(np,NV_RDONLY))
-                                       
errormsg(SH_DICT,ERROR_exit(1),e_readonly, nv_name(np));
-                               if(traceon)
-                                       sfprintf(sfstderr,"{%s",nv_name(np));
-                               io_op[0] = '}';
-                               if((iof&IOMOV) && *fname=='-')
-                                       fn = nv_getnum(np);
-                       }
                        if(iof&IODOC)
                        {
                                if(traceon)
@@ -709,16 +790,6 @@
                                        sh_close(toclose);
                                }
                        }
-                       else if(iof&IOLSEEK)
-                       {
-                               io_op[2] = '#';
-                               if(iof&IOARITH)
-                               {
-                                       strcpy(&io_op[3]," ((");
-                                       after = "))";
-                               }
-                               goto traceit;
-                       }
                        else if(iof&IORDW)
                        {
                                io_op[2] = '>';
@@ -774,7 +845,11 @@
                        }
                traceit:
                        if(traceon && fname)
+                       {
+                               if(np)
+                                       sfprintf(sfstderr,"{%s",nv_name(np));
                                sfprintf(sfstderr,"%s 
%s%s%c",io_op,fname,after,iop->ionxt?' ':'\n');
+                       }
                        if(flag==SH_SHOWME)
                                return(indx);
                        if(trace && fname)
@@ -827,9 +902,27 @@
                                }
                                else
                                {
+                                       regex_t *rp;
                                        extern const char e_notimp[];
-                                       message = e_notimp;
-                                       goto fail;
+                                       if(!(r&IOREAD))
+                                       {
+                                               message = e_noread;
+                                               goto fail;
+                                       }
+                                       if(!(rp = regcache(fname, 
REG_SHELL|REG_NOSUB|REG_NEWLINE|REG_AUGMENTED|REG_FIRST|REG_LEFT|REG_RIGHT, 
&r)))
+                                       {
+                                               message = e_badpattern;
+                                               goto fail;
+                                       }
+                                       if(!sp)
+                                               sp = sh_iostream(fn);
+                                       r=io_patseek(rp,sp,iof);
+                                       if(sp && flag==3)
+                                       {
+                                               /* close stream but not fn */
+                                               sfsetfd(sp,-1);
+                                               sfclose(sp);
+                                       }
                                }
                                if(r<0)
                                        goto fail;
@@ -1298,7 +1391,7 @@
        }
        if(sh_isstate(SH_INTERACTIVE) && io_prompt(iop,sh.nextprompt)<0 && 
errno==EIO)
                return(0);
-       if(!(sh.fdstatus[sffileno(iop)]&IOCLEX) && sfset(iop,0,0)&SF_SHARE)
+       if(!(sh.fdstatus[sffileno(iop)]&IOCLEX) && (sfset(iop,0,0)&SF_SHARE))
                size = ed_read(sh.ed_context, fd, (char*)buff, size,0);
        else
                size = read(fd, (char*)buff, size);
@@ -1912,6 +2005,13 @@
        return(newfd);
 }
 
+#undef umask
+mode_t sh_umask(mode_t m)
+{
+       sh.mask = m;
+       return(umask(m));
+}
+
 /*
  * give file descriptor <fd> and <mode>, return an iostream pointer
  * <mode> must be SF_READ or SF_WRITE
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/sh/jobs.c 
ksh93_2006_10_31/src/cmd/ksh93/sh/jobs.c
--- ksh93_2006_09_12/src/cmd/ksh93/sh/jobs.c    2006-09-07 21:52:00.000000000 
+0200
+++ ksh93_2006_10_31/src/cmd/ksh93/sh/jobs.c    2006-10-25 02:55:22.000000000 
+0200
@@ -124,7 +124,6 @@
 static struct process  *freelist;
 static char            beenhere;
 static char            possible;
-static int             savesig;
 static struct process  dummy;
 static char            by_number;
 static Sfio_t          *outfile;
@@ -135,7 +134,6 @@
 #ifdef JOBS
     static void                        job_set(struct process*);
     static void                        job_reset(struct process*);
-    static int                 job_reap(int);
     static void                        job_waitsafe(int);
     static struct process      *job_byname(char*);
     static struct process      *job_bystring(char*);
@@ -174,16 +172,13 @@
 
 #ifdef JOBS
 
-#define job_lock()     (job.in_critical++)
-#define job_unlock()   
do{if(!--job.in_critical&&savesig)job_reap(savesig);}while(0)
-
 typedef int (*Waitevent_f)(int,long,int);
 
 /*
  * Reap one job
  * When called with sig==0, it does a blocking wait
  */
-static int job_reap(register int sig)
+int job_reap(register int sig)
 {
        register pid_t pid;
        register struct process *pw;
@@ -199,7 +194,7 @@
                write(2,"waitsafe\n",9);
        sfsync(sfstderr);
 #endif /* DEBUG */
-       savesig = 0;
+       job.savesig = 0;
        if(sig)
                flags = WNOHANG|WUNTRACED|wcontinued;
        else
@@ -359,7 +354,7 @@
 {
        if(job.in_critical)
        {
-               savesig = sig;
+               job.savesig = sig;
                job.waitsafe++;
        }
        else
@@ -1083,7 +1078,7 @@
        pw->p_pgrp = pw->p_fgrp;
 #ifdef DEBUG
        sfprintf(sfstderr,"ksh: job line %4d: post pid=%d critical=%d job=%d 
pid=%d pgid=%d savesig=%d 
join=%d\n",__LINE__,getpid(),job.in_critical,pw->p_job,
-               pw->p_pid,pw->p_pgrp,savesig,join);
+               pw->p_pid,pw->p_pgrp,job.savesig,join);
        sfsync(sfstderr);
 #endif /* DEBUG */
 #ifdef JOBS
@@ -1294,7 +1289,7 @@
                }
                sfsync(sfstderr);
                job.waitsafe = 0;
-               nochild = job_reap(savesig);
+               nochild = job_reap(job.savesig);
                if(job.waitsafe)
                        continue;
                if(nochild)
@@ -1363,6 +1358,7 @@
        if(bgflag=='b')
        {
                sfprintf(outfile,"[%d]\t",(int)pw->p_job);
+               sh.bckpid = pw->p_pid;
                msg = "&";
        }
        else
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/sh/lex.c 
ksh93_2006_10_31/src/cmd/ksh93/sh/lex.c
--- ksh93_2006_09_12/src/cmd/ksh93/sh/lex.c     2006-09-07 22:02:52.000000000 
+0200
+++ ksh93_2006_10_31/src/cmd/ksh93/sh/lex.c     2006-10-31 16:30:28.000000000 
+0100
@@ -78,6 +78,7 @@
        char            balance;
        char            warn;
        char            message;
+       char            arith;
        char            *first;
        int             level;
        int             lastc;
@@ -173,12 +174,11 @@
        register Sfio_t *log= shp->funlog;
 #if KSHELL
        /* write to history file and to stderr if necessary */
-       if(!sfstacked(iop))
+       if(iop && !sfstacked(iop))
        {
                if(sh_isstate(SH_HISTORY) && shp->hist_ptr)
                        log = shp->hist_ptr->histfp;
-               if(iop)
-                       sfwrite(log, (void*)buff, size);
+               sfwrite(log, (void*)buff, size);
                if(sh_isstate(SH_VERBOSE))
                        sfwrite(sfstderr, buff, size);
        }
@@ -347,6 +347,7 @@
                shlex.assignok |= lex.reservok;
        if(lex.comp_assign==2)
                lex.comp_assign = lex.reservok = 0;
+       lexd.arith = (lexd.nest==1);
        if(lexd.nest)
        {
                pushlevel(lexd.nest,ST_NONE);
@@ -764,7 +765,7 @@
                                        ingrave = !ingrave;
                                /* FALL THRU */
                        case S_QUOTE:
-                               if(oldmode()==ST_NONE)  /*  in ((...)) */
+                               if(oldmode()==ST_NONE && lexd.arith)    /*  in 
((...)) */
                                        continue;
                                if(n==S_QUOTE)
                                        wordflags |=ARG_QUOTED;
@@ -1476,6 +1477,10 @@
                                shlex.lastline = line;
                                shlex.lasttok = LPAREN;
                                sh_syntax();
+                           case IOSEEKSYM:
+                               if(fcgetc(c)!='#' && c>0)
+                                       fcseek(-1);
+                               break;
                            case IODOCSYM:
                                sh_lex();
                                break;
@@ -1958,7 +1963,7 @@
        register int n;
        register char *sp,*dp;
        register int inquote=0, inlit=0; /* set within quoted strings */
-       struct argnod* argp;
+       struct argnod* argp=0;
        char    *ep=0, *xp=0;
        int bracket=0;
        stakputc(0);
@@ -2234,9 +2239,10 @@
 {
        register struct alias *ap = (struct alias*)handle;
        register Namval_t *np;
-       register Lex_t  *lp = ap->lp;
+       register Lex_t  *lp;
        if(type==0 || type==SF_ATEXIT || !ap)
                return(0);
+       lp = ap->lp;
        np = ap->np;
        if(type!=SF_READ)
        {
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/sh/macro.c 
ksh93_2006_10_31/src/cmd/ksh93/sh/macro.c
--- ksh93_2006_09_12/src/cmd/ksh93/sh/macro.c   2006-08-28 23:57:28.000000000 
+0200
+++ ksh93_2006_10_31/src/cmd/ksh93/sh/macro.c   2006-10-27 20:47:03.000000000 
+0200
@@ -100,8 +100,8 @@
 static void    endfield(Mac_t*,int);
 static void    mac_error(Namval_t*);
 static char    *mac_getstring(char*);
+static int     charlen(const char*,int);
 #if SHOPT_MULTIBYTE
-    static int charlen(const char*,int);
     static char        *lastchar(const char*,const char*);
 #endif /* SHOPT_MULTIBYTE */
 
@@ -741,7 +741,7 @@
                while((c= *cp++) && c!=ESCAPE);
                if(c==0)
                        break;
-               if((n= *cp++) >='0' && n<='9' && (n-='0')<subsize || n=='\\' || 
n==RBRACE)
+               if((n= *cp++)=='\\' || n==RBRACE || (n>='0' && n<='9' && 
(n-='0')<subsize))
                {
                        c = cp-first-2;
                        if(c)
@@ -912,8 +912,8 @@
        register Namval_t       *np = NIL(Namval_t*);
        register int    dolg=0, mode=0;
        Namarr_t        *ap=0;
-       int             dolmax=0, vsize= -1, offset, nulflg, replen=0, bysub=0;
-       char            idbuff[2], *id = idbuff, *pattern=0, *repstr;
+       int             dolmax=0, vsize= -1, offset= -1, nulflg, replen=0, 
bysub=0;
+       char            idbuff[3], *id = idbuff, *pattern=0, *repstr;
        int             oldpat=mp->pattern,idnum=0,flag=0,d;
 retry1:
        mp->zeros = 0;
@@ -1067,7 +1067,7 @@
                        {
                                idbuff[0] = mode = c;
                                if((d=fcpeek(0))==c)
-                                       idbuff[2] = fcget();
+                                       idbuff[1] = fcget();
                                if(type==M_VNAME)
                                        type = M_NAMESCAN;
                                else
@@ -1113,7 +1113,11 @@
 #ifdef SHOPT_TYPEDEF
                        else if(type==M_TYPE)
                        {
+#if 0
                                Namval_t *nq = nv_type(np);
+#else
+                               Namval_t *nq = 0;
+#endif
                                type = M_BRACE;
                                if(nq)
                                        v = nv_name(nq);
@@ -1134,7 +1138,7 @@
                        {
                                v = nv_getval(np);
                                /* special case --- ignore leading zeros */  
-                               if( (mp->arith||mp->let) && 
!nv_isattr(np,NV_INTEGER) && (offset==0 || !isalnum(*((unsigned 
char*)stakptr(offset-1)))))
+                               if( (mp->arith||mp->let) && (np->nvfun || 
nv_isattr(np,(NV_LJUST|NV_RJUST|NV_ZFILL))) && (offset==0 || 
!isalnum(*((unsigned char*)stakptr(offset-1)))))
                                        mp->zeros = 1;
                        }
                }
@@ -1143,8 +1147,10 @@
                stakseek(offset);
                if(ap)
                {
+#if SHOPT_OPTIMIZE
                        if(sh.argaddr)
                                nv_optimize(np);
+#endif
                        if(isastchar(mode) && array_elem(ap)> !c)
                                dolg = -1;
                        else
@@ -1196,16 +1202,7 @@
                else
                {
                        if(!isastchar(mode))
-#if SHOPT_MULTIBYTE
-                               c = (v?charlen(v,vsize):0);
-#else
-#   if  SHOPT_FILESCAN
-                               if(vsize>0)
-                                       c = vsize;
-                               else
-#   endif  /* SHOPT_FILESCAN */
-                               c = (v?strlen(v):0);
-#endif /* SHOPT_MULTIBYTE */
+                               c = charlen(v,vsize);
                        else if(dolg>0)
                        {
 #if  SHOPT_FILESCAN
@@ -1358,12 +1355,25 @@
                }
                else if(v)
                {
-                       if(vsize<0)
-                               vsize=strlen(v);
+                       vsize = charlen(v,vsize);
                        if(type<0 && (type += vsize)<0)
                                type = 0;
                        if(vsize < type)
                                v = 0;
+#if SHOPT_MULTIBYTE
+                       else if(mbwide())
+                       {
+                               mbinit();
+                               while(type-->0)
+                               {
+                                       if((c=mbsize(v))<1)
+                                               c = 1;
+                                       v += c;
+                                       vsize -= c;
+                               }
+                               c = ':';
+                       }
+#endif /* SHOPT_MULTIBYTE */
                        else
                        {
                                v += type;
@@ -1385,7 +1395,24 @@
                                        dolmax = type;
                        }
                        else if(type < vsize)
+                       {
+#if SHOPT_MULTIBYTE
+                               if(mbwide())
+                               {
+                                       char *vp = v;
+                                       mbinit();
+                                       while(type-->0)
+                                       {
+                                               if((c=mbsize(vp))<1)
+                                                       c = 1;
+                                               vp += c;
+                                       }
+                                       type = vp-v;
+                                       c = ':';
+                               }
+#endif /* SHOPT_MULTIBYTE */
                                vsize = type;
+                       }
                }
                if(*ptr)
                        mac_error(np);
@@ -1416,7 +1443,7 @@
                pattern = strdup(argp);
                if((type=='/' || c=='/') && (repstr = mac_getstring(pattern)))
                        replen = strlen(repstr);
-               if(v || c=='/')
+               if(v || c=='/' && offset>=0)
                        stakseek(offset);
        }
 retry2:
@@ -1568,12 +1595,14 @@
                        mac_error(np);
                }
        }
-       else if(sh_isoption(SH_NOUNSET))
+       else if(sh_isoption(SH_NOUNSET) && (!np  || nv_isnull(np)))
        {
-               nv_close(np);
+               if(np)
+                       nv_close(np);
                errormsg(SH_DICT,ERROR_exit(1),e_notset,id);
        }
-       nv_close(np);
+       if(np)
+               nv_close(np);
        return(1);
 nosub:
        if(type)
@@ -1669,14 +1698,14 @@
                        register int fd;
                        int r;
                        struct checkpt buff;
-                       struct ionod *ip;
+                       struct ionod *ip=0;
                        sh_pushcontext(&buff,SH_JMPIO);
                        if((ip=t->tre.treio) && 
                                ((ip->iofile&IOLSEEK) || !(ip->iofile&IOUFD)) &&
                                (r=sigsetjmp(buff.buff,0))==0)
                                fd = sh_redirect(ip,3);
                        else
-                               fd = sh_chkopen((char*)"/dev/null");
+                               fd = sh_chkopen(e_devnull);
                        sh_popcontext(&buff);
                        if(r==0 && ip && (ip->iofile&IOLSEEK))
                        {
@@ -2043,30 +2072,34 @@
                }
                return(str);
        }
-       static int      charlen(const char *string,int len)
+#endif /* SHOPT_MULTIBYTE */
+static int     charlen(const char *string,int len)
+{
+       if(!string)
+               return(0);
+#if SHOPT_MULTIBYTE
+       if(mbwide())
        {
-               if(mbwide())
+               register const char *str = string, *strmax=string+len;
+               register int n=0;
+               mbinit();
+               if(len>0)
                {
-                       register const char *str = string, *strmax=string+len;
-                       register int n=0;
-                       mbinit();
-                       if(len>0)
-                       {
-                               while(str<strmax && mbchar(str))
-                                       n++;
-                       }
-                       else while(mbchar(str))
+                       while(str<strmax && mbchar(str))
                                n++;
-                       return(n);
-               }
-               else
-               {
-                       if(len<0)
-                               return(strlen(string));
-                       return(len);
                }
+               else while(mbchar(str))
+                       n++;
+               return(n);
        }
+       else
 #endif /* SHOPT_MULTIBYTE */
+       {
+               if(len<0)
+                       return(strlen(string));
+               return(len);
+       }
+}
 
 /*
  * This is the default tilde discipline function
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/sh/name.c 
ksh93_2006_10_31/src/cmd/ksh93/sh/name.c
--- ksh93_2006_09_12/src/cmd/ksh93/sh/name.c    2006-09-08 23:16:15.000000000 
+0200
+++ ksh93_2006_10_31/src/cmd/ksh93/sh/name.c    2006-10-11 22:22:20.000000000 
+0200
@@ -23,6 +23,8 @@
  *
  */
 
+#define putenv ___putenv
+
 #include       "defs.h"
 #include       <ctype.h>
 #include       "variables.h"
@@ -1898,8 +1900,11 @@
        }
        else if((str=nv_getval(np)) && *str!=0)
        {
-               while(*str=='0')
-                       str++;
+               if(np->nvfun ||  nv_isattr(np,NV_LJUST|NV_RJUST|NV_ZFILL))
+               {
+                       while(*str=='0')
+                               str++;
+               }
                r = sh_arith(str);
        }
        return(r);
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/sh/nvtree.c 
ksh93_2006_10_31/src/cmd/ksh93/sh/nvtree.c
--- ksh93_2006_09_12/src/cmd/ksh93/sh/nvtree.c  2006-09-07 01:15:01.000000000 
+0200
+++ ksh93_2006_10_31/src/cmd/ksh93/sh/nvtree.c  2006-10-16 22:42:37.000000000 
+0200
@@ -213,7 +213,7 @@
                                        dp->prev = save;
                                        dp->root = root;
                                        dp->len = 0;
-                                       if(np->nvfun)
+                                       if(nfp && np->nvfun)
                                        {
                                                dp->nextnode = nfp->disc->nextf;
                                                dp->table = np;
@@ -247,7 +247,7 @@
 
 static void outtype(Namval_t *np, Namfun_t *fp, Sfio_t* out, const char 
*prefix)
 {
-       char *type;
+       char *type=0;
        Namval_t *tp = fp->type;
        if(!tp && fp->disc && fp->disc->typef) 
                tp = (*fp->disc->typef)(np,fp);
@@ -374,14 +374,16 @@
        }
 }
 
-static void outval(char *name, char *vname, Sfio_t *outfile, int indent, int 
noscope)
+static void outval(char *name, const char *vname, Sfio_t *outfile, int indent, 
int noscope)
 {
-       register Namval_t *np;
+       register Namval_t *np, *nq;
         register Namfun_t *fp;
-       int isarray, associative=0;
+       int isarray=0, associative=0, special=0;
        
if(!(np=nv_open(vname,sh.var_tree,NV_ARRAY|NV_VARNAME|NV_NOADD|NV_NOASSIGN|noscope)))
                return;
-       if(fp=nv_hasdisc(np,&treedisc))
+       if(nv_isarray(np) && *name=='.')
+               special = 1;
+       if(!special && (fp=nv_hasdisc(np,&treedisc)))
        {
                if(!outfile)
                {
@@ -394,15 +396,14 @@
        }
        if(nv_isnull(np))
                return;
-       isarray=0;
-       if(nv_isattr(np,NV_ARRAY))
+       if(special || nv_isarray(np))
        {
                isarray=1;
+               associative= nv_aindex(np)<0;
                if(array_elem(nv_arrayptr(np))==0)
                        isarray=2;
                else
-                       nv_putsub(np,NIL(char*),ARRAY_SCAN);
-               associative= nv_aindex(np)<0;
+                       nq = 
nv_putsub(np,NIL(char*),ARRAY_SCAN|(outfile?ARRAY_NOCHILD:0));
        }
        if(!outfile)
        {
@@ -410,24 +411,35 @@
                nv_close(np);
                return;
        }
-       sfnputc(outfile,'\t',indent);
-       nv_attribute(np,outfile,"typeset",'=');
-       nv_outname(outfile,name,-1);
-       sfputc(outfile,(isarray==2?'\n':'='));
-
-       if(isarray)
+       if(isarray==1 && !nq)
+               return;
+       if(special)
        {
-               if(isarray==2)
-                       return;
-               sfwrite(outfile,"(\n",2);
-               sfnputc(outfile,'\t',++indent);
+               associative = 1;
+               sfnputc(outfile,'\t',indent);
+       }
+       else
+       {
+               sfnputc(outfile,'\t',indent);
+               nv_attribute(np,outfile,"typeset",'=');
+               nv_outname(outfile,name,-1);
+               sfputc(outfile,(isarray==2?'\n':'='));
+               if(isarray)
+               {
+                       if(isarray==2)
+                               return;
+                       sfwrite(outfile,"(\n",2);
+                       sfnputc(outfile,'\t',++indent);
+               }
        }
        while(1)
        {
                char *fmtq,*ep;
                if(isarray && associative)
                {
-                       sfprintf(outfile,"[%s]",sh_fmtq(nv_getsub(np)));
+                       if(!(fmtq = nv_getsub(np)))
+                               break;
+                       sfprintf(outfile,"[%s]",sh_fmtq(fmtq));
                        sfputc(outfile,'=');
                }
                if(!(fmtq = sh_fmtq(nv_getval(np))))
@@ -450,7 +462,7 @@
                        break;
                sfnputc(outfile,'\t',indent);
        }
-       if(isarray)
+       if(isarray && !special)
        {
                sfnputc(outfile,'\t',--indent);
                sfwrite(outfile,")\n",2);
@@ -506,6 +518,8 @@
                        else if(outfile && argv[1] && 
memcmp(arg,argv[1],r=strlen(arg))==0 && argv[1][r]=='[')
                        {
                                Namval_t *np = 
nv_open(arg,sh.var_tree,NV_VARNAME|NV_NOADD|NV_NOASSIGN|noscope);
+                               if(!np)
+                                       continue;
                                sfnputc(outfile,'\t',indent);
                                nv_attribute(np,outfile,"typeset",1);
                                nv_close(np);
@@ -528,13 +542,13 @@
        }
        if(outfile)
        {
-               int c;
+               int c = prefix[m-1];
                cp = (char*)prefix;
-               m += *cp=='[';
-               c = cp[m-1];
-               cp[m-1] = 0;
-               outval(".",cp-n,outfile,indent,noscope);
-               cp[m-1] = c;
+               if(c=='.')
+                       cp[m-1] = 0;
+               outval(".",prefix-n,outfile,indent,noscope);
+               if(c=='.')
+                       cp[m-1] = c;
                sfnputc(outfile,'\t',indent-1);
                sfputc(outfile,')');
        }
@@ -606,6 +620,8 @@
        NOT_USED(fp);
        if(nv_isattr(np,NV_BINARY) &&  nv_isattr(np,NV_RAW))
                return(nv_getv(np,fp));
+       if(nv_isattr(np,NV_ARRAY) && nv_arraychild(np,(Namval_t*)0,0)==np)
+               return(nv_getv(np,fp));
        return(walk_tree(np,0));
 }
 
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/sh/parse.c 
ksh93_2006_10_31/src/cmd/ksh93/sh/parse.c
--- ksh93_2006_09_12/src/cmd/ksh93/sh/parse.c   2006-08-30 16:25:17.000000000 
+0200
+++ ksh93_2006_10_31/src/cmd/ksh93/sh/parse.c   2006-10-24 04:19:26.000000000 
+0200
@@ -98,7 +98,7 @@
        register char *cp;
        register int n,eline;
        int width=0;
-       unsigned long r;
+       unsigned long r=0;
        static char atbuff[20];
        int  justify=0;
        char *attribute = atbuff;
@@ -930,7 +930,7 @@
                        (tok==ELIFSYM?(shlex.token=IFSYM, tt=item(SH_NOIO)):0));
                if(tok==ELIFSYM)
                {
-                       if(tt->tre.tretyp!=TSETIO)
+                       if(!tt || tt->tre.tretyp!=TSETIO)
                                goto done;
                        t->if_.eltre = tt->fork.forktre;
                        tt->fork.forktre = t;
@@ -1134,7 +1134,7 @@
                        shlex.token = LBRACE;
                        break;
                }
-               if(associative && (!argp || argp->argval[0]!='['))
+               if(associative && argp->argval[0]!='[')
                        sh_syntax();
                /* check for assignment argument */
                if((argp->argflag&ARG_ASSIGN) && assignment!=2)
@@ -1359,7 +1359,14 @@
                else if(token==IORDWRSYM)
                        iof |= IORDW;
                else if((token&SYMSHARP) == SYMSHARP)
+               {
+                       int n;
                        iof |= IOLSEEK;
+                       if(fcgetc(n)=='#')
+                               iof |= IOCOPY;
+                       else if(n>0)
+                               fcseek(-1);
+               }
                break;
 
            case '>':
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/sh/path.c 
ksh93_2006_10_31/src/cmd/ksh93/sh/path.c
--- ksh93_2006_09_12/src/cmd/ksh93/sh/path.c    2006-06-06 05:49:20.000000000 
+0200
+++ ksh93_2006_10_31/src/cmd/ksh93/sh/path.c    2006-10-18 09:32:00.000000000 
+0200
@@ -41,11 +41,9 @@
 #      include <exec_attr.h>
 #   endif
 #endif
-#ifndef ARG_MAX
-#   define ARG_MAX     4096
-#endif
 
 #define RW_ALL (S_IRUSR|S_IRGRP|S_IROTH|S_IWUSR|S_IWGRP|S_IWOTH)
+#define LIBCMD "cmd"
 
 
 static int             canexecute(char*,int);
@@ -53,6 +51,20 @@
 static void            exscript(Shell_t*,char*, char*[], char**);
 static int             path_chkpaths(Pathcomp_t*,Pathcomp_t*,Pathcomp_t*,int);
 
+static const char      *std_path;
+
+static int onstdpath(const char *name)
+{
+       register const char *cp = std_path, *sp;
+       while(*cp)
+       {
+               for(sp=name; *sp && (*cp == *sp); sp++,cp++);
+               if(*sp==0 && (*cp==0 || *cp==':'))
+                       return(1);
+               while(*cp && *cp++!=':');
+       }
+       return(0);
+}
 
 static int path_pfexecve(const char *path, char *argv[],char *const envp[])
 {
@@ -99,10 +111,10 @@
 static pid_t _spawnveg(const char *path, char* const argv[], char* const 
envp[], pid_t pid)
 {
        int waitsafe = job.waitsafe;
-       job.in_critical++;
+       job_lock();
        pid = spawnveg(path,argv,envp,pid);
        job.waitsafe = waitsafe;
-       job.in_critical--;
+       job_unlock();
        return(pid);
 }
 /*
@@ -112,18 +124,15 @@
  */
 static pid_t path_xargs(const char *path, char *argv[],char *const envp[], int 
spawn)
 {
-       static long argmax;
        register char *cp, **av, **xv;
        char **avlast= &argv[sh.xargmax], **saveargs=0;
        char *const *ev;
        long size, left;
        int nlast=1,n,exitval=0;
        pid_t pid;
-       if(!argmax && (argmax = sysconf(_SC_ARG_MAX)) < 0)
-               argmax = ARG_MAX;
        if(sh.xargmin < 0)
                return((pid_t)-1);
-       size = argmax-1024;
+       size = sh.lim.arg_max-1024;
        for(ev=envp; cp= *ev; ev++)
                size -= strlen(cp)-1;
        for(av=argv; (cp= *av) && av< &argv[sh.xargmin]; av++)  
@@ -247,7 +256,20 @@
 
 static void free_bltin(Namval_t *np,void *data)
 {
-       if((void*)np->nvenv==data)
+       register Pathcomp_t *pp= (Pathcomp_t*)data;
+       if(pp->flags&PATH_STD_DIR)
+       {
+               int offset=staktell();;
+               if(strcmp(pp->name,"/bin")==0 || 
memcmp(pp->name,np->nvname,pp->len) || np->nvname[pp->len]!='/')
+                       return;
+               stakputs("/bin");
+               stakputs(np->nvname+pp->len+1);
+               stakputc(0);
+               sh_addbuiltin(stakptr(offset),np->nvalue.bfp,NiL);
+               stakseek(offset);
+               return;
+       }
+       if((void*)np->nvenv==pp->bltin_lib)
                dtdelete(sh_bltin_tree(),np);
 }
 
@@ -264,10 +286,13 @@
                {
                        if(pp->lib)
                                free((void*)pp->lib);
-                       if(pp->bltin_lib)
+                       if(pp->blib)
+                               free((void*)pp->blib);
+                       if(pp->bltin_lib || (pp->flags&PATH_STD_DIR))
                        {
-                               
nv_scan(sh_bltin_tree(),free_bltin,pp->bltin_lib,0,0);
-                               dlclose(pp->bltin_lib);
+                               nv_scan(sh_bltin_tree(),free_bltin,pp,0,0);
+                               if(pp->bltin_lib)
+                                       dlclose(pp->bltin_lib);
                        }
                        free((void*)pp);
                        if(old)
@@ -374,8 +399,7 @@
 
 static Pathcomp_t* defpath_init(Shell_t *shp)
 {
-       const char *val = astconf("PATH",NIL(char*),NIL(char*));
-       Pathcomp_t *pp = 
(void*)path_addpath((Pathcomp_t*)0,(val?val:e_defpath),PATH_PATH);
+       Pathcomp_t *pp = 
(void*)path_addpath((Pathcomp_t*)0,(std_path),PATH_PATH);
        if(shp->defpathlist = (void*)pp)
                pp->shp = shp;
        return(pp);
@@ -385,6 +409,8 @@
 {
        const char *val;
        Pathcomp_t *pp;
+       if(!std_path && !(std_path=astconf("PATH",NIL(char*),NIL(char*))))
+               std_path = e_defpath;
        if(val=nv_scoped((PATHNOD))->nvalue.cp)
        {
                pp = 
(void*)path_addpath((Pathcomp_t*)shp->pathlist,val,PATH_PATH);
@@ -621,6 +647,7 @@
        int             noexec=0;
        Pathcomp_t      *pp,*oldpp;
        Shell_t         *shp = &sh;
+       Namval_t        *np;
        shp->path_err = ENOENT;
        if(!(pp=path_get("")))
                return(0);
@@ -635,15 +662,36 @@
                        return(endpath);
                if(!isfun)
                {
-                       if(oldpp->bltin_lib)
+                       if(nv_search(stakptr(PATH_OFFSET),sh.bltin_tree,0))
+                               return(oldpp);
+                       if(oldpp->blib)
                        {
                                typedef int (*Fptr_t)(int, char*[], void*);
-                               Namval_t *np;
                                Fptr_t addr;
                                int n = staktell();
+                               char *cp;
                                stakputs("b_");
                                stakputs(name);
                                stakputc(0);
+                               if(!oldpp->bltin_lib)
+                               {
+                                       if(cp = strrchr(oldpp->blib,'/'))
+                                               cp++;
+                                       else
+                                               cp = oldpp->blib;
+                                       if(strcmp(cp,LIBCMD)==0 && 
(addr=(Fptr_t)dlllook((void*)0,stakptr(n))))
+                                       {
+                                               np = 
sh_addbuiltin(stakptr(PATH_OFFSET),addr,NiL);
+                                               np->nvfun = 
(Namfun_t*)np->nvname;
+                                               return(oldpp);
+                                       }
+#if (_AST_VERSION>=20040404)
+                                       if (oldpp->bltin_lib = dllplug("ksh", 
oldpp->blib, NiL, RTLD_LAZY, NiL, 0))
+#else
+                                       if (oldpp->bltin_lib = 
dllfind(oldpp->blib, NiL, RTLD_LAZY, NiL, 0))
+#endif
+                                               sh_addlib(oldpp->bltin_lib);
+                               }
                                
if((addr=(Fptr_t)dlllook(oldpp->bltin_lib,stakptr(n))) &&
                                   (!(np = 
sh_addbuiltin(stakptr(PATH_OFFSET),NiL,NiL)) || np->nvalue.bfp!=addr) &&
                                   (np = 
sh_addbuiltin(stakptr(PATH_OFFSET),addr,NiL)))
@@ -652,8 +700,6 @@
                                        return(oldpp);
                                }
                        }
-                       else if((oldpp->flags & PATH_BUILTIN_SH) && 
nv_search(stakptr(PATH_OFFSET),sh.bltin_tree,0))
-                               return(oldpp);
                }
                f = canexecute(stakptr(PATH_OFFSET),isfun);
                if(isfun && f>=0)
@@ -663,6 +709,20 @@
                        f = -1;
                        return(0);
                }
+               else if(f>=0 && (oldpp->flags & PATH_STD_DIR))
+               {
+                       int offset = staktell();
+                       stakputs("/bin/");
+                       stakputs(name);
+                       stakputc(0);
+                       np = nv_search(stakptr(offset),sh.bltin_tree,0);
+                       stakseek(offset);
+                       if(np)
+                       {
+                               np = 
sh_addbuiltin(stakptr(PATH_OFFSET),np->nvalue.bfp,NiL);
+                               np->nvfun = (Namfun_t*)np->nvname;
+                       }
+               }
                if(!pp || f>=0)
                        break;
                if(errno!=ENOENT)
@@ -841,6 +901,7 @@
                {
                        buff[n] = 0;
                        n = PATH_OFFSET;
+                       r = 0;
                        if((v=strrchr(path,'/')) && *buff!='/')
                        {
                                if(buff[0]=='.' && buff[1]=='.' && (r = 
strlen(path) + 1) <= PATH_MAX)
@@ -868,9 +929,8 @@
                stakseek(0);
        }
 #endif
-       if(libenv)
+       if(libenv && (v = strchr(libenv,'=')))
        {
-               v = strchr(libenv,'=');
                n = v - libenv;
                *v = 0;
                np = nv_open(libenv,shp->var_tree,0);
@@ -1048,7 +1108,7 @@
                static char name[] = "/tmp/euidXXXXXXXXXX";
                register int n;
                register uid_t euserid;
-               char *savet;
+               char *savet=0;
                struct stat statb;
                if((n=sh_open(path,O_RDONLY,0)) >= 0)
                {
@@ -1085,7 +1145,8 @@
                 */
                if((n=open(path,O_RDONLY,0)) < 0)
                        errormsg(SH_DICT,ERROR_system(1),e_open,path);
-               *argv++ = savet;
+               if(savet)
+                       *argv++ = savet;
        openok:
                shp->infd = n;
        }
@@ -1212,17 +1273,6 @@
        register Pathcomp_t *pp, *oldpp;
        struct stat statb;
        int len, offset=staktell();
-       static ino_t    bin_inode;
-       static dev_t    bin_dev;
-       if(bin_inode==0)
-       {
-               bin_inode = 1;
-               if(stat("/bin",&statb)>=0 && S_ISDIR(statb.st_mode))
-               {
-                       bin_inode = statb.st_ino;
-                       bin_dev = statb.st_dev;
-               }
-       }
        if(!(flag&PATH_BFPATH))
        {
                register const char *cp = name;
@@ -1253,11 +1303,20 @@
        else if(stat(name,&statb)<0 || !S_ISDIR(statb.st_mode))
        {
                if(*name=='/')
-                       return(first);
-               flag |= PATH_SKIP;
+               {
+                       if(strcmp(name,SH_CMDLIB_DIR))
+                               return(first);
+                       statb.st_dev = 1;
+               }
+               else
+               {
+                       flag |= PATH_SKIP;
+                       statb.st_dev = 0;
+               }
                statb.st_ino = 0;
-               statb.st_dev = 0;
        }
+       if(*name=='/' && onstdpath(name))
+               flag |= PATH_STD_DIR;
        for(pp=first, oldpp=0; pp; oldpp=pp, pp=pp->next)
        {
                if(pp->ino==statb.st_ino && pp->dev==statb.st_dev)
@@ -1270,11 +1329,6 @@
                        flag |= PATH_SKIP;
                }
        }
-       if(statb.st_ino==bin_inode && statb.st_dev==bin_dev)
-       {
-               name = "/bin";
-               len = 4;
-       }
        pp = newof((Pathcomp_t*)0,Pathcomp_t,1,len+1);
        pp->refcount = 1;
        memcpy((char*)(pp+1),name,len+1);
@@ -1287,6 +1341,13 @@
        else
                first = pp;
        pp->flags = flag;
+       if(pp->ino==0 && pp->dev==1)
+       {
+               pp->flags |= PATH_BUILTIN_LIB;
+               pp->blib = malloc(4);
+               strcpy(pp->blib,LIBCMD);
+               return(first);
+       }
        if(flag!=PATH_PATH)
                return(first);
        path_chkpaths(first,old,pp,offset);
@@ -1348,22 +1409,20 @@
                                {
                                        pp->flags |= PATH_BUILTIN_LIB;
                                        if (*ep == '.' && !*(ep + 1))
-                                               pp->flags |= PATH_BUILTIN_SH;
+                                               pp->flags |= PATH_STD_DIR;
                                        else
                                        {
-#if (_AST_VERSION>=20040404)
-                                               if (*ep != '/' && (sp = 
malloc(k = pp->len + strlen(ep) + 2)))
-                                                       sfsprintf(sp, k, 
"%s/%s", pp->name, ep);
-                                               else
-                                                       sp = ep;
-                                               if (pp->bltin_lib = 
dllplug("ksh", sp, NiL, RTLD_LAZY, NiL, 0))
-                                                       
sh_addlib(pp->bltin_lib);
-                                               if (sp != ep)
-                                                       free(sp);
-#else
-                                               if (pp->bltin_lib = dllfind(ep, 
NiL, RTLD_LAZY, NiL, 0))
-                                                       
sh_addlib(pp->bltin_lib);
-#endif
+                                               k = strlen(ep)+1;
+                                               if (*ep != '/')
+                                                       k +=  pp->len+1;
+                                               pp->blib = sp = malloc(k);
+                                               if (*ep != '/')
+                                               {
+                                                       
strcpy(pp->blib,pp->name);
+                                                       sp += pp->len;
+                                                       *sp++ = '/';
+                                               }
+                                               strcpy(sp,ep);
                                        }
                                }
                        }
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/sh/shcomp.c 
ksh93_2006_10_31/src/cmd/ksh93/sh/shcomp.c
--- ksh93_2006_09_12/src/cmd/ksh93/sh/shcomp.c  2004-08-02 22:49:20.000000000 
+0200
+++ ksh93_2006_10_31/src/cmd/ksh93/sh/shcomp.c  2006-10-13 05:59:15.000000000 
+0200
@@ -27,7 +27,7 @@
  */
 
 static const char usage[] =
-"[-?\n@(#)$Id: shcomp (AT&T Labs Research) 2003-03-02 $\n]"
+"[-?\n@(#)$Id: shcomp (AT&T Research) 2003-03-02 $\n]"
 USAGE_LICENSE
 "[+NAME?shcomp - compile a shell script]"
 "[+DESCRIPTION?Unless \b-D\b is specified, \bshcomp\b takes a shell script, "
@@ -60,6 +60,7 @@
 
 #include       <shell.h>
 #include       "shnodes.h"
+#include       "sys/stat.h"
 
 #define CNTL(x)        ((x)&037)
 #define VERSION        3
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/sh/subshell.c 
ksh93_2006_10_31/src/cmd/ksh93/sh/subshell.c
--- ksh93_2006_09_12/src/cmd/ksh93/sh/subshell.c        2006-06-12 
17:57:43.000000000 +0200
+++ ksh93_2006_10_31/src/cmd/ksh93/sh/subshell.c        2006-10-24 
16:19:13.000000000 +0200
@@ -75,13 +75,14 @@
        char            *pwd;   /* present working directory */
        const char      *shpwd; /* saved pointer to sh.pwd */
        void            *jobs;  /* save job info */
-       int             mask;   /* present umask */
+       mode_t          mask;   /* saved umask */
        short           tmpfd;  /* saved tmp file descriptor */
        short           pipefd; /* read fd if pipe is created */
        char            jobcontrol;
        char            monitor;
        unsigned char   fdstatus;
        int             fdsaved; /* bit make for saved files */
+       int             bckpid;
 } *subshell_data;
 
 static int subenv;
@@ -235,7 +236,7 @@
                        mp->nvenv = np->nvenv;
                mp->nvfun = np->nvfun;
                mp->nvflag = np->nvflag;
-               if(mp==nv_scoped(PATHNOD))
+               if((mp==nv_scoped(PATHNOD)) || (mp==nv_scoped(IFSNOD)))
                        nv_putval(mp, np->nvalue.cp,0);
                else
                        mp->nvalue.cp = np->nvalue.cp;
@@ -362,11 +363,12 @@
 #endif
        if(!shp->pwd)
                path_pwd(0);
+       sp->bckpid = shp->bckpid;
        if(!comsub || !sh_isoption(SH_SUBSHARE))
        {
                sp->shpwd = shp->pwd;
                sp->pwd = (shp->pwd?strdup(shp->pwd):0);
-               umask(sp->mask=umask(0));
+               sp->mask = shp->mask;
                /* save trap table */
                shp->st.otrapcom = 0;
                if((nsig=shp->st.trapmax*sizeof(char*))>0 || shp->st.trapcom[0])
@@ -487,6 +489,7 @@
 #endif
        job_subrestore(sp->jobs);
        shp->jobenv = savecurenv;
+       shp->bckpid = sp->bckpid;
        if(sp->shpwd)   /* restore environment if saved */
        {
                shp->options = sp->options;
@@ -534,7 +537,8 @@
                }
                else
                        free((void*)sp->pwd);
-               umask(sp->mask);
+               if(sp->mask!=shp->mask)
+                       umask(shp->mask);
        }
        subshell_data = sp->prev;
        sh_argfree(argsav,0);
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/sh/suid_exec.c 
ksh93_2006_10_31/src/cmd/ksh93/sh/suid_exec.c
--- ksh93_2006_09_12/src/cmd/ksh93/sh/suid_exec.c       2006-08-30 
16:03:43.000000000 +0200
+++ ksh93_2006_10_31/src/cmd/ksh93/sh/suid_exec.c       2006-10-04 
18:35:22.000000000 +0200
@@ -229,7 +229,9 @@
                
        if(mode)
                setids(mode, effuid, effgid);
+#ifndef _lib_setreuid
 exec:
+#endif /* _lib_setreuid */
        /* only use SHELL if file is in trusted directory and ends in sh */
        shell = getenv("SHELL");
        if(shell == 0 || !endsh(shell) || (
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/sh/trestore.c 
ksh93_2006_10_31/src/cmd/ksh93/sh/trestore.c
--- ksh93_2006_09_12/src/cmd/ksh93/sh/trestore.c        2005-04-08 
21:14:04.000000000 +0200
+++ ksh93_2006_10_31/src/cmd/ksh93/sh/trestore.c        2006-10-13 
22:24:57.000000000 +0200
@@ -163,7 +163,8 @@
                                        t->lst.lstrit = (Shnode_t*)r_arg();
                        }
        }
-       t->tre.tretyp = type;
+       if(t)
+               t->tre.tretyp = type;
        return(t);
 }
 
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/sh/waitevent.c 
ksh93_2006_10_31/src/cmd/ksh93/sh/waitevent.c
--- ksh93_2006_09_12/src/cmd/ksh93/sh/waitevent.c       1997-08-07 
09:30:03.000000000 +0200
+++ ksh93_2006_10_31/src/cmd/ksh93/sh/waitevent.c       2006-10-30 
17:40:11.000000000 +0100
@@ -36,3 +36,19 @@
        return((void*)old);
 }
 
+#if __OBSOLETE__ < 20080101
+/*
+ * this used to be a private symbol
+ * retain the old name for a bit for a smooth transition
+ */
+
+#if defined(__EXPORT__)
+#define extern         __EXPORT__
+#endif
+
+extern void    *_sh_waitnotify(int(*newevent)(int,long,int))
+{
+       return sh_waitnotify(newevent);
+}
+
+#endif
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/sh/xec.c 
ksh93_2006_10_31/src/cmd/ksh93/sh/xec.c
--- ksh93_2006_09_12/src/cmd/ksh93/sh/xec.c     2006-09-08 04:44:04.000000000 
+0200
+++ ksh93_2006_10_31/src/cmd/ksh93/sh/xec.c     2006-10-12 16:19:07.000000000 
+0200
@@ -248,8 +248,10 @@
 {
        while(arg)
        {
-               if(strlen(arg->argval) || (flag==0 && 
(arg->argflag&~(ARG_APPEND|ARG_EXP))))
+               if(strlen(arg->argval) || (arg->argflag==ARG_RAW))
                        arg->argchn.ap = 0;
+               else if(flag==0)
+                       sh_tclear((Shnode_t*)arg->argchn.ap);
                else
                        sh_tclear(((struct fornod*)arg->argchn.ap)->fortre);
                arg = arg->argnxt.ap;
@@ -347,9 +349,11 @@
        }
        if(level==oldlevel)
                return;
-       sp = sh_getscope(level,SEEK_SET);
-       sh_setscope(sp);
-       error_info.line = sp->lineno;
+       if(sp = sh_getscope(level,SEEK_SET))
+       {
+                       sh_setscope(sp);
+               error_info.line = sp->lineno;
+       }
        nv_putval(SH_PATHNAMENOD, sh.st.filename ,NV_NOFREE);
 }
 
@@ -875,8 +879,8 @@
                                        if(scope)
                                                nv_unscope();
                                        /* don't restore for subshell exec */
-                                       if(io && !sh.subshell || np!=SYSEXEC)
-                                               sh_iorestore(buff.topfd,jmpval);
+                                       if((sh.topfd>topfd) && !(sh.subshell && 
np==SYSEXEC))
+                                               sh_iorestore(topfd,jmpval);
                                        if(jmpval)
                                                siglongjmp(*sh.jmplist,jmpval);
                                        if(sh.exitval >=0)
@@ -1925,7 +1929,7 @@
                        sh_exit(SH_EXITSIG|sh.lastsig);
                if(was_interactive)
                        sh_onstate(SH_INTERACTIVE);
-               if(was_monitor)
+               if(was_monitor && sh_isoption(SH_MONITOR))
                        sh_onstate(SH_MONITOR);
                if(was_errexit)
                        sh_onstate(SH_ERREXIT);
@@ -2073,6 +2077,8 @@
                        }
                }
 #endif /* JOBS */
+               if(!sh_isstate(SH_MONITOR) && job.waitall && postid==0)
+                       job.curpgid = parent;
                if(flags&FCOOP)
                        sh.cpid = parent;
                myjob = job_post(parent,postid);
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/sh.1 
ksh93_2006_10_31/src/cmd/ksh93/sh.1
--- ksh93_2006_09_12/src/cmd/ksh93/sh.1 2006-09-08 18:23:36.000000000 +0200
+++ ksh93_2006_10_31/src/cmd/ksh93/sh.1 2006-10-31 02:59:42.000000000 +0100
@@ -629,6 +629,9 @@
 .TP
 \f3[\fP\f2word\^\fP\f3]=\fP\f2word\^\fP .\|.\|.
 Associative array assignment.
+If preceded by
+.B typeset \-a
+this will create an indexed array instead.
 .TP
 \f2assignment\^\fP .\|.\|.
 Compound variable assignment.
@@ -1424,7 +1427,10 @@
 file when checking for mail.
 .TP
 .B !
-The process number of the last background command invoked.
+The process number of the last background command invoked or
+the most recent job put in the background with the
+.B bg
+built-in command.
 .TP
 .B .sh.command
 When processing a
@@ -1611,16 +1617,15 @@
 .TP
 .B
 .SM EDITOR
-If the value of this variable ends in
-.IR emacs ,
-.IR gmacs ,
-or
-.I vi
-and the
+If the
 .B
 .SM VISUAL
 variable is not set,
-then the corresponding option
+the value of this variable will be checked for the patterns
+as described with
+.B
+.SM VISUAL
+below and the corresponding editing option
 (see Special Command
 .B set
 below)
@@ -2022,15 +2027,25 @@
 .TP
 .B
 .SM VISUAL
-If the value of this variable ends in
-.IR emacs ,
-.IR gmacs ,
-or
-.I vi
-then the corresponding option
+If the value of this variable matches the pattern
+.IR *[Vv][Ii]* ,
+then the
+.B vi
+option
 (see Special Command
 .B set
 below)
+is turned on.
+If the value matches the pattern
+.I *gmacs* ,
+the
+.B gmacs
+option is turned on.
+If the value matches the pattern
+.IR *macs* ,
+then the
+.B emacs
+option
 will be turned on.
 The value of
 .B
@@ -2715,13 +2730,13 @@
 When a variable is referenced, its value is evaluated as
 an arithmetic expression.
 .PP
-The following math library functions can be used with an arithmetic
-expression:
+Any of the following math library functions that are in the C math library
+can be used within an arithmetic expression: 
 .PP
 .if t .RS
 .B
-.if n abs acos asin atan atan2 cos cosh exp floor fmod hypot int log pow sin 
sinh sqrt tan tanh
-.if t abs   acos   asin   atan   atan2   cos   cosh   exp   floor  fmod   
hypot   int   log   pow   sin   sinh   sqrt   tan   tanh
+.if n abs acos acosh asin asinh atan atan2 atanh cbrt copysign cos cosh erf 
erfc exp exp2 expm1 fabs fdim finite floor fma fmax fmod hypot ilogb int isinf 
isnan lgamma log log2 logb nearbyint nextafter nexttoward pow remainder rint 
round sin sinh sqrt tan tanh tgamma trunc
+.if t abs   acos   acosh   asin   asinh   atan   atan2   atanh   cbrt   
copysign   cos   cosh   erf  erfc   exp   exp2   expm1   fabs   fdim   finite   
floor  fma   fmax   fmod   hypot   ilogb   int   isinf   isnan   lgamma   log   
log2   logb   nearbyint   nextafter   nextroward  pow   rint   round   sin   
sinh   sqrt   tan   tanh   tgamma   trunc
 .if t .RE
 .PP
 An internal representation of a
@@ -3123,6 +3138,7 @@
 In each of the following redirections, if
 .I file\^
 is of the form
+\f3/dev/sctp/\fP\f2host\fP\f3/\fP\f2port\fP,
 \f3/dev/tcp/\fP\f2host\fP\f3/\fP\f2port\fP,
 or
 \f3/dev/udp/\fP\f2host\fP\f3/\fP\f2port\fP,
@@ -3133,7 +3149,7 @@
 .I port\^
 is a service given by name or an integer port number,
 then the redirection attempts to make a
-\f3tcp\fP or \f3udp\fP connection to the corresponding
+\f3tcp\fP, \f3sctp\fP or \f3udp\fP connection to the corresponding
 socket.
 .PP
 No intervening space is allowed between the characters of redirection 
operators.
@@ -3269,6 +3285,16 @@
 The same as
 .B <#
 except applies to file descriptor 1.
+.TP
+.BI <# pattern 
+Seeks forward to the beginning of the next line containing
+.IR pattern .
+.TP
+.BI <## pattern 
+The same as
+.B <#
+except that the portion of the file that is skipped is copied to
+standard output.
 .PP
 If one of the above is preceded by a digit,
 with no intervening space, then the
@@ -5939,6 +5965,28 @@
 format can be followed by a
 .B .
 and the output base.
+In this case, the 
+.B #
+flag character caues
+.IB base #
+to be prepended.
+.LI
+The
+.B #
+flag when used with the
+.B d
+specifier without an output base,
+causes the output to be displayed in thousands units with one of the suffixes
+.B "k M G T P E"
+to indicate the unit.
+.LI
+The
+.B #
+flag when used with the
+.B i
+specifier causes the output to be displayed in 1024 with one of the suffixes
+.B "Ki Mi Gi Ti Pi Ei"
+to indicate the unit.
 .LE
 .TP
 \f3pwd\fP \*(OK \f3\-LP\fP \*(CK
@@ -6530,7 +6578,7 @@
 .B while
 for infinite loops.
 .TP
-\(dg\(dg \f3typeset\fP \*(OK \f3\(+-AHflbnprtux\^\fP \*(CK \*(OK 
\f3\(+-EFLRZi\*(OK\f2n\^\fP\*(CK \*(CK  \*(OK 
\f2vname\^\fP\*(OK\f3=\fP\f2value\^\fP \*(CK \^ \*(CK .\|.\|.
+\(dg\(dg \f3typeset\fP \*(OK \f3\(+-AHflabnprtux\^\fP \*(CK \*(OK 
\f3\(+-EFLRZi\*(OK\f2n\^\fP\*(CK \*(CK  \*(OK 
\f2vname\^\fP\*(OK\f3=\fP\f2value\^\fP \*(CK \^ \*(CK .\|.\|.
 Sets attributes and values for shell variables and functions.
 When invoked inside a function defined with the
 .B function
@@ -6552,6 +6600,12 @@
 Subscripts are strings rather than arithmetic
 expressions.
 .TP
+.B \-a
+Declares
+.I vname\^
+to be an indexed array.
+This is optional unless except for compound variable assignments.
+.TP
 .B \-E
 Declares
 .I vname\^
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/tests/arith.sh 
ksh93_2006_10_31/src/cmd/ksh93/tests/arith.sh
--- ksh93_2006_09_12/src/cmd/ksh93/tests/arith.sh       2006-06-29 
18:28:07.000000000 +0200
+++ ksh93_2006_10_31/src/cmd/ksh93/tests/arith.sh       2006-10-24 
16:29:06.000000000 +0200
@@ -318,7 +318,7 @@
 $SHELL -c 'typeset x$((10))=foo' 2> /dev/null || err_exit 'typeset x$((10)) 
parse error'
 unset x
 x=$(( exp(log(2.0)) ))
-(( x > 1.999 && x < 2.001 )) || err_exit 'composit functions not working'
+(( x > 1.999 && x < 2.001 )) || err_exit 'composite functions not working'
 unset x y n
 typeset -Z8 x=0 y=0
 integer n
@@ -346,6 +346,10 @@
 done   
 unset x
 x=010
+(( x == 8 )) || err_exit 'leading zeros not treated as octal arithmetic'
+(( $x == 8 )) || err_exit 'leading zeros not treated as octal arithmetic with 
$x'
+unset x
+typeset -Z x=010
 (( x == 10 )) || err_exit 'leading zeros not ignored for arithmetic'
 (( $x == 10 )) || err_exit 'leading zeros not ignored for arithmetic with $x'
 typeset -i i=x
@@ -455,4 +459,8 @@
        (( 4.0/Inf == 0.0 )) || err_exit '4.0/Inf != 0.0'
 else   err_exit 'Inf and NaN not working'
 fi
+unset x y
+float x=14.555 y
+y=$(printf "%a" x)
+(( x == y )) || err_exit 'output of printf %a not self preserving'
 exit $((Errors))
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/tests/basic.sh 
ksh93_2006_10_31/src/cmd/ksh93/tests/basic.sh
--- ksh93_2006_09_12/src/cmd/ksh93/tests/basic.sh       2006-06-28 
19:34:13.000000000 +0200
+++ ksh93_2006_10_31/src/cmd/ksh93/tests/basic.sh       2006-10-02 
23:25:17.000000000 +0200
@@ -290,6 +290,24 @@
 if     [[ -d /dev/fd && -w /dev/fd/3 ]]
 then   [[ $($SHELL -c 'cat <(print foo)' 2> /dev/null) == foo ]] || err_exit 
'process substitution not working'
        [[ $($SHELL -c 'print $(cat <(print foo) )' 2> /dev/null) == foo ]] || 
err_exit 'process substitution in subshell not working'
+       [[ $($SHELL -c  $'tee >(grep \'1$\' > /tmp/ksh'$$'x) > /dev/null <<-  
\!!!
+       line0
+       line1
+       line2
+       !!!
+       wait
+       cat /tmp/ksh'$$x 2> /dev/null)  == line1 ]] || err_exit '>() process 
substitution fails'
+       > /tmp/ksh$$x
+       [[ $($SHELL -c  $'
+       for i in 1
+       do      tee >(grep \'1$\' > /tmp/ksh'$$'x) > /dev/null  <<-  \!!!
+               line0
+               line1
+               line2
+               !!!
+       done
+       wait
+       cat /tmp/ksh'$$x 2>> /dev/null) == line1 ]] || err_exit '>() process 
substitution fails in for loop'
 fi
 [[ $($SHELL -r 'command -p :' 2>&1) == *restricted* ]]  || err_exit 'command 
-p not restricted'
 print cat >  /tmp/ksh$$x
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/tests/builtins.sh 
ksh93_2006_10_31/src/cmd/ksh93/tests/builtins.sh
--- ksh93_2006_09_12/src/cmd/ksh93/tests/builtins.sh    2006-09-08 
17:18:52.000000000 +0200
+++ ksh93_2006_10_31/src/cmd/ksh93/tests/builtins.sh    2006-10-20 
05:49:52.000000000 +0200
@@ -238,10 +238,10 @@
 if     [[ $(printf "%g\n" x2 2>/dev/null) != 1e-09 ]]
 then   err_exit 'printf "%g" not working correctly'
 fi
-($SHELL read -s foobar <<\!
-testing
-!
-) 2> /dev/null || err_exit ksh read -s var fails
+#FIXME#($SHELL read -s foobar <<\!
+#FIXME#testing
+#FIXME#!
+#FIXME#) 2> /dev/null || err_exit ksh read -s var fails
 if     [[ $(printf +3 2>/dev/null) !=   +3 ]]
 then   err_exit 'printf is not processing formats beginning with + correctly'
 fi
@@ -421,11 +421,16 @@
        done) == $'0\n0\n1\n1\n2' ]]  || err_exit  "DEBUG trap not working"
 getconf UNIVERSE - ucb
 [[ $($SHELL -c 'echo -3') == -3 ]] || err_exit "echo -3 not working in ucb 
universe"
-typeset -F3 start_x=SECONDS total_t
-for (( i=0 ; i < 50 ; i++)) 
-do     { sleep 2;date ;} 2> /dev/null | read -N1 -t .02
+typeset -F3 start_x=SECONDS total_t delay=0.02
+typeset reps=50 leeway=5
+sleep $(( 2 * leeway * reps * delay )) |
+for (( i=0 ; i < reps ; i++ )) 
+do     read -N1 -t $delay
 done
-((total_t = SECONDS - start_x))
-(( total_t > 2.0 )) && err_exit "read -t in pipe taking $total_t secs - too 
long" 
-(( total_t < 1.0 )) &&  err_exit "read -t in pipe taking $total_t secs - too 
fast" 
+(( total_t = SECONDS - start_x ))
+if     (( total_t > leeway * reps * delay ))
+then   err_exit "read -t in pipe taking $total_t secs - $(( reps * delay )) 
minimum - too long" 
+elif   (( total_t < reps * delay ))
+then   err_exit "read -t in pipe taking $total_t secs - $(( reps * delay )) 
minimum - too fast" 
+fi
 exit $((Errors))
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/tests/coprocess.sh 
ksh93_2006_10_31/src/cmd/ksh93/tests/coprocess.sh
--- ksh93_2006_09_12/src/cmd/ksh93/tests/coprocess.sh   2006-06-28 
19:34:25.000000000 +0200
+++ ksh93_2006_10_31/src/cmd/ksh93/tests/coprocess.sh   2006-09-15 
22:41:21.000000000 +0200
@@ -29,6 +29,11 @@
 Command=${0##*/}
 integer Errors=0
 
+if     [[ -d /cygdrive ]]
+then   err_exit cygwin detected - coprocess tests disabled - enable at the 
risk of wedging your system
+       exit $((Errors))
+fi
+
 function ping # id
 {
        integer x=0
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/tests/glob.sh 
ksh93_2006_10_31/src/cmd/ksh93/tests/glob.sh
--- ksh93_2006_09_12/src/cmd/ksh93/tests/glob.sh        2006-07-25 
17:11:06.000000000 +0200
+++ ksh93_2006_10_31/src/cmd/ksh93/tests/glob.sh        2006-09-15 
23:28:06.000000000 +0200
@@ -25,22 +25,42 @@
 }
 alias err_exit='err_exit $LINENO'
 
+integer contrary=0 ignorant=0
+
 function test_glob
 {
-       typeset lineno expected arg got sep
+       typeset lineno expected drop arg got sep op val add del
+       if      [[ $1 == --* ]]
+       then    del=${1#--}
+               shift
+       fi
+       if      [[ $1 == ++* ]]
+       then    add=${1#++}
+               shift
+       fi
        lineno=$1 expected=$2
        shift 2
-       if      [[ $expected == "<Beware> "* && 'B' > 'b' ]]
-       then    expected=${expected#"<Beware> "}
-               expected="$expected <Beware>"
-       fi
-       if      [[ $expected == *"<aXb> <abd>"* && 'B' > 'b' ]]
-       then    expected=${expected/"<aXb> <abd>"/"<abd> <aXb>"}
+       if      (( contrary ))
+       then    if      [[ $expected == "<Beware> "* ]]
+               then    expected=${expected#"<Beware> "}
+                       expected="$expected <Beware>"
+               fi
+               if      [[ $expected == *"<aXb> <abd>"* ]]
+               then    expected=${expected/"<aXb> <abd>"/"<abd> <aXb>"}
+               fi
        fi
        for arg
        do      got="$got$sep<$arg>"
                sep=" "
        done
+       if      (( ignorant ))
+       then    if      [[ $del ]]
+               then    got="<$del> $got"
+               fi
+               if      [[ $add ]]
+               then    expected="<$add> $expected"
+               fi
+       fi
        if      [[ $got != "$expected" ]]
        then    err_exit $lineno "glob: got '$got' expected '$expected'"
        fi
@@ -73,6 +93,14 @@
 cd $tmp || err_exit $LINENO "cd $tmp failed"
 rm -rf *
 
+touch B b
+set -- *
+case $* in
+'b B') contrary=1 ;;
+b|B)   ignorant=1 ;;
+esac
+rm -rf *
+
 touch a b c d abc abd abe bb bcd ca cb dd de Beware
 mkdir bdir
 
@@ -112,7 +140,7 @@
 test_glob $LINENO '<s/\..*//>' 's/\..*//'
 test_glob $LINENO '</^root:/{s/^[!:]*:[!:]*:\([!:]*\).*$/\1/>' 
"/^root:/{s/^[!:]*:[!:]*:\([!:]*\).*"'$'"/\1/"
 test_glob $LINENO '<abc> <abd> <abe> <bb> <cb>' [a-c]b*
-test_glob $LINENO '<abd> <abe> <bb> <bcd> <bdir> <ca> <cb> <dd> <de>' 
[a-y]*[!c]
+test_glob ++Beware $LINENO '<abd> <abe> <bb> <bcd> <bdir> <ca> <cb> <dd> <de>' 
[a-y]*[!c]
 test_glob $LINENO '<abd> <abe>' a*[!c]
 
 touch a-b aXb
@@ -121,7 +149,7 @@
 
 touch .x .y
 
-test_glob $LINENO '<Beware> <d> <dd> <de>' [!a-c]*
+test_glob --Beware $LINENO '<Beware> <d> <dd> <de>' [!a-c]*
 
 if     mkdir a\*b 2>/dev/null
 then
@@ -143,6 +171,7 @@
        test_case $LINENO '<match>' '"$undefined"' '""'
        test_case $LINENO '<match>' 'abc' 'a["\b"]c'
 
+       rm -rf mkdir a\*b
 fi
 
 mkdir man
@@ -201,7 +230,7 @@
 test_case $LINENO '<nomatch>' "'['" '[abc'
 test_case $LINENO '<nomatch>' '[' '[abc'
 
-test_glob $LINENO '<b> <bb> <bcd> <bdir>' b*
+test_glob ++Beware $LINENO '<b> <bb> <bcd> <bdir>' b*
 test_glob $LINENO '<Beware> <b> <bb> <bcd> <bdir>' [bB]*
 
 if     ( set --nocaseglob ) 2>/dev/null
@@ -237,7 +266,7 @@
 test_glob $LINENO '<*>' *
 
 FIGNORE='.*|*c|*e|?'
-test_glob $LINENO '<a*b> <a-b> <aXb> <abd> <bb> <bcd> <bdir> <ca> <cb> <dd> 
<man>' *
+test_glob $LINENO '<a-b> <aXb> <abd> <bb> <bcd> <bdir> <ca> <cb> <dd> <man>' *
 
 FIGNORE='.*|*b|*d|?'
 test_glob $LINENO '<Beware> <abc> <abe> <bdir> <ca> <de> <man>' *
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/tests/io.sh 
ksh93_2006_10_31/src/cmd/ksh93/tests/io.sh
--- ksh93_2006_09_12/src/cmd/ksh93/tests/io.sh  2006-09-12 22:38:34.000000000 
+0200
+++ ksh93_2006_10_31/src/cmd/ksh93/tests/io.sh  2006-10-31 16:48:17.000000000 
+0100
@@ -208,6 +208,15 @@
        command exec 3<# ((40*62)) 
        read -u3
        [[ $REPLY == +(^) ]] || err_exit "expecting ddd..."
+       command exec 3<# ((0))
+       command exec 3<# *jjjj*
+       read -u3
+       [[  $REPLY == {39}(j) ]] || err_exit "<# pattern failed"
+       [[ $(command exec 3<## *llll*) = {39}(k) ]] || err_exit "<## pattern 
not saving standard output"
+       read -u3
+       [[  $REPLY == {39}(l) ]] || err_exit "<## pattern failed to position"
+       command exec 3<# *abc*
+       read -u3 && err_exit "not found pattern not positioning at eof"
 else   err_exit "/tmp/seek$$: cannot open for reading"
 fi
 trap "" EXIT
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/tests/options.sh 
ksh93_2006_10_31/src/cmd/ksh93/tests/options.sh
--- ksh93_2006_09_12/src/cmd/ksh93/tests/options.sh     2006-06-28 
20:23:16.000000000 +0200
+++ ksh93_2006_10_31/src/cmd/ksh93/tests/options.sh     2006-10-06 
19:28:13.000000000 +0200
@@ -195,6 +195,7 @@
 cd ~-
 rm -rf /tmp/ksh$$
 
+
 # { exec interactive login_shell restricted xtrace } in the following test
 
 for opt in \
@@ -303,5 +304,10 @@
        then    err_exit "[[ -o ?no$opt ]] should fail"
        fi
 done
-
+false | true | true   || err_exit 'pipe not exiting exit value of last element'
+true | true | false   && err_exit 'pipe not exiting false'
+set -o pipefail
+false | true | true    && err_exit 'pipe with first not failing with pipefail'
+true | false | true    && err_exit 'pipe middle not failing with pipefail'
+true | true | false    && err_exit 'pipe last not failing with pipefail'
 exit $((Errors))
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/tests/path.sh 
ksh93_2006_10_31/src/cmd/ksh93/tests/path.sh
--- ksh93_2006_09_12/src/cmd/ksh93/tests/path.sh        2006-07-21 
18:23:26.000000000 +0200
+++ ksh93_2006_10_31/src/cmd/ksh93/tests/path.sh        2006-10-06 
22:27:10.000000000 +0200
@@ -164,6 +164,9 @@
 typeset foo=$(PATH=/xyz:/abc :)
 y=$(whence rm)
 [[ $x != "$y" ]] && err_exit 'PATH not restored after command substitution'
+whence getconf > /dev/null  &&  err_exit 'getconf should not be found'
+builtin /bin/getconf
+PATH=/bin
 PATH=$(getconf PATH)
 x=$(whence ls)
 PATH=.:$PWD:${x%/ls}
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/tests/quoting.sh 
ksh93_2006_10_31/src/cmd/ksh93/tests/quoting.sh
--- ksh93_2006_09_12/src/cmd/ksh93/tests/quoting.sh     2006-06-28 
19:35:24.000000000 +0200
+++ ksh93_2006_10_31/src/cmd/ksh93/tests/quoting.sh     2006-10-12 
23:35:31.000000000 +0200
@@ -323,4 +323,9 @@
 string='&foo'
 [[ ${subject/${re}/${string}} != '&foo' ]] && err_exit 'string replacement 
with $string not working with string=&foo'
 [[ ${subject/${re}/"${string}"} != '&foo' ]] && err_exit 'string replacement 
with "$string" not working with  string=&foo'
+{
+x=x
+x=${x:-`id | sed 's/^[^(]*(\([^)]*\)).*/\1/'`}
+} 2> /dev/null || err_exit 'skipping over `` failed' 
+[[ $x == x ]] || err_exit 'assignment ${x:=`...`} failed'
 exit $((Errors))
diff -r -N -u ksh93_2006_09_12/src/cmd/ksh93/tests/variables.sh 
ksh93_2006_10_31/src/cmd/ksh93/tests/variables.sh
--- ksh93_2006_09_12/src/cmd/ksh93/tests/variables.sh   2006-06-28 
19:35:50.000000000 +0200
+++ ksh93_2006_10_31/src/cmd/ksh93/tests/variables.sh   2006-10-24 
16:26:07.000000000 +0200
@@ -500,4 +500,19 @@
        } 
 } 2> /dev/null || err_exit "Can't add get discipline to .sh.foobar"
 [[ ${.sh.foobar} == world ]]  || err_exit 'get discipline for .sh.foobar not 
working'
+unset x
+x='a|b'
+IFS='|'
+set -- $x
+[[ $2 == b ]] || err_exit '$2 should be b after set'
+exec 3>&2 2> /dev/null
+set -x
+( IFS= ) 2> /dev/null
+set +x
+exec 2>&3-
+set -- $x
+[[ $2 == b ]] || err_exit '$2 should be b after subshell'
+: & pid=$!
+( : & )
+[[ $pid == $! ]] || err_exit '$! value not preserved across subshells'
 exit $((Errors))
diff -r -N -u ksh93_2006_09_12/src/lib/libast/cdt/dtopen.c 
ksh93_2006_10_31/src/lib/libast/cdt/dtopen.c
--- ksh93_2006_09_12/src/lib/libast/cdt/dtopen.c        2005-04-20 
17:35:16.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/cdt/dtopen.c        2006-10-13 
05:46:06.000000000 +0200
@@ -20,7 +20,7 @@
 *                                                                      *
 ***********************************************************************/
 #include       "dthdr.h"
-static char*     Version = "\n@(#)$Id: cdt (AT&T Labs - Research) 2005-04-20 
$\0\n";
+static char*     Version = "\n@(#)$Id: cdt (AT&T Research) 2005-04-20 $\0\n";
 
 /*     Make a new dictionary
 **
diff -r -N -u ksh93_2006_09_12/src/lib/libast/comp/basename.c 
ksh93_2006_10_31/src/lib/libast/comp/basename.c
--- ksh93_2006_09_12/src/lib/libast/comp/basename.c     2001-06-21 
16:09:35.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/comp/basename.c     2006-10-27 
22:52:51.000000000 +0200
@@ -24,10 +24,13 @@
  * basename(3) implementation
  */
 
-#include <ast_map.h>
-#include <libgen.h>
+#include <ast_common.h>
 
-char *basename(register char *pathname)
+#if defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
+extern char *basename(register char *pathname)
 {
        register char *first, *last;
        for(first=last=pathname; *last; last++);
diff -r -N -u ksh93_2006_09_12/src/lib/libast/comp/catopen.c 
ksh93_2006_10_31/src/lib/libast/comp/catopen.c
--- ksh93_2006_09_12/src/lib/libast/comp/catopen.c      2004-10-27 
21:43:16.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/comp/catopen.c      2006-10-12 
20:18:44.000000000 +0200
@@ -110,8 +110,11 @@
                        cc->cat = d;
                        if ((s || *name == '/') && (ast.locale.set & 
(1<<AST_LC_MESSAGES)))
                        {
-                               cc->cvt = iconv_open("", "utf");
-                               cc->tmp = sfstropen();
+                               if ((cc->cvt = iconv_open("", "utf")) == 
(iconv_t)(-1) || !(cc->tmp = sfstropen()))
+                               {
+                                       catclose(d);
+                                       return (_ast_nl_catd)(-1);
+                               }
                        }
                        else
                                cc->cvt = (iconv_t)(-1);
@@ -147,7 +150,8 @@
                        s = (char*)msg;
                        n = strlen(s);
                        iconv_write(((Cc_t*)cat)->cvt, ((Cc_t*)cat)->tmp, &s, 
&n, NiL);
-                       return sfstruse(((Cc_t*)cat)->tmp);
+                       if (s = sfstruse(((Cc_t*)cat)->tmp))
+                               return s;
                }
                return (char*)msg;
        }
diff -r -N -u ksh93_2006_09_12/src/lib/libast/comp/conf.sh 
ksh93_2006_10_31/src/lib/libast/comp/conf.sh
--- ksh93_2006_09_12/src/lib/libast/comp/conf.sh        2006-05-18 
16:41:21.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/comp/conf.sh        2006-10-25 
17:17:18.000000000 +0200
@@ -19,23 +19,16 @@
 #                   Phong Vo <kpv at research.att.com>                    #
 #                                                                      #
 ########################################################################
-: generate conf info
+: generate getconf and limits info
 #
-# @(#)conf.sh (AT&T Research) 2006-07-25
+# @(#)conf.sh (AT&T Research) 2006-10-25
 #
 # this script generates these files from the table file in the first arg
 # the remaining args are the C compiler name and flags
 #
-#      conflib.h       common generator definitions
-#      conflim.h       limits.h generator code
-#      confmap.c       internal index to external op map data
-#      confmap.h       internal index to external op map definitions
-#      confstr.c       confstr() implementation
-#      conftab.c       readonly string table data
+#      conflim.h       supplemental limits.h definitions
 #      conftab.h       readonly string table definitions
-#      confuni.h       unistd.h generator code
-#      pathconf.c      pathconf() and fpathconf() implementation
-#      sysconf.c       sysconf() implementation
+#      conftab.c       readonly string table data
 #
 # you may think it should be simpler
 # but you shall be confused anyway
@@ -52,7 +45,6 @@
 append=0
 debug=
 extra=0
-index=0
 keep_call='*'
 keep_name='*'
 trace=
@@ -64,13 +56,16 @@
        -d*)    debug=$1 ;;
        -l)     extra=1 ;;
        -n*)    keep_name=${1#-?} ;;
-       -t*)    trace=${1#-?} ;;
+       -t)     trace=1 ;;
        -v)     verbose=1 ;;
-       -*)     echo "Usage: $command [-a] [-ccall-pattern] [-dN] [-l] 
[-nname_pattern] [-t[s]] [-v] conf.tab" >&2; exit 2 ;;
+       -*)     echo "Usage: $command [-a] [-ccall-pattern] [-dN] [-l] 
[-nname_pattern] [-t] [-v] conf.tab" >&2; exit 2 ;;
        *)      break ;;
        esac
        shift
 done
+head='#include "FEATURE/standards"
+#include "FEATURE/common"'
+tail='#include "FEATURE/param"'
 generated="/* : : generated by $command from $1 : : */"
 ifs=${IFS-'
         '}
@@ -81,8 +76,11 @@
 cb='}'
 sym=[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]*
 tmp=conf.tmp
-case $verbose:$debug in
-1:?*)  echo "$command: debug=$debug keep_call=$keep_call keep_name=$keep_name" 
>&2 ;;
+case $verbose:$debug$trace in
+1:?*)  echo "$command: debug=$debug trace=$trace keep_call=$keep_call 
keep_name=$keep_name" >&2 ;;
+esac
+case $trace in
+1)     PS4='+$LINENO+ '; set -x ;;
 esac
 
 case $# in
@@ -108,17 +106,36 @@
 
 rm -f $tmp.*
 case $debug in
-'')    trap "rm -f $tmp.*" 0 1 2 ;;
+'')    trap "code=\$?; rm -f $tmp.*; exit \$code" 0 1 2 ;;
 esac
 
+# determine the _ast_intmax_t printf format
+
+cat > $tmp.c <<!
+${head}
+int
+main()
+{
+#if _ast_intmax_long
+       return 1;
+#else
+       return 0;
+#endif
+}
+!
+if     $cc -o $tmp.exe $tmp.c >/dev/null 2>&1 && ./$tmp.exe
+then   FMT='%lld'
+else   FMT='%ld'
+fi
+
 # set up the names and keys
 
 keys=
-lastindex=0
+standards=
 
 case $append$extra in
 00)    case $verbose in
-       1)      echo "$command: reading $tab" >&2 ;;
+       1)      echo "$command: read $tab" >&2 ;;
        esac
        exec < $tab
        while   :
@@ -132,28 +149,13 @@
                esac
                case $line in
                ""|\#*) ;;
-               "       "*)
-                       set x $line
-                       shift
-                       echo "$*" >> $tmp.h
-                       case $name in
-                       ?*)     local=LOCAL
-                               case $section in
-                               [01])   ;;
-                               *)      local=${local}${section} ;;
-                               esac
-                               eval 
CONF_values_${key}='${sp}_${local}_${name}$'CONF_values_${key}
-                               name=
-                               ;;
-                       esac
-                       ;;
                *)      set x $line
                        shift; name=$1
-                       shift; index=$1
                        shift; standard=$1
                        shift; call=$1
                        shift; section=$1
                        shift; flags=$1
+                       alternates=
                        define=
                        values=
                        script=
@@ -164,43 +166,60 @@
                                0)      break ;;
                                esac
                                case $1 in
-                               "{")    case $# in
-                                       1)      IFS=""
-                                               while   read line
-                                               do      case $line in
-                                                       "}")    break ;;
-                                                       esac
-                                                       script=$script$nl$line
-                                               done
-                                               IFS=$ifs
-                                               eval script_$name='$'script
-                                               break
-                                               ;;
-                                       *)      shift
-                                               eval script='$'script_$1
-                                               case $2 in
-                                               "}")    shift ;;
-                                               esac
-                                               ;;
+                               ":")    shift
+                                       eval script='$'script_$1
+                                       break
+                                       ;;
+                               *"{")   case $1 in
+                                       "sh{")  script="# $name" ;;
+                                       *)      script= ;;
                                        esac
+                                       shift
+                                       args="$*"
+                                       IFS=""
+                                       while   read line
+                                       do      case $line in
+                                               "}")    break ;;
+                                               esac
+                                               script=$script$nl$line
+                                       done
+                                       IFS=$ifs
+                                       break
                                        ;;
                                *.h)    headers=$headers$nl#include$sp'<'$1'>'
                                        ;;
                                *)      values=$values$sp$1
+                                       case $1 in
+                                       $sym)   echo "$1" >> $tmp.v ;;
+                                       esac
                                        ;;
                                esac
                        done
-                       case $call in
-                       CS|SI)  key=CS ;;
-                       *)      key=$call ;;
+                       case " $standards " in
+                       *" $standard "*)
+                               ;;
+                       *)      standards="$standards $standard"
+                               ;;
                        esac
                        case $name in
-                       *VERSION*)key=${key}_${standard}${section} ;;
+                       *VERSION*)key=${standard}${section} ;;
+                       *)        key= ;;
                        esac
-                       key=${key}_${name}
+                       case $key in
+                       ''|*_)  key=${key}${name} ;;
+                       *)      key=${key}_${name} ;;
+                       esac
+                       eval sys='$'CONF_call_${key}
+                       case $sys in
+                       ?*)     call=$sys ;;
+                       esac
+                       case $call in
+                       SI)     sys=CS ;;
+                       *)      sys=$call ;;
+                       esac
+                       key=${sys}_${key}
                        keys="$keys$nl$key"
                        eval CONF_name_${key}='$'name
-                       eval CONF_index_${key}='$'index
                        eval CONF_standard_${key}='$'standard
                        eval CONF_call_${key}='$'call
                        eval CONF_section_${key}='$'section
@@ -208,11 +227,9 @@
                        eval CONF_define_${key}='$'define
                        eval CONF_values_${key}='$'values
                        eval CONF_script_${key}='$'script
+                       eval CONF_args_${key}='$'args
                        eval CONF_headers_${key}='$'headers
                        eval CONF_keys_${name}=\"'$'CONF_keys_${name} '$'key\"
-                       if      test $index -gt $lastindex
-                       then    lastindex=$index
-                       fi
                        ;;
                esac
        done
@@ -222,16 +239,16 @@
 -d1)   for key in $keys
        do      eval name=\"'$'CONF_name_$key\"
                case $name in
-               ?*)     eval index=\"'$'CONF_index_$key\"
-                       eval standard=\"'$'CONF_standard_$key\"
+               ?*)     eval standard=\"'$'CONF_standard_$key\"
                        eval call=\"'$'CONF_call_$key\"
                        eval section=\"'$'CONF_section_$key\"
                        eval flags=\"'$'CONF_flags_$key\"
                        eval define=\"'$'CONF_define_$key\"
                        eval values=\"'$'CONF_values_$key\"
                        eval script=\"'$'CONF_script_$key\"
+                       eval args=\"'$'CONF_args_$key\"
                        eval headers=\"'$'CONF_headers_$key\"
-                       printf "%29s %35s %3d %8s %2s %1d %5s %s$nl" "$name" 
"$key" "$index" "$standard" "$call" "$section" "$flags" 
"$define${values:+$sp=$values}${headers:+$sp$headers$nl}${script:+$sp$ob$script$nl$cb}"
+                       printf "%29s %35s %8s %2s %1d %5s %s$nl" "$name" "$key" 
"$standard" "$call" "$section" "$flags" 
"$define${values:+$sp=$values}${headers:+$sp$headers$nl}${script:+$sp$ob$script$nl$cb}"
                        ;;
                esac
        done
@@ -247,10 +264,29 @@
 echo "$systeminfo" > $tmp.c
 $cc -E $tmp.c >/dev/null 2>&1 || systeminfo=
 
-# check for local additions
+# check for native getconf(1)
+
+CONF_getconf=
+CONF_getconf_a=
+for d in /usr/bin /bin /usr/sbin /sbin
+do     if      test -x $d/getconf
+       then    case `$d/getconf --?-version 2>&1` in
+               *"AT&T"*"Research"*)
+                       : presumably an implementation also configured from 
conf.tab
+                       ;;
+               *)      CONF_getconf=$d/getconf
+                       if      $CONF_getconf -a >/dev/null 2>&1
+                       then    CONF_getconf_a=-a
+                       fi
+                       ;;
+               esac
+               break
+       fi
+done
+export CONF_getconf CONF_getconf_a
 
 case $verbose in
-1)     echo "$command: check local confstr(),pathconf(),sysconf(),sysinfo() 
keys" >&2 ;;
+1)     echo "$command: check 
${CONF_getconf:+$CONF_getconf(1),}confstr(2),pathconf(2),sysconf(2),sysinfo(2) 
configuration names" >&2 ;;
 esac
 {
        echo "#include <unistd.h>$systeminfo
@@ -263,15 +299,31 @@
 sort -u > $tmp.f
 {
 sed \
-       -e '/^[         ]*#[    ]*define[       ][      
]*[ABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789]*[CPS][CIS]_/!d' \
-       -e 's,^[        ]*#[    ]*define[       ]*,,' \
-       -e '/^[^        ]*[     ][      ]*[0123456789]/!d' \
-       -e 's,[         ].*,,' \
-       -e '/^[S_]/!d' \
-       `cat $tmp.f` 2>/dev/null
-{ /bin/getconf -a || /usr/bin/getconf -a; } 2>/dev/null | sed 's,[=:   ].*,,'
+       -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789]/ /g' \
+       -e 's/[         ][      ]*/\n/g' \
+       `cat $tmp.f` 2>/dev/null |
+       egrep '^(SI|_(CS|PC|SC|SI))_.'
+       case $CONF_getconf_a in
+       ?*)     $CONF_getconf $CONF_getconf_a | sed 's,[=:    ].*,,'
+               ;;
+       *)      case $CONF_getconf in
+               ?*)     for v in `strings $CONF_getconf | grep 
'^[ABCDEFGHIJKLMNOPQRSTUVWXYZ_][ABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789]*$'`
+                       do      if      $CONF_getconf $v >/dev/null
+                               then    echo $v
+                               fi
+                       done
+                       ;;
+               esac
+               ;;
+       esac 2>/dev/null
 } |
-sort -u > $tmp.v
+egrep -v '^_[ABCDEFGHIJKLMNOPQRSTUVWXYZ]+_(COUNT|LAST|N|STR)$' |
+sort -u > $tmp.g
+{
+       grep '^_' $tmp.g
+       grep '^[^_]' $tmp.g
+} > $tmp.t
+mv $tmp.t $tmp.g
 case $debug in
 -d2)   exit ;;
 esac
@@ -281,13 +333,10 @@
 '')    HOST=SYSTEM ;;
 esac
 
-exec < $tmp.v
+exec < $tmp.g
 
 while  read line
-do     case $line in
-       *_[CS][SI]_*_STR|SI_*_STR)      continue ;;
-       esac
-       flags=F
+do     flags=F
        section=
        define=$line
        IFS=_
@@ -333,14 +382,18 @@
        case $standard in
        _*)     standard=`echo $standard | sed 's,^_*,,'` ;;
        esac
-       case $standard in
-       XBS5)   ;;
-       [0123456789]*)
-               section=$standard
-               standard=POSIX
+       case " $standards " in
+       *" $standard "*)
                ;;
-       *[0123456789])
-               eval `echo $standard | sed 
's,\(.*\)\([0123456789]*\),standard=\1 section=\2,'`
+       *)      case $standard in
+               [0123456789]*)
+                       section=$standard
+                       standard=POSIX
+                       ;;
+               *[0123456789])
+                       eval `echo $standard | sed 
's,\(.*\)\([0123456789]*\),standard=\1 section=\2,'`
+                       ;;
+               esac
                ;;
        esac
        case $flags in
@@ -349,16 +402,16 @@
                *)      flags=${flags}U ;;
                esac
                ;;
-       *)      case $standard in
-               POSIX|SVID|XBS5|XOPEN|XPG|AES|AST)
+       *)      case " $standards " in
+               " C ")  shift
+                       ;;
+               *" $standard "*)
                        case $call in
                        SI)     ;;
-                       *)      flags=${flags}U ;;
+                       *)      flags=${flags}PU ;;
                        esac
                        shift
                        ;;
-               C)      shift
-                       ;;
                *)      standard=
                        ;;
                esac
@@ -381,8 +434,13 @@
                esac
                ;;
        esac
+       part=$section
        case $section in
-       '')     section=1 ;;
+       '')     section=1
+               case $standard in
+               POSIX|XOPEN) part=$section ;;
+               esac
+               ;;
        esac
        name=
        while   :
@@ -399,93 +457,101 @@
        '')     ;;
        
CONFORMANCE|FS_3D|HOSTTYPE|LIBPATH|LIBPREFIX|LIBSUFFIX|PATH_ATTRIBUTES|PATH_RESOLVE|UNIVERSE)
                ;;
-       *)      lastindex=`expr $lastindex + 1`
-               index=$lastindex
+       *)      
                values=
                script=
+               args=
                headers=
                case $call in
                CS|SI)  key=CS ;;
                *)      key=$call ;;
                esac
                case $name in
-               *VERSION*)key=${key}_${standard}${section} ;;
+               *VERSION*)key=${key}_${standard}${part} ;;
                esac
                key=${key}_${name}
-               eval x='$'CONF_name_$key
+               eval x='$'CONF_keys_$name
                case $x in
-               '')     case $call in
-                       SI)     flags=O$flags ;;
-                       esac
-                       old=QQ
-                       case $name in
-                       *VERSION*)old=${old}_${standard}${section} ;;
-                       esac
-                       old=${old}_${name}
-                       eval x='$'CONF_name_$old
-                       case $x in
-                       ?*)     eval CONF_name_$old=
-                               eval index='$'CONF_index_$old
-                               eval flags='$'flags'$'CONF_flags_$old
-                               eval values='$'CONF_values_$old
-                               eval script='$'CONF_script_$old
-                               eval headers='$'CONF_headers_$old
-                               ;;
-                       esac
-                       keys="$keys$nl$key"
-                       eval CONF_name_${key}='$'name
-                       eval CONF_index_${key}='$'index
-                       eval CONF_standard_${key}='$'standard
-                       eval CONF_call_${key}='$'call
-                       eval CONF_section_${key}='$'section
-                       eval CONF_flags_${key}=D'$'flags
-                       eval CONF_define_${key}='$'define
-                       eval CONF_values_${key}='$'values
-                       eval CONF_script_${key}='$'script
-                       eval CONF_headers_${key}='$'headers
-                       ;;
-               *)      eval x='$'CONF_define_$key
+               '')     eval x='$'CONF_name_$key
                        case $x in
-                       ?*)     case $call in
-                               CS)     eval x='$'CONF_call_$key
-                                       case $x in
-                                       SI)     ;;
-                                       *)      define= ;;
-                                       esac
-                                       ;;
-                               *)      define=
+                       '')     case $call in
+                               SI)     flags=O$flags ;;
+                               esac
+                               old=QQ
+                               case $name in
+                               *VERSION*)old=${old}_${standard}${part} ;;
+                               esac
+                               old=${old}_${name}
+                               eval x='$'CONF_name_$old
+                               case $x in
+                               ?*)     eval CONF_name_$old=
+                                       eval flags='$'flags'$'CONF_flags_$old
+                                       eval values='$'CONF_values_$old
+                                       eval script='$'CONF_script_$old
+                                       eval args='$'CONF_args_$old
+                                       eval headers='$'CONF_headers_$old
                                        ;;
                                esac
-                               ;;
-                       esac
-                       case $define in
-                       ?*)     eval CONF_define_${key}='$'define
+                               keys="$keys$nl$key"
+                               eval CONF_name_${key}='$'name
+                               eval CONF_standard_${key}='$'standard
                                eval CONF_call_${key}='$'call
-                               eval x='$'CONF_call_${key}
+                               eval CONF_section_${key}='$'section
+                               eval CONF_flags_${key}=D'$'flags
+                               eval CONF_define_${key}='$'define
+                               eval CONF_values_${key}='$'values
+                               eval CONF_script_${key}='$'script
+                               eval CONF_args_${key}='$'args
+                               eval CONF_headers_${key}='$'headers
+                               ;;
+                       *)      eval x='$'CONF_define_$key
                                case $x in
-                               QQ)     ;;
-                               *)      case $flags in
-                                       *R*)    flags=R ;;
-                                       *)      flags= ;;
+                               ?*)     case $call in
+                                       CS)     eval x='$'CONF_call_$key
+                                               case $x in
+                                               SI)     ;;
+                                               *)      define= ;;
+                                               esac
+                                               ;;
+                                       *)      define=
+                                               ;;
                                        esac
                                        ;;
                                esac
-                               case $call in
-                               SI)     flags=O$flags ;;
+                               case $define in
+                               ?*)     eval CONF_define_${key}='$'define
+                                       eval CONF_call_${key}='$'call
+                                       eval x='$'CONF_call_${key}
+                                       case $x in
+                                       QQ)     ;;
+                                       *)      case $flags in
+                                               *R*)    flags=R ;;
+                                               *)      flags= ;;
+                                               esac
+                                               ;;
+                                       esac
+                                       case $call in
+                                       SI)     flags=O$flags ;;
+                                       esac
+                                       eval 
CONF_flags_${key}=D'$'flags'$'CONF_flags_${key}
+                                       ;;
                                esac
-                               eval 
CONF_flags_${key}=D'$'flags'$'CONF_flags_${key}
-                               ;;
-                       esac
-                       eval x='$'CONF_index_$key
-                       if      test $index -lt $x
-                       then    eval CONF_index_${key}='$'index
-                       fi
-                       old=QQ
-                       case $name in
-                       *VERSION*)old=${old}_${standard}${section} ;;
+                               old=QQ
+                               case $name in
+                               *VERSION*)old=${old}_${standard}${part} ;;
+                               esac
+                               old=${old}_${name}
+                               eval CONF_name_$old=
                        esac
-                       old=${old}_${name}
-                       eval CONF_name_$old=
+                       ;;
+               *)      for key in $x
+                       do      eval x='$'CONF_call_${key}
+                               case $x in
+                               XX)     eval CONF_call_${key}=QQ
+                                       eval 
CONF_flags_${key}=S'$'CONF_flags_${key}
+                                       ;;
+                               esac
+                       done
                esac
                ;;
        esac
@@ -500,8 +566,7 @@
 -d3)   for key in $keys
        do      eval name=\"'$'CONF_name_$key\"
                case $name in
-               ?*)     eval index=\"'$'CONF_index_$key\"
-                       eval standard=\"'$'CONF_standard_$key\"
+               ?*)     eval standard=\"'$'CONF_standard_$key\"
                        eval call=\"'$'CONF_call_$key\"
                        eval section=\"'$'CONF_section_$key\"
                        eval flags=\"'$'CONF_flags_$key\"
@@ -509,7 +574,7 @@
                        eval values=\"'$'CONF_values_$key\"
                        eval script=\"'$'CONF_script_$key\"
                        eval headers=\"'$'CONF_headers_$key\"
-                       printf "%29s %35s %3d %8s %2s %1d %5s %s$nl" "$name" 
"$key" "$index" "$standard" "$call" "$section" "$flags" 
"$define${values:+$sp=$values}${headers:+$sp$headers$nl}${script:+$sp$ob$script$nl$cb}"
+                       printf "%29s %35s %8s %2s %1d %5s %s$nl" "$name" "$key" 
"$standard" "$call" "$section" "$flags" 
"$define${values:+$sp=$values}${headers:+$sp$headers$nl}${script:+$sp$ob$script$nl$cb}"
                        ;;
                esac
        done
@@ -517,18 +582,6 @@
        ;;
 esac
 
-cat > $tmp.6 <<!
-       /*
-        * some implementations (could it beee aix) think empty
-        * definitions constitute symbolic constants
-        */
-
-       {
-       long    num;
-       char*   str;
-       int     hit;
-!
-
 # mark the dups CONF_PREFIXED
 
 prev_key=
@@ -539,23 +592,23 @@
        '')     continue
                ;;
        $prev_name)
-               eval CONF_flags_${prev_key}=P'$'CONF_flags_${prev_key}
-               eval CONF_flags_${key}=P'$'CONF_flags_${key}
+               eval p='$'CONF_flags_${prev_key}
+               eval c='$'CONF_flags_${key}
+               case $p:$c in
+               *L*:*L*);;
+               *L*:*)  c=L${c} ;;
+               *:*L*)  p=L${p} ;;
+               *)      p=P$p c=P$c ;;
+               esac
+               eval CONF_flags_${prev_key}=$p
+               eval CONF_flags_${key}=$c
                ;;
        esac
        prev_name=$name
        prev_key=$key
 done
 
-# walk through the table
-
-case $shell in
-ksh)   integer len limit_max name_max ;;
-esac
-limit_max=1
-name_max=1
-standards=
-export tmp name index standard call cc
+# collect all the macros/enums
 
 for key in $keys
 do     eval name=\"'$'CONF_name_$key\"
@@ -569,119 +622,58 @@
        $keep_call)     ;;
        *)              continue ;;
        esac
-       eval index=\"'$'CONF_index_$key\"
        eval standard=\"'$'CONF_standard_$key\"
        eval section=\"'$'CONF_section_$key\"
        eval flags=\"'$'CONF_flags_$key\"
        eval define=\"'$'CONF_define_$key\"
        eval values=\"'$'CONF_values_$key\"
        eval script=\"'$'CONF_script_$key\"
+       eval args=\"'$'CONF_args_$key\"
        eval headers=\"'$'CONF_headers_$key\"
        conf_name=$name
-       conf_index=$index
        case $call in
        QQ)     call=XX
                for c in SC PC CS
-               do      cat > $tmp.c <<!
-#include "FEATURE/standards"
-#include <sys/types.h>
-#include <limits.h>
-#include <unistd.h>$systeminfo$headers
-#include <stdio.h>
-main()
-{
-       return _${c}_${name} == 0;
-}
-!
-                       if      $cc -o $tmp.exe $tmp.c >/dev/null 2>&1
-                       then    call=$c
-                               case $standard in
-                               C)      standard=POSIX ;;
-                               esac
-                               flags=FU
+               do      eval x='$'CONF_call_${c}_${name}
+                       case $x in
+                       ?*)     call=$x
                                break
-                       fi
+                               ;;
+                       esac
+                       case $flags in
+                       *S*)    eval x='$'CONF_call_${c}_${standard}_${name}
+                               case $x in
+                               ?*)     call=$x
+                                       break
+                                       ;;
+                               esac
+                               ;;
+                       esac
                done
+               case $call in
+               XX)     for c in SC PC CS
+                       do      echo "_${c}_${name}"
+                               case $flags in
+                               *S*)    echo "_${c}_${standard}_${name}" ;;
+                               esac
+                       done
+                       ;;
+               esac
                ;;
        esac
-       case " $standards " in
-       *" $standard "*)
-               ;;
-       *)      standards="$standards $standard"
-               ;;
-       esac
-       conf_standard=CONF_${standard}
        case $call in
-       CS)     conf_call=CONF_confstr
-               ;;
-       PC)     conf_call=CONF_pathconf
-               ;;
-       SC)     conf_call=CONF_sysconf
-               ;;
-       SI)     conf_call=CONF_sysinfo
-               ;;
-       XX)     conf_call=CONF_nop
+       CS|PC|SC|SI|XX)
                ;;
        *)      echo "$command: $name: $call: invalid call" >&2
                exit 1
                ;;
        esac
-       conf_section=$section
-       conf_flags=0
        case $flags in
-       *[ABCEGHIJKQTVWYZabcdefghijklmnopqrstuvwxyz_123456789]*)
+       *[ABCEGHIJQTVWYZabcdefghijklmnopqrstuvwxyz_123456789]*)
                echo "$command: $name: $flags: invalid flag(s)" >&2
                exit 1
                ;;
        esac
-       case $flags in
-       *F*)    conf_flags="${conf_flags}|CONF_FEATURE" ;;
-       esac
-       case $flags in
-       *L*)    conf_flags="${conf_flags}|CONF_LIMIT" ;;
-       esac
-       case $flags in
-       *M*)    conf_flags="${conf_flags}|CONF_MINMAX" ;;
-       esac
-       case $flags in
-       *N*)    conf_flags="${conf_flags}|CONF_NOSECTION" ;;
-       esac
-       case $flags in
-       *P*)    conf_flags="${conf_flags}|CONF_PREFIXED" ;;
-       esac
-       case $flags in
-       *S*)    conf_flags="${conf_flags}|CONF_STANDARD" ;;
-       esac
-       case $flags in
-       *U*)    conf_flags="${conf_flags}|CONF_UNDERSCORE" ;;
-       esac
-       case $shell in
-       ksh)    conf_flags=${conf_flags#0?} ;;
-       esac
-       case $verbose in
-       1)      case $standard in
-               ????)   sep=" " ;;
-               ???)    sep="  " ;;
-               ??)     sep="   " ;;
-               ?)      sep="    " ;;
-               *)      sep="" ;;
-               esac
-               echo "$command: test: $sep$standard $call $name" >&2
-               ;;
-       esac
-       case $script in
-       ?*)     echo "$script" > $tmp.z
-               chmod +x $tmp.z
-               values="$values `./$tmp.z 2>/dev/null`"
-               ;;
-       esac
-       case $call in
-       CS|SI)  conf_flags="${conf_flags}|CONF_STRING" ;;
-       esac
-       case $flags in
-       *L*)    conf_value=$conf_name ;;
-       *)      conf_value=0 ;;
-       esac
        case $section in
        [01])   ;;
        *)      case $flags in
@@ -692,395 +684,506 @@
                ;;
        esac
        case $call in
-       XX)     conf_op=0
-               ;;
+       XX)     ;;
        *)      case $flags in
                *D*)    conf_op=${define} ;;
                *O*)    conf_op=${call}_${name} ;;
                *R*)    conf_op=_${standard}_${call}_${name} ;;
                *S*)    conf_op=_${call}_${standard}_${name} ;;
-               *U*)    conf_op=_${call}_${name} ;;
-               *)      conf_op=${call}_${name} ;;
-               esac
-               eval V='$'_dUp_$conf_op
-               case $V in
-               '')     eval _dUp_$conf_op=1 ;;
-               *)      continue ;;
-               esac
-               cat > $tmp.c <<!
-#include "FEATURE/standards"
-#include <sys/types.h>
-#include <limits.h>
-#include <unistd.h>$systeminfo$headers
-#include <stdio.h>
-main()
-{
-#ifdef TEST_enum
-#if ${conf_op}
-       (
-#endif
-#undef ${conf_op}
-       return ${conf_op} == 0;
-#endif
-#ifdef TEST_notmacro
-#ifdef ${conf_op}
-       (
-#endif
-       return 0;
-#endif
-#ifdef TEST_macro
-#ifdef ${conf_op}
-       return ${conf_op} == 1;
-#else
-       return 0;
-#endif
-#endif
-}
-!
-               if      $cc -DTEST_enum -o $tmp.exe $tmp.c >/dev/null 2>&1
-               then    echo "#define _ENUM_${conf_op}  1" >> $tmp.e 2>/dev/null
-                       if      $cc -DTEST_notmacro -o $tmp.exe $tmp.c 
>/dev/null 2>&1
-                       then    echo "#define ${conf_op}        ${conf_op}" >> 
$tmp.e 2>/dev/null
-                       fi
-               elif    $cc -DTEST_macro -o $tmp.exe $tmp.c >/dev/null 2>&1
-               then    :
-               else    # not a number -- undefined or empty (who thunk that?)
-                       continue
-               fi
-               echo ${index} ${conf_op} >> $tmp.m
-               case $call:$flags in
-               SI:*O*) ;;
-               *)      cat >> $tmp.6 <<!
-       printf("#undef  ${conf_op}\n");
-       printf("#define ${conf_op}      (-${index})\n");
-!
-                       ;;
+               *)      conf_op=_${call}_${name} ;;
                esac
+               echo "${conf_op}"
                ;;
        esac
        case $standard:$flags in
        C:*)    ;;
-       *:*L*)  {
-               echo "  hit = 0;"
-               case $call in
-               PC)     cat <<!
-#if _lib_pathconf && defined(${conf_op})
-       if ((num = pathconf("/", ${conf_op})) != -1)
-               hit = 1;
-       else
-#endif
-!
-                       ;;
-               SC)     cat <<!
-#if _lib_sysconf && defined(${conf_op})
-       if ((num = sysconf(${conf_op})) != -1)
-               hit = 1;
-       else
-#endif
-!
-                       ;;
-               esac
-               echo "  {"
-               endif=
-               default=
-               for i in $conf_name $values
-               do      case $i in
-                       _${standard}_${conf_name})
-                               ;;
-                       $sym)   case $i in
-                               _LOCAL_*)       cat <<!
-#if    defined(${i})
-!
-                                       ;;
-                               *)      cat <<!
-#if    defined(${i})
-!
-                                       ;;
-                               esac
-                               cat <<!
-       if (!hit && ${i} > 0)
-       {
-               hit = 1;
-               num = ${i};
-       }
-#else
-!
-                               endif="#endif
-$endif"
-                               case $conf_op:$flags:$i in
-                               0*|*X*:*)
-                                       ;;
-                               *:*:$conf_name)
-                                       echo "#ifndef   ${conf_op}"
-                                       endif="#endif
-$endif"
-                                       ;;
-                               esac
-                               ;;
-                       *)      case $default in
-                               "")     default=${i} ;;
-                               esac
-                               ;;
-                       esac
-               done
-               case $default in
-               ?*)     cat <<!
-       if (!hit)
-       {
-               hit = 1;
-               num = ${default};
-       }
-!
-                       ;;
-               esac
-               echo "${endif}  }"
-               cat <<!
-       if (hit)
-       {
-               printf("#undef  ${conf_name}\n");
-               printf("#define ${conf_name}            %ld\n", num);
-       }
-       else
-               num = -1;
-       lim[${limit_max}] = num;
-#ifndef ${conf_name}
-#define ${conf_name}   (lim[${limit_max}])
-#endif
-!
-               } >> $tmp.l
-               case $shell in
-               ksh)    ((limit_max=limit_max+1)) ;;
-               *)      limit_max=`expr $limit_max + 1` ;;
-               esac
+       *:*L*)  echo "${conf_name}"
+               echo "_${standard}_${conf_name}"
                ;;
        esac
-       case $call:$standard:$flags in
-       *:C:*)  ;;
-       [PSX][CX]:*:*[FM]*)
-               case $flags in
-               *M*)    header=l ;;
-               *)      header=6 ;;
-               esac
-               minmax=
-               for i in $values
-               do      case $i in
-                       $sym)   ;;
-                       *)      case $minmax in
-                               ''|'"'*'"')     minmax=${i} ;;
-                               '"'*)           minmax="${minmax} ${i}" ;;
-                               *)              minmax=${i} ;;
+done | sort -u >> $tmp.q
+sort -u < $tmp.v > $tmp.t
+mv $tmp.t $tmp.v
+case $debug in
+-d4)   exit ;;
+esac
+
+# test all the macros in a few batches (some compilers have an error limit)
+
+defined() # list-file
+{
+       : > $tmp.p
+       while   :
+       do      {
+                       cat <<!
+${head}
+#include <sys/types.h>
+#include <limits.h>
+#include <unistd.h>$systeminfo$headers
+${tail}
+#undef conf
+unsigned int conf[] = {
+!
+                       sed 's/$/,/' $1
+                       echo "};"
+               } > $tmp.c
+               [[ -f $tmp.1.c ]] || cp $tmp.c $tmp.1.c
+               if      $cc -c $tmp.c > $tmp.e 2>&1
+               then    break
+               fi
+               [[ -f $tmp.1.e ]] || cp $tmp.e $tmp.1.e
+               snl='\
+'
+               sed 
"s/[^_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789][^_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789]*/${snl}/g"
 $tmp.e |
+               grep 
'^[_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz][_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789]*$'
 |
+               sort -u > $tmp.n
+               cmp -s $tmp.n $tmp.p && break
+               fgrep -x -v -f $tmp.n $1 > $tmp.y
+               mv $tmp.y $1
+               mv $tmp.n $tmp.p
+       done
+       {
+               cat <<!
+${head}
+#include <sys/types.h>
+#include <limits.h>
+#include <unistd.h>$systeminfo$headers
+${tail}
+#undef conf
+!
+               sed 's/.*/conf "&" = &/' $1
+       } > $tmp.c
+       $cc -E $tmp.c 2>/dev/null |
+       sed -e '/conf[  ]*".*"[         ]*=[    ]*/!d' -e 
'/[_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789][  ]*(/!d' 
-e 's/.*"\(.*\)".*/\1/' > $tmp.n
+       if      test -s $tmp.n
+       then    fgrep -x -v -f $tmp.n $1 > $tmp.y
+               mv $tmp.y $1
+       fi
+}
+
+case $verbose in
+1)     echo "$command: check macros/enums as static initializers" >&2 ;;
+esac
+defined $tmp.q
+defined $tmp.v
+case $debug in
+-d5)   exit ;;
+esac
+
+# mark the constant macros/enums
+
+exec < $tmp.q
+while  read line
+do     eval CONF_const_${line}=1
+done
+exec < $tmp.v
+while  read line
+do     eval CONF_const_${line}=1
+done
+
+# mark the string literal values
+
+{
+       cat <<!
+${head}
+#include <sys/types.h>
+#include <limits.h>
+#include <unistd.h>$systeminfo$headers
+${tail}
+#undef conf
+!
+       sed 's/.*/conf "&" = &/' $tmp.q
+} > $tmp.c
+$cc -E $tmp.c 2>/dev/null |
+sed -e '/conf[         ]*".*"[         ]*=[    ]*"/!d' -e 
's/.*"\([^"]*\)".*/\1/' > $tmp.e
+exec < $tmp.e
+while  read line
+do     eval CONF_string_${line}=1
+done
+
+# walk through the table
+
+case $shell in
+ksh)   integer len name_max ;;
+esac
+name_max=1
+export tmp name standard call cc
+
+for key in $keys
+do     eval name=\"'$'CONF_name_$key\"
+       case $name in
+       '')             continue ;;
+       $keep_name)     ;;
+       *)              continue ;;
+       esac
+       eval call=\"'$'CONF_call_$key\"
+       case $call in
+       $keep_call)     ;;
+       *)              continue ;;
+       esac
+       eval standard=\"'$'CONF_standard_$key\"
+       eval section=\"'$'CONF_section_$key\"
+       eval flags=\"'$'CONF_flags_$key\"
+       eval define=\"'$'CONF_define_$key\"
+       eval values=\"'$'CONF_values_$key\"
+       eval script=\"'$'CONF_script_$key\"
+       eval args=\"'$'CONF_args_$key\"
+       eval headers=\"'$'CONF_headers_$key\"
+       conf_name=$name
+       case $call in
+       QQ)     call=XX
+               for c in SC PC CS
+               do      eval x='$'CONF_call_${c}_${name}
+                       case $x in
+                       ?*)     call=$x
+                               break
+                               ;;
+                       esac
+                       case $flags in
+                       *S*)    eval x='$'CONF_call_${c}_${standard}_${name}
+                               case $x in
+                               ?*)     call=$x
+                                       break
+                                       ;;
                                esac
                                ;;
                        esac
                done
-               macro=_${standard}_${conf_name}
-               conf_value=${macro}
-               values="$values ${macro}"
-               case $minmax in
-               "")     case $call in
-                       CS|SI)  default=0 ;;
-                       *)      default=1 ;;
-                       esac
-                       ;;
-               *)      default=$minmax ;;
-               esac
-               {
                case $call in
-               CS|SI)  type="char*" var=str fmt='\"%s\"' ;;
-               *)      type=long var=num fmt='%ld' ;;
-               esac
-               cat <<!
-#if defined(${macro})
-       {
-               static ${type}  x[] = { ${default}, ${macro} };
-               if ((sizeof(x)/sizeof(x[0])) == 1)
-               {
-                       printf("#undef  ${macro}\n");
-                       ${var} = x[0];
-               }
-               else
-                       ${var} = x[1];
-       }
-/* this comment works around a shell bug that loses a here doc newline */
-!
-               case $minmax in
-               ?*)     cat <<!
-#else
-       ${var} = ${minmax};
-#endif
-!
+               XX)     for c in SC PC CS
+                       do      eval x='$'CONF_const__${c}_${name}
+                               case $x in
+                               1)      call=$c
+                                       break
+                                       ;;
+                               esac
+                               case $flags in
+                               *S*)    eval 
x='$'CONF_const__${c}_${standard}_${name}
+                                       case $x in
+                                       1)      call=$c
+                                               break
+                                               ;;
+                                       esac
+                                       ;;
+                               esac
+                       done
                        ;;
                esac
-               cat <<!
-       printf("#undef  ${macro}\n");
-       printf("#define ${macro}        ${fmt}\n", ${var});
-!
-               case $minmax in
-               "")     cat <<!
-#endif
-!
+               case $call in
+               XX)     case $standard in
+                       C)      standard=POSIX ;;
+                       esac
+                       flags=FU
                        ;;
                esac
-               } >> $tmp.$header
                ;;
        esac
+       case " $standards " in
+       *" $standard "*)
+               ;;
+       *)      standards="$standards $standard"
+               ;;
+       esac
+       conf_standard=CONF_${standard}
        case $call in
-       CS|SI)  conf_value=0 something= ;;
-       *)      something=-0 ;;
+       CS)     conf_call=CONF_confstr
+               ;;
+       PC)     conf_call=CONF_pathconf
+               ;;
+       SC)     conf_call=CONF_sysconf
+               ;;
+       SI)     conf_call=CONF_sysinfo
+               ;;
+       XX)     conf_call=CONF_nop
+               ;;
+       esac
+       conf_op=-1
+       for s in _${call}_${name} _${call}_${standard}_${name} 
_${call}_${standard}${section}_${name} ${call}_${name}
+       do      eval x='$'CONF_const_${s}
+               case $x in
+               1)      conf_op=${s}
+                       break
+                       ;;
+               esac
+       done
+       conf_section=$section
+       conf_flags=0
+       case $flags in
+       *F*)    conf_flags="${conf_flags}|CONF_FEATURE" ;;
+       esac
+       case $flags in
+       *L*)    conf_flags="${conf_flags}|CONF_LIMIT" ;;
+       esac
+       case $flags in
+       *M*)    conf_flags="${conf_flags}|CONF_MINMAX" ;;
+       esac
+       case $flags in
+       *N*)    conf_flags="${conf_flags}|CONF_NOSECTION" ;;
+       esac
+       case $flags in
+       *P*)    conf_flags="${conf_flags}|CONF_PREFIXED" ;;
+       esac
+       case $flags in
+       *S*)    conf_flags="${conf_flags}|CONF_STANDARD" ;;
+       esac
+       case $flags in
+       *U*)    conf_flags="${conf_flags}|CONF_UNDERSCORE" ;;
        esac
-       echo $conf_name $conf_section $conf_standard $conf_value $conf_flags 
$conf_call $conf_op >> $tmp.G
        case $shell in
-       ksh)    len=${#conf_name}
-               if      ((len>=name_max))
-               then    ((name_max=len+1))
-               fi
+       ksh)    conf_flags=${conf_flags#0?} ;;
+       esac
+       case $debug in
+       ?*)     case $standard in
+               ????)   sep=" " ;;
+               ???)    sep="  " ;;
+               ??)     sep="   " ;;
+               ?)      sep="    " ;;
+               *)      sep="" ;;
+               esac
+               echo "$command: test: $sep$standard $call $name" >&2
                ;;
-       *)      len=`echo ${conf_name} | wc -c`
-               if      expr \( $len - 1 \) \>= ${name_max} >/dev/null
-               then    name_max=$len
-               fi
+       esac
+       case $call in
+       CS|SI)  conf_flags="${conf_flags}|CONF_STRING"
+               string=1
+               ;;
+       *)      eval string='$'CONF_string_${key}
                ;;
        esac
-       case $conf_op in
-       0)      ;;
-       *)      {
-               echo "#if       ${conf_op}+0
-case ${conf_op}:"
-               endif="#endif"
-               minmax=
-               for i in $name $values
-               do      case $i in
-                       $sym)   case $something in
-                               '')     cat > $tmp.c <<!
-#include "FEATURE/standards"
+       conf_limit=0
+       case $flags in
+       *L*)    d=
+               eval x='$'CONF_const_${conf_name}
+               case $x in
+               '')     for s in ${values}
+                       do      case $s in
+                               $sym)   eval x='$'CONF_const_${s}
+                                       case $x in
+                                       1)      x=$s
+                                               break
+                                               ;;
+                                       esac
+                                       ;;
+                               [0123456789]*|[-+][0123456789]*)
+                                       d=$s
+                                       break
+                                       ;;
+                               esac
+                       done
+                       case ${x:+1}:$flags:$conf_op:${script:+1} in
+                       :*:-1:1|:*X*:*:*)
+                               case $verbose in
+                               1)      echo "$command: probe for ${conf_name} 
<limits.h> value" >&2 ;;
+                               esac
+                               x=
+                               case $CONF_getconf in
+                               ?*)     if      $CONF_getconf $conf_name > 
$tmp.x 2>/dev/null
+                                       then    x=`cat $tmp.x`
+                                               case $x in
+                                               undefined)      x= ;;
+                                               esac
+                                       fi
+                                       ;;
+                               esac
+                               case ${x:+1}:${script:+1} in
+                               :1)     case $script in
+                                       '#'*)   echo "$script" > $tmp.sh
+                                               chmod +x $tmp.sh
+                                               x=`./$tmp.sh 2>/dev/null`
+                                               ;;
+                                       *)      cat > $tmp.c <<!
+${head}
 #include <sys/types.h>
 #include <limits.h>
 #include <unistd.h>$systeminfo$headers
-">>>" $i "<<<"
+${tail}
+${script}
 !
-                                       i=`$cc -E $tmp.c 2>/dev/null | sed -e 
'/">>>".*"<<<"/!d' -e 's/.*">>>"[         ]*\([^  ]*\)[   ]*"<<<".*/\1/'`
-                                       case $i in
-                                       $i)             ;;
-                                       '"'*'"')        echo "          
return($i);" ;;
-                                       *'"'*)          ;;
-                                       *)              echo "          
return(\"$i\");" ;;
+                                               ;;
                                        esac
-                                       ;;
-                               *)      echo "#ifdef    $i
-               return($i${something});
-#else"
-                                       endif="$endif
-#endif"
+                                       case $args in
+                                       '')     set "" ;;
+                                       *)      eval set "" "$args"; shift ;;
+                                       esac
+                                       for a
+                                       do      case $script in
+                                               '#'*)   ./$tmp.sh $a > $tmp.x 
2>/dev/null
+                                                       x=$?
+                                                       ;;
+                                               *)      $cc $a -o $tmp.exe 
$tmp.c >/dev/null 2>&1 && ./$tmp.exe > $tmp.x 2>/dev/null
+                                                       x=$?
+                                                       ;;
+                                               esac
+                                               case $x in
+                                               0)      x=`cat $tmp.x`
+                                                       case $x in
+                                                       "-")    x=$a ;;
+                                                       esac
+                                                       break
+                                                       ;;
+                                               *)      x=
+                                                       ;;
+                                               esac
+                                       done
                                        ;;
                                esac
+                               case $x in
+                               '')     x=$d ;;
+                               esac
                                ;;
-                       *)      case $flags in
-                               *M*)    minmax=$i ;;
+                       esac
+                       case ${x:+1}:$flags:$conf_op in
+                       1:*:-1|1:*X*:*)
+                               conf_limit=$x
+                               conf_flags="${conf_flags}|CONF_LIMIT_DEF"
+                               case $string:$x in
+                               1:*)    cat >> $tmp.l <<!
+printf("#ifndef ${conf_name}\n");
+printf("#define ${conf_name} \"${x}\"\n");
+printf("#endif\n");
+!
+                                       ;;
+                               *:U*)   cat >> $tmp.l <<!
+printf("#ifndef ${conf_name}\n");
+printf("#ifndef ${x}\n");
+printf("#define ${x} %lu\n", ${x});
+printf("#endif\n");
+printf("#define ${conf_name} ${x}\n");
+printf("#endif\n");
+!
+                                       ;;
+                               *:$sym) cat >> $tmp.l <<!
+printf("#ifndef ${conf_name}\n");
+printf("#ifndef ${x}\n");
+printf("#define ${x} %ld\n", ${x});
+printf("#endif\n");
+printf("#define ${conf_name} ${x}\n");
+printf("#endif\n");
+!
+                                       ;;
+                               *)      cat >> $tmp.l <<!
+printf("#ifndef ${conf_name}\n");
+printf("#define ${conf_name} ${x}\n");
+printf("#endif\n");
+!
+                                       ;;
                                esac
                                ;;
                        esac
-               done
-               case $minmax in
-               ?*)     echo "          return($minmax${something});" ;;
-               *)      echo "          break;" ;;
+                       ;;
                esac
-               echo "$endif"
-               } >> $tmp.$call
                ;;
        esac
-done
-case $debug in
--d4)   exit ;;
-esac
-
-# internal to external map
-
-base=confmap
-case $verbose in
-1)     echo "$command: generate ${base}.h internal to external map header" >&2 
;;
-esac
-{
-cat <<!
-#pragma prototyped
-#define ${base}                _conf_map
-${generated}
-extern const short     ${base}[];
-!
-} | proto > $tmp.0
-case $debug in
--d5)   echo $command: $tmp.0 ${base}.h ;;
-*)     cmp -s $tmp.0 ${base}.h 2>/dev/null || mv $tmp.0 ${base}.h ;;
-esac
-
-case $verbose in
-1)     echo "$command: generate ${base}.c internal to external map" >&2 ;;
-esac
-sort -n $tmp.m | {
-case $shell in
-ksh)   integer next ;;
-esac
-next=0
-while  read index macro
-do     case $shell in
-       ksh)    while   :
-               do      ((next=next+1))
-                       ((next>=$index)) && break
-                       echo "  -1,"
-               done
+       case $section in
+       [01])   ;;
+       *)      case $flags in
+               *N*)    ;;
+               *)      name=${section}_${name} ;;
+               esac
+               standard=${standard}${section}
                ;;
-       *)      while   :
-               do      next=`expr $next + 1`
-                       expr $next \>= $index > /dev/null && break
-                       echo "  -1,"
+       esac
+       conf_minmax=0
+       case $call:$standard:$flags in
+       *:C:*)  ;;
+       [CPSX][CSX]:*:*[FM]*)
+               x=
+               for s in _${standard}_${conf_name} ${values}
+               do      case $s in
+                       $sym)   eval x='$'CONF_const_${s} ;;
+                       *)      x=1 ;;
+                       esac
+                       case $x in
+                       1)      conf_minmax=$s
+                               conf_flags="${conf_flags}|CONF_MINMAX_DEF"
+                               break
+                               ;;
+                       esac
                done
+               case ${x:+1}:${script:+1} in
+               :1)     case $verbose in
+                       1)      echo "$command: probe for 
_${standard}_${conf_name} minmax value" >&2 ;;
+                       esac
+                       case $CONF_getconf in
+                       ?*)     if      $CONF_getconf _${standard}_${conf_name} 
> $tmp.x 2>/dev/null
+                               then    x=`cat $tmp.x`
+                                       case $x in
+                                       undefined)      x= ;;
+                                       esac
+                               fi
+                               ;;
+                       esac
+                       case $x in
+                       '')     case $script in
+                               '#'*)   echo "$script" > $tmp.sh
+                                       chmod +x $tmp.sh
+                                       x=`./$tmp.sh 2>/dev/null`
+                                       ;;
+                               *)      cat > $tmp.c <<!
+${head}
+#include <sys/types.h>
+#include <limits.h>
+#include <unistd.h>$systeminfo$headers
+${tail}
+${script}
+!
+                                       ;;
+                               esac
+                               case $args in
+                               '')     set "" ;;
+                               *)      eval set '""' "$args"; shift ;;
+                               esac
+                               for a
+                               do      case $script in
+                                       '#'*)   ./$tmp.sh $a > $tmp.x 
2>/dev/null
+                                               x=$?
+                                               ;;
+                                       *)      $cc $a -o $tmp.exe $tmp.c 
>/dev/null 2>&1 && ./$tmp.exe > $tmp.x 2>/dev/null
+                                               x=$?
+                                               ;;
+                                       esac
+                                       case $x in
+                                       0)      x=`cat $tmp.x`
+                                               case $x in
+                                               "-")    x=$a ;;
+                                               esac
+                                               break
+                                               ;;
+                                       *)      x=
+                                               ;;
+                                       esac
+                               done
+                               ;;
+                       esac
+                       case $x in
+                       ?*)     conf_minmax=$x
+                               conf_flags="${conf_flags}|CONF_MINMAX_DEF"
+                               ;;
+                       esac
+                       ;;
+               esac
                ;;
        esac
-       cat <<!
-#if    ($macro+0) || _ENUM_$macro
-       $macro,
-#else
-       -1,
-#endif
-!
-done
-echo $next >&3
-} > $tmp.c 3> $tmp.x
-map_max=`cat $tmp.x`
-{
-cat <<!
-#pragma prototyped
-#include "FEATURE/limits.lcl"
-#include "FEATURE/unistd.lcl"
-#include "${base}.h"
-
-${generated}
-!
-if     test -s $tmp.e
-then   cat <<!
-
-/*
- * enum used on an extensible namespace -- bad idea
- */
-
-!
-       cat $tmp.e
-fi
-cat <<!
-
-/*
- * internal to external conf index map
- */
-
-const short ${base}[] =
-{
-       $map_max,
-!
-cat $tmp.c
-echo "};"
-} | proto > $tmp.1
+       case $string in
+       1)      conf_limit="{ 0, $conf_limit }" conf_minmax="{ 0, $conf_minmax 
}" ;;
+       *)      conf_limit="{ $conf_limit, 0 }" conf_minmax="{ $conf_minmax, 0 
}" ;;
+       esac
+       echo "{ \"$conf_name\", $conf_limit, $conf_minmax, $conf_flags, 
$conf_standard, $conf_section, $conf_call, $conf_op },"
+       case $shell in
+       ksh)    len=${#conf_name}
+               if      ((len>=name_max))
+               then    ((name_max=len+1))
+               fi
+               ;;
+       *)      len=`echo ${conf_name} | wc -c`
+               if      expr \( $len - 1 \) \>= ${name_max} >/dev/null
+               then    name_max=$len
+               fi
+               ;;
+       esac
+done > $tmp.t
 case $debug in
--d5)   echo $command: $tmp.1 ${base}.c ;;
-*)     cmp -s $tmp.1 ${base}.c 2>/dev/null || mv $tmp.1 ${base}.c ;;
+-d6)   exit ;;
 esac
 
 # conf string table
@@ -1103,11 +1206,11 @@
 
 ${generated}
 
-#define conf           _conf_data
-#define conf_elements  _conf_ndata
+#define conf           _ast_conf_data
+#define conf_elements  _ast_conf_ndata
 
-#define prefix         _conf_prefix
-#define prefix_elements        _conf_nprefix
+#define prefix         _ast_conf_prefix
+#define prefix_elements        _ast_conf_nprefix
 
 #define CONF_nop       0
 #define        CONF_confstr    1
@@ -1125,33 +1228,53 @@
        esac
 done
 echo "#define CONF_call        ${index}"
+case $CONF_getconf in
+?*)    echo
+       echo "#define _pth_getconf      \"$CONF_getconf\""
+       case $CONF_getconf_a in
+       ?*)     echo "#define _pth_getconf_a    \"$CONF_getconf_a\"" ;;
+       esac
+       ;;
+esac
 cat <<!
 
-#define CONF_DEFINED   (1<<0)
-#define CONF_FEATURE   (1<<1)
-#define CONF_LIMIT     (1<<2)
+#define CONF_FEATURE   (1<<0)
+#define CONF_LIMIT     (1<<1)
+#define CONF_LIMIT_DEF (1<<2)
 #define CONF_MINMAX    (1<<3)
-#define CONF_NOSECTION (1<<4)
-#define CONF_PREFIXED  (1<<5)
-#define CONF_STANDARD  (1<<6)
-#define CONF_STRING    (1<<7)
-#define CONF_UNDERSCORE        (1<<8)
-#define CONF_USER      (1<<9)
+#define CONF_MINMAX_DEF        (1<<4)
+#define CONF_NOSECTION (1<<5)
+#define CONF_PREFIXED  (1<<6)
+#define CONF_STANDARD  (1<<7)
+#define CONF_STRING    (1<<8)
+#define CONF_UNDERSCORE        (1<<9)
+#define CONF_USER      (1<<10)
+
+struct Conf_s; typedef struct Conf_s Conf_t;
+
+typedef int (*Conf_f)(Conf_t*, _ast_intmax_t*, char**);
 
-typedef struct
+typedef struct Value_s
+{
+       _ast_intmax_t   number;
+       const char*     string;
+} Value_t;
+
+struct Conf_s
 {
        const char      name[${name_max}];
-       long            value;
+       Value_t         limit;
+       Value_t         minmax;
        short           flags;
        short           standard;
        short           section;
        short           call;
        short           op;
-} Conf_t;
+};
 
-typedef struct
+typedef struct Prefix_s
 {
-       const char      name[8];
+       const char      name[16];
        short           length;
        short           standard;
        short           call;
@@ -1165,9 +1288,10 @@
 
 #endif
 !
-} | proto > $tmp.2
+} > $tmp.1
+proto < $tmp.1 > $tmp.2
 case $debug in
--d5)   echo $command: $tmp.2 ${base}.h ;;
+-d7)   echo $command: $tmp.2 ${base}.h ;;
 *)     cmp -s $tmp.2 ${base}.h 2>/dev/null || mv $tmp.2 ${base}.h ;;
 esac
 
@@ -1177,8 +1301,11 @@
 {
 cat <<!
 #pragma prototyped
-#include <ast.h>
-#include <time.h>
+${head}
+#include <sys/types.h>
+#include <limits.h>
+#include <unistd.h>$systeminfo$headers
+${tail}
 #include "${base}.h"
 
 ${generated}
@@ -1205,7 +1332,7 @@
        "SI",           2,      CONF_SVID,      CONF_sysinfo,
 };
 
-int    prefix_elements = elementsof(prefix);
+int    prefix_elements = (int)sizeof(prefix) / (int)sizeof(prefix[0]);
 
 /*
  * conf strings sorted in ascending order
@@ -1214,336 +1341,38 @@
 const Conf_t conf[] =
 {
 !
-if     test -f $tmp.G
-then   sort -u < $tmp.G |
-       while   read name section standard value flags call op
-       do      case $op in
-               $sym)   echo "#if       $op+0" ;;
-               esac
-               case $value in
-               $sym)   echo "\"$name\",
-#ifdef $value
-       $value, $flags|CONF_DEFINED,
-#else
-       0, $flags,
-#endif
-       $standard, $section, $call, $op,"
-                       ;;
-               *)      echo \"$name\", $value, $flags, $standard, $section, 
$call, $op,
-                       ;;
-               esac
-               case $op in
-               $sym)   echo "#endif" ;;
-               esac
-       done
-else   echo '""'
-fi
+cat $tmp.t
 cat <<!
 };
 
-int    conf_elements = elementsof(conf);
+int    conf_elements = (int)sizeof(conf) / (int)sizeof(conf[0]);
 !
-} | proto > $tmp.3
+} > $tmp.2
+proto < $tmp.2 > $tmp.3
 case $debug in
--d5)   echo $command: $tmp.3 ${base}.c ;;
+-d7)   echo $command: $tmp.3 ${base}.c ;;
 *)     cmp -s $tmp.3 ${base}.c 2>/dev/null || mv $tmp.3 ${base}.c ;;
 esac
 
-# conf generator definitions
-
-base=conflib
-case $verbose in
-1)     echo "$command: generate ${base}.h generator header" >&2 ;;
-esac
-{
-cat <<!
-#pragma prototyped
-#define _ast_sysconf(x)        0
-#undef _sysconf
-#define _sysconf(x)    0
-
-${generated}
-
-!
-cat $tmp.h
-cat <<!
-
-#undef _ast_sysconf
-#undef _sysconf
-!
-} | proto > $tmp.4
-case $debug in
--d5)   echo $command: $tmp.4 ${base}.h ;;
-*)     cmp -s $tmp.4 ${base}.h 2>/dev/null || mv $tmp.4 ${base}.h ;;
-esac
-
 # limits.h generation code
 
 base=conflim
 case $verbose in
-1)     echo "$command: generate ${base}.c <limits.h> generator" >&2 ;;
+1)     echo "$command: generate ${base}.h supplemental <limits.h> values" >&2 
;;
 esac
 {
 cat <<!
-       /*
-        * some implementations (could it beee aix) think empty
-        * definitions constitute symbolic constants
-        */
+${generated}
 
-       {
-       long    num;
-       char*   str;
-       int     hit;
-       long    lim[${limit_max}+1];
+/*
+ * supplemental <limits.h> values
+ */
 
 !
 test -f $tmp.l && cat $tmp.l
-echo " }"
 } > $tmp.5
 case $debug in
--d5)   echo $command: $tmp.5 ${base}.h ;;
+-d7)   echo $command: $tmp.5 ${base}.h ;;
 *)     cmp -s $tmp.5 ${base}.h 2>/dev/null || mv $tmp.5 ${base}.h ;;
 esac
-
-# unistd.h generation code
-
-base=confuni
-case $verbose in
-1)     echo "$command: generate ${base}.c <unistd.h> generator" >&2 ;;
-esac
-echo " }" >> $tmp.6
-case $debug in
--d5)   echo $command: $tmp.6 ${base}.h ;;
-*)     cmp -s $tmp.6 ${base}.h 2>/dev/null || mv $tmp.6 ${base}.h ;;
-esac
-
-# confstr implementation
-
-base=confstr pfx=CS
-case $verbose in
-1)     echo "$command: generate ${base}.c ${base}() implementation" >&2 ;;
-esac
-{
-cat <<!
-#pragma prototyped
-#include <ast.h>
-#include <error.h>
-
-#ifndef ${base}
-
-NoN(${base})
-
-#else
-
-${generated}
-
-#include "confmap.h"
-#include "conflib.h"
-
-static char*
-local_${base}(int op)
-{
-       switch (op)
-       {
-!
-test -f $tmp.${pfx} && cat $tmp.${pfx}
-cat <<!
-       default:
-               break;
-       }
-       return(0);
-}
-
-size_t
-${base}(int op, char* buf, size_t siz)
-{
-       char*   s;
-       int     n;
-#if _lib_${base}
-#undef ${base}
-       if (((n = op) >= 0 || -op <= confmap[0] && (n = confmap[-op]) >= 0) && 
(n = ${base}(n, buf, siz)) > 0)
-               return(n);
-#endif
-       if (s = local_${base}(op))
-       {
-               if ((n = strlen(s) + 1) >= siz)
-               {
-                       if (siz == 0)
-                               return(n + 1);
-                       buf[n = siz - 1] = 0;
-               }
-               memcpy(buf, s, n);
-               return(n);
-       }
-       errno = EINVAL;
-       return(0);
-}
-
-#endif
-!
-} | proto > $tmp.7
-case $debug in
--d5)   echo $command: $tmp.7 ${base}.c ;;
-*)     cmp -s $tmp.7 ${base}.c 2>/dev/null || mv $tmp.7 ${base}.c ;;
-esac
-
-# pathconf implementation
-
-base=pathconf pfx=PC
-case $verbose in
-1)     echo "$command: generate ${base}.c ${base}() implementation" >&2 ;;
-esac
-{
-cat <<!
-#pragma prototyped
-#include <ast.h>
-#include <error.h>
-#include <ls.h>
-
-#ifndef ${base}
-
-NoN(${base})
-
-#else
-
-${generated}
-
-#include "confmap.h"
-#include "conflib.h"
-
-static long
-statconf(struct stat* st, int op)
-{
-       switch (op)
-       {
-!
-test -f $tmp.${pfx} && cat $tmp.${pfx}
-cat <<!
-       default:
-               break;
-       }
-       errno = EINVAL;
-       return(-1);
-}
-
-long
-f${base}(int fd, int op)
-{
-       int             n;
-       struct stat     st;
-#if _lib_f${base}
-#undef f${base}
-       if ((n = op) >= 0 || -op <= confmap[0] && (n = confmap[-op]) >= 0)
-       {
-               long    val;
-               int     olderrno;
-               int     syserrno;
-
-               olderrno = errno;
-               errno = 0;
-               val = f${base}(fd, n);
-               syserrno = errno;
-               errno = olderrno;
-               if (val != -1L || syserrno == 0)
-                       return(val);
-       }
-#endif
-       return((n = fstat(fd, &st)) ? n : statconf(&st, op));
-}
-
-long
-${base}(const char* path, int op)
-{
-       int             n;
-       struct stat     st;
-#if _lib_${base}
-#undef ${base}
-       if ((n = op) >= 0 || -op <= confmap[0] && (n = confmap[-op]) >= 0)
-       {
-               long    val;
-               int     olderrno;
-               int     syserrno;
-
-               olderrno = errno;
-               errno = 0;
-               val = ${base}(path, n);
-               syserrno = errno;
-               errno = olderrno;
-               if (val != -1L || syserrno == 0)
-                       return(val);
-       }
-#endif
-       return((n = stat(path, &st)) ? n : statconf(&st, op));
-}
-
-#endif
-!
-} | proto > $tmp.8
-case $debug in
--d5)   echo $command: $tmp.8 ${base}.c ;;
-*)     cmp -s $tmp.8 ${base}.c 2>/dev/null || mv $tmp.8 ${base}.c ;;
-esac
-
-# sysconf implementation
-
-base=sysconf pfx=SC
-case $verbose in
-1)     echo "$command: generate ${base}.c ${base}() implementation" >&2 ;;
-esac
-{
-cat <<!
-#pragma prototyped
-#include <ast.h>
-#include <error.h>
-
-#ifndef ${base}
-
-NoN(${base})
-
-#else
-
-${generated}
-
-#include "confmap.h"
-#include "conflib.h"
-
-long
-${base}(int op)
-{
-       int     n;
-#if _lib_${base}
-#undef ${base}
-       if ((n = op) >= 0 || -op <= confmap[0] && (n = confmap[-op]) >= 0)
-       {
-               long    val;
-               int     olderrno;
-               int     syserrno;
-
-               olderrno = errno;
-               errno = 0;
-               val = ${base}(n);
-               syserrno = errno;
-               errno = olderrno;
-               if (val != -1L || syserrno == 0)
-                       return(val);
-       }
-#endif
-       switch (op)
-       {
-!
-test -f $tmp.${pfx} && cat $tmp.${pfx}
-cat <<!
-       default:
-               break;
-       }
-       errno = EINVAL;
-       return(-1);
-}
-
-#endif
-!
-} | proto > $tmp.9
-case $debug in
--d5)   echo $command: $tmp.9 ${base}.c ;;
-*)     cmp -s $tmp.9 ${base}.c 2>/dev/null || mv $tmp.9 ${base}.c ;;
-esac
+exit 0
diff -r -N -u ksh93_2006_09_12/src/lib/libast/comp/conf.tab 
ksh93_2006_10_31/src/lib/libast/comp/conf.tab
--- ksh93_2006_09_12/src/lib/libast/comp/conf.tab       2005-03-11 
16:27:02.000000000 +0100
+++ ksh93_2006_10_31/src/lib/libast/comp/conf.tab       2006-10-25 
17:17:18.000000000 +0200
@@ -1,26 +1,24 @@
 #
-# posix limits,unistd,confstr,fpathconf,pathconf,sysconf macro table
+# posix { getconf limits } macro table
 #
-# @(#)conf.tab (AT&T Research) 2005-03-11
+# @(#)conf.tab (AT&T Research) 2006-10-25
 #
-# name index standard section call flags [ value ... ]
-# [ <tab> _LOCAL_name macro definition ... ]
+# name standard section call flags [ header ... ] [ value ... ]
 #
 # name:                sans prefix
-# index:       starts at 1, must not change or be reused
 # standard:    AST, C, POSIX, SVID, XOPEN, <vendor> { SCO, SGI, SUN, ... }
 # section:     section number in standard
 # call:                CS=confstr PC=pathconf SC=sysconf SI=sysinfo QQ=query 
XX=none
 # flags:       0       no flags
-#              F       feature for unistd.h
-#              L       constant for limits.h
+#              F       unistd.h feature
+#              L       limits.h constant
 #              M       has _<standard><section>_<name> minmax value
 #              N       _<call>_<name>
 #              O       use original name and definition
 #              R       _<standard>_<call>_<section>_<name>
 #              S       _<call>_<standard><section>_<name>
 #              U       <standard><section>_<name> prefixed by underscore
-#              X       define even if local is indeterminant (ast special)
+#              X       define even if native is dynamic (ast special)
 #
 # default names if <section> <= 1
 #
@@ -35,25 +33,24 @@
 # the [NSU] flags modify the default names
 #
 
-AIO_LISTIO_MAX         1       POSIX   SC 1 LMU        2
-AIO_MAX                        2       POSIX   SC 1 LMU        1
-AIO_PRIO_DELTA_MAX     3       POSIX   SC 1 LMU
-ARG_MAX                        4       POSIX   SC 1 LMU        NCARGS 4096
-ASYNCHRONOUS_IO                5       POSIX   SC 1 FU
-ASYNC_IO               6       POSIX   PC 1 FU
-ATEXIT_MAX             82      XOPEN   SC 1 LMU        32
-AVPHYS_PAGES           121     SUN     SC 1 0
-BC_BASE_MAX            7       POSIX   SC 2 LMN        99
-BC_DIM_MAX             8       POSIX   SC 2 LMN        2048
-BC_SCALE_MAX           9       POSIX   SC 2 LMN        99
-BC_STRING_MAX          10      POSIX   SC 2 LMN        1000
-CHARCLASS_NAME_MAX     102     XOPEN   XX 1 L          14
-CHAR_BIT               13      C       XX 1 L          8
-CHAR_MAX               14      C       XX 1 L
-CHAR_MIN               15      C       XX 1 L
-CHAR_TERM              16      POSIX   SC 2 FU
-CHILD_MAX              17      POSIX   SC 1 LMU        6
-       #define _LOCAL_CHILD_MAX        local_child_max()
+AIO_LISTIO_MAX                 POSIX   SC 1 LMU        2
+AIO_MAX                                POSIX   SC 1 LMU        1
+AIO_PRIO_DELTA_MAX             POSIX   SC 1 LMU
+ARG_MAX                                POSIX   SC 1 LMUX       NCARGS 4096
+ASYNCHRONOUS_IO                        POSIX   SC 1 FU
+ASYNC_IO                       POSIX   PC 1 FU
+ATEXIT_MAX                     XOPEN   SC 1 LMU        32
+AVPHYS_PAGES                   SUN     SC 1 0
+BC_BASE_MAX                    POSIX   SC 2 LMN        99
+BC_DIM_MAX                     POSIX   SC 2 LMN        2048
+BC_SCALE_MAX                   POSIX   SC 2 LMN        99
+BC_STRING_MAX                  POSIX   SC 2 LMN        1000
+CHARCLASS_NAME_MAX             XOPEN   XX 1 L          14
+CHAR_BIT                       C       XX 1 L          8
+CHAR_MAX                       C       XX 1 L
+CHAR_MIN                       C       XX 1 L
+CHAR_TERM                      POSIX   SC 2 FU
+CHILD_MAX                      POSIX   SC 1 LMUX       6       cc{
        #if _lib_fork
        #define child()         fork()
        #else
@@ -64,8 +61,7 @@
        static char*            cmd[] = { "/bin/echo", 0 };
        #define child()         spawnve(cmd[0],cmd,(char**)0)
        #endif
-       static int
-       local_child_max(void)
+       int main()
        {
                int     i;
                int     n;
@@ -73,109 +69,110 @@
                        if (!n) _exit(0);
                while (wait((int*)0) > 0);
                for (n = 8; n < i; n <<= 1);
-               return(n);
+               printf("%d", n);
+               return 0;
        }
-CHOWN_RESTRICTED       18      POSIX   PC 1 FU
-CKPT                   97      POSIX   SC 1 FU
-CLK_TCK                        19      AST     SC 1 MU         HZ 60
-CLOCKRES_MIN           20      POSIX   SC 1 MU         1
-COLL_WEIGHTS_MAX       21      POSIX   SC 2 LMN        2
-CRYPT                  116     XOPEN   SC 1 FSU
-C_BIND                 11      POSIX   SC 2 FU
-C_DEV                  12      POSIX   SC 2 FU
-C_VERSION              98      POSIX   SC 2 FU
-DELAYTIMER_MAX         22      POSIX   SC 1 LMU        32
-ENH_I18N               117     XOPEN   SC 1 FSU
-EXPR_NEST_MAX          23      POSIX   SC 2 LMN        32
-FCHR_MAX               24      SVID    SC 1 LMU        LONG_MAX 2147483647
-FILESIZEBITS           154     POSIX   PC 1 LMU        32
-       #define _LOCAL_FILESIZEBITS     (8*sizeof(off_t))
-FORT_DEV               25      POSIX   SC 2 FU
-FORT_RUN               26      POSIX   SC 2 FU
-FSYNC                  27      POSIX   SC 1 FU         _lib_fsync
-INT_MAX                        28      C       XX 1 L          32767
-INT_MIN                        29      C       XX 1 L          -32767
-IOV_MAX                        100     XOPEN   SC 1 LMU        16
-JOB_CONTROL            30      POSIX   SC 1 FU
+}
+CHOWN_RESTRICTED               POSIX   PC 1 FU
+CKPT                           POSIX   SC 1 FU
+CLK_TCK                                POSIX   SC 1 L          HZ 60
+CLOCKRES_MIN                   POSIX   SC 1 MU         1
+COLL_WEIGHTS_MAX               POSIX   SC 2 LMN        2
+CRYPT                          XOPEN   SC 1 FSU
+C_BIND                         POSIX   SC 2 FU
+C_DEV                          POSIX   SC 2 FU
+C_VERSION                      POSIX   SC 2 FU
+DELAYTIMER_MAX                 POSIX   SC 1 LMU        32
+ENH_I18N                       XOPEN   SC 1 FSU
+EXPR_NEST_MAX                  POSIX   SC 2 LMN        32
+FCHR_MAX                       SVID    SC 1 LMU        LONG_MAX 2147483647
+FILESIZEBITS                   POSIX   PC 1 LMU        (8*sizeof(off_t)) 32
+FORT_DEV                       POSIX   SC 2 FU
+FORT_RUN                       POSIX   SC 2 FU
+FSYNC                          POSIX   SC 1 FU         _lib_fsync
+INT_MAX                                C       XX 1 L          32767
+INT_MIN                                C       XX 1 L          -32767
+IOV_MAX                                XOPEN   SC 1 LMU        16
+JOB_CONTROL                    POSIX   SC 1 FU         cc{
        #include "FEATURE/wait"
        #if _ok_wif
-       #define _LOCAL_JOB_CONTROL      1
+       int main()
+       {
+               printf("1");
+               return 0;
+       }
        #endif
-KERNEL_CLIST           132     SCO     SC 1 0
-KERNEL_CLIST_MAX       133     SCO     SC 1 0
-KERNEL_DISK            134     SCO     SC 1 0
-KERNEL_DISK_MAX                135     SCO     SC 1 0
-KERNEL_DMABUF          136     SCO     SC 1 0
-KERNEL_DMABUF_MAX      137     SCO     SC 1 0
-KERNEL_FILE            138     SCO     SC 1 0
-KERNEL_FILE_MAX                139     SCO     SC 1 0
-KERNEL_FLCKREC         140     SCO     SC 1 0
-KERNEL_FLCKREC_MAX     141     SCO     SC 1 0
-KERNEL_INODE           142     SCO     SC 1 0
-KERNEL_INODE_MAX       143     SCO     SC 1 0
-KERNEL_MOUNT           144     SCO     SC 1 0
-KERNEL_MOUNT_MAX       145     SCO     SC 1 0
-KERNEL_PINODE          146     SCO     SC 1 0
-KERNEL_PINODE_MAX      147     SCO     SC 1 0
-KERNEL_PROC            148     SCO     SC 1 0
-KERNEL_PROC_MAX                149     SCO     SC 1 0
-KERNEL_REGION          150     SCO     SC 1 0
-KERNEL_REGION_MAX      151     SCO     SC 1 0
-KERNEL_S5INODE         152     SCO     SC 1 0
-KERNEL_S5INODE_MAX     153     SCO     SC 1 0
-LFS_CFLAGS             155     POSIX   CS 1 MU {
-       cat > $tmp.c <<!
+}
+KERNEL_CLIST                   SCO     SC 1 0
+KERNEL_CLIST_MAX               SCO     SC 1 0
+KERNEL_DISK                    SCO     SC 1 0
+KERNEL_DISK_MAX                        SCO     SC 1 0
+KERNEL_DMABUF                  SCO     SC 1 0
+KERNEL_DMABUF_MAX              SCO     SC 1 0
+KERNEL_FILE                    SCO     SC 1 0
+KERNEL_FILE_MAX                        SCO     SC 1 0
+KERNEL_FLCKREC                 SCO     SC 1 0
+KERNEL_FLCKREC_MAX             SCO     SC 1 0
+KERNEL_INODE                   SCO     SC 1 0
+KERNEL_INODE_MAX               SCO     SC 1 0
+KERNEL_MOUNT                   SCO     SC 1 0
+KERNEL_MOUNT_MAX               SCO     SC 1 0
+KERNEL_PINODE                  SCO     SC 1 0
+KERNEL_PINODE_MAX              SCO     SC 1 0
+KERNEL_PROC                    SCO     SC 1 0
+KERNEL_PROC_MAX                        SCO     SC 1 0
+KERNEL_REGION                  SCO     SC 1 0
+KERNEL_REGION_MAX              SCO     SC 1 0
+KERNEL_S5INODE                 SCO     SC 1 0
+KERNEL_S5INODE_MAX             SCO     SC 1 0
+LFS_CFLAGS                     POSIX   CS 1 MU         cc{ -D_LARGEFILE_SOURCE 
"-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" -D_LARGEFILE64_SOURCE -64
        #include <sys/types.h>
-       main() { return sizeof(off_t) != sizeof(off64_t); }
-       !
-       for i in -D_LARGEFILE_SOURCE "-D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64" -D_LARGEFILE64_SOURCE -64
-       do      if      $cc -o $tmp.x $i $tmp.c && ./$tmp.x
-               then    echo '"'$i'"'; break
-               fi
-       done
+       int
+       main()
+       {
+               if (sizeof(off_t) >= sizeof(off_64_t))
+               {
+                       printf("-");
+                       return 0;
+               }
+               return 1;
+       }
 }
-LFS_LDFLAGS            156     POSIX   CS 1 MU { LFS_CFLAGS }
-LFS_LINTFLAGS          157     POSIX   CS 1 MU { LFS_CFLAGS }
-LFS_LIBS               158     POSIX   CS 1 MU
-LFS64_CFLAGS           159     POSIX   CS 1 MU { LFS_CFLAGS }
-LFS64_LDFLAGS          160     POSIX   CS 1 MU { LFS_CFLAGS }
-LFS64_LINTFLAGS                161     POSIX   CS 1 MU { LFS_CFLAGS }
-LFS64_LIBS             162     POSIX   CS 1 MU
-LINE_MAX               31      POSIX   SC 2 LMN        2048
-LINK_MAX               32      POSIX   PC 1 LMU        MAXLINK SHRT_MAX 8
-LOCALEDEF              99      POSIX   SC 1 FU
-LOCALEDEF              33      POSIX   SC 2 FU
-LOGNAME_MAX            129     SVID    SC 1 MU         8
-LONG_BIT               56      XOPEN   XX 1 L          32
-       #ifdef  CHAR_BIT
-       #define _LOCAL_LONG_BIT         (CHAR_BIT*sizeof(long))
-       #else
-       #define _LOCAL_LONG_BIT         (8*sizeof(int))
-       #endif
-LONG_MAX               34      C       XX 1 L          2147483647
-LONG_MIN               35      C       XX 1 L          -2147483647
-MAPPED_FILES           36      POSIX   SC 1 FU         _lib_mmap
-MAX_CANON              37      POSIX   PC 1 LMU        CANBSIZ 255
-MAX_INPUT              38      POSIX   PC 1 LMU        MAX_CANON 255   
-MB_LEN_MAX             39      C       XX 1 L          1
-MEMLOCK                        40      POSIX   SC 1 FU
-MEMLOCK_RANGE          41      POSIX   SC 1 FU
-MEMORY_PROTECTION      42      POSIX   SC 1 FU
-MESSAGE_PASSING                43      POSIX   SC 1 FU
-MQ_OPEN_MAX            44      POSIX   SC 1 LMU        8
-MQ_PRIO_MAX            45      POSIX   SC 1 LMU        32
-NACLS_MAX              122     SVID    SC 1 0
-NAME_MAX               46      POSIX   PC 1 LMU        14
+LFS_LDFLAGS                    POSIX   CS 1 MU         : LFS_CFLAGS
+LFS_LINTFLAGS                  POSIX   CS 1 MU         : LFS_CFLAGS
+LFS_LIBS                       POSIX   CS 1 MU
+LFS64_CFLAGS                   POSIX   CS 1 MU         : LFS_CFLAGS
+LFS64_LDFLAGS                  POSIX   CS 1 MU         : LFS_CFLAGS
+LFS64_LINTFLAGS                        POSIX   CS 1 MU         : LFS_CFLAGS
+LFS64_LIBS                     POSIX   CS 1 MU
+LINE_MAX                       POSIX   SC 2 LMN        2048
+LINK_MAX                       POSIX   PC 1 LMU        MAXLINK SHRT_MAX 8
+LOCALEDEF                      POSIX   SC 1 FU
+LOCALEDEF                      POSIX   SC 2 FU
+LOGNAME_MAX                    SVID    SC 1 MU         8
+LONG_BIT                       XOPEN   XX 1 L          (8*sizeof(long)) 32
+LONG_MAX                       C       XX 1 L          2147483647
+LONG_MIN                       C       XX 1 L          -2147483647
+MAPPED_FILES                   POSIX   SC 1 FU         _lib_mmap
+MAX_CANON                      POSIX   PC 1 LMU        CANBSIZ 255
+MAX_INPUT                      POSIX   PC 1 LMU        MAX_CANON 255   
+MB_LEN_MAX                     C       XX 1 L          1
+MEMLOCK                                POSIX   SC 1 FU
+MEMLOCK_RANGE                  POSIX   SC 1 FU
+MEMORY_PROTECTION              POSIX   SC 1 FU
+MESSAGE_PASSING                        POSIX   SC 1 FU
+MQ_OPEN_MAX                    POSIX   SC 1 LMU        8
+MQ_PRIO_MAX                    POSIX   SC 1 LMU        32
+NACLS_MAX                      SVID    SC 1 0
+NAME_MAX                       POSIX   PC 1 LMU        14      cc{
+       int main()
+       {
        #ifdef MAXNAMLEN
-       #define _LOCAL_NAME_MAX MAXNAMLEN
+               printf("%d", MAXNAMLEN);
        #else
-       #define _LOCAL_NAME_MAX local_name_max()
        #if !defined(remove) && (!_lib_remove || _lib_unlink)
        #define remove          unlink
        #endif
-       static int
-       local_name_max(void)
-       {
                int     i;
                int     n;
                int     v;
@@ -209,14 +206,14 @@
                                break;
                        }
                }
-               return(v);
+               printf("%d", v);
+               return 0;
        }
        #endif
-NGROUPS_MAX            47      POSIX   SC 1 LMU        8
+}
+NGROUPS_MAX                    POSIX   SC 1 LMU        8       cc{
        #if _lib_getgroups
-       #define _LOCAL_NGROUPS_MAX      local_ngroups_max()
-       static int
-       local_ngroups_max(void)
+       int main()
        {
                int     n;
                gid_t   g;
@@ -224,29 +221,33 @@
        #if defined(NGROUPS) && (NGROUPS-0) > 0
                        n = NGROUPS;
        #else
-                       n = 0;
+                       return 1;
        #endif
-               return(n);
+               printf("%d", n);
+               return 0;
        }
        #endif
-NL_ARGMAX              103     XOPEN   XX 1 L          9
-NL_LANGMAX             104     XOPEN   XX 1 L          14
-NL_MSGMAX              105     XOPEN   XX 1 L          32767
-NL_NMAX                        106     XOPEN   XX 1 L          1
-NL_SETMAX              107     XOPEN   XX 1 L          255
-NL_TEXTMAX             108     XOPEN   XX 1 L          LINE_MAX
-NO_TRUNC               48      POSIX   PC 1 FU
-NPROCESSORS_CONF       123     SVID    SC 1 0
-NPROCESSORS_ONLN       124     SVID    SC 1 0
-NZERO                  109     XOPEN   XX 1 L          20
-OPEN_MAX               49      POSIX   SC 1 LMU        16
+}
+NL_ARGMAX                      XOPEN   XX 1 L          9
+NL_LANGMAX                     XOPEN   XX 1 L          14
+NL_MSGMAX                      XOPEN   XX 1 L          32767
+NL_NMAX                                XOPEN   XX 1 L          1
+NL_SETMAX                      XOPEN   XX 1 L          255
+NL_TEXTMAX                     XOPEN   XX 1 L          LINE_MAX
+NO_TRUNC                       POSIX   PC 1 FU
+NPROCESSORS_CONF               SVID    SC 1 0
+NPROCESSORS_ONLN               SVID    SC 1 0
+NZERO                          XOPEN   XX 1 L          20
+OPEN_MAX                       POSIX   SC 1 LMUX       16      cc{
        #if _lib_getdtablesize
        extern int              getdtablesize(void);
-       #define _LOCAL_OPEN_MAX getdtablesize()
+       int main()
+       {
+               printf("%d", getdtablesize());
+               return 0;
+       }
        #else
-       #define _LOCAL_OPEN_MAX local_open_max()
-       static int
-       local_open_max(void)
+       int main()
        {
                int     i;
                int     n;
@@ -259,279 +260,311 @@
                        if (i > v) v = i;
                }
                while (n <= v) close(n++);
-               return(v + 1);
+               printf("%d", v);
+               return 0;
        }
        #endif
-OPEN_MAX_CEIL          50      AST     XX 1 L          OPEN_MAX
-OS_VERSION             119     AES     SC 1 FSU
-PAGESIZE               51      POSIX   SC 1 L          PAGE_SIZE 4096
+}
+OPEN_MAX_CEIL                  AST     XX 1 L          OPEN_MAX
+OS_VERSION                     AES     SC 1 FSU
+PAGESIZE                       POSIX   SC 1 MU         PAGESIZE PAGE_SIZE 4096 
cc{
+       int main()
+       {
        #if _WIN32
-       #define _LOCAL_PAGESIZE (64*1024L)
+               printf("%ld", 64*1024L);
+               return 0;
        #else
        #if _lib_getpagesize
        #if _npt_getpagesize
        extern size_t           getpagesize(void);
        #endif
-       #define _LOCAL_PAGESIZE getpagesize()
+               printf("%d", getpagesize());
+               return 0;
        #endif
+       #else
+               return 1;
        #endif
-PAGE_SIZE              101     XOPEN   SC 1 L          PAGESIZE
-PASS_MAX               130     SVID    SC 1 LMU        8
-PATH                   52      POSIX   CS 1 MU         "/bin:/usr/bin"
-PATH_MAX               53      POSIX   PC 1 LMUX       MAXPATHLEN 1024 256
-PHYS_PAGES             125     SUN     SC 1 0
-PID_MAX                        54      SVID    SC 1 LMU
-       #define _LOCAL_PID_MAX_DEFAULT  30000
-       #define _LOCAL_PID_MAX          local_pid_max()
-       static int
-       local_pid_max(void)
+       }
+}
+PAGE_SIZE                      POSIX   SC 1 MU         _AST_PAGESIZE
+PASS_MAX                       SVID    SC 1 LMU        8
+PATH                           POSIX   CS 1 MU         "/bin:/usr/bin"
+PATH_MAX                       POSIX   PC 1 LMUX       MAXPATHLEN 1024
+PHYS_PAGES                     SUN     SC 1 0
+PID_MAX                                SVID    SC 1 LMU        30000   cc{
+       int main()
        {
                int     fd;
                int     n;
                char    buf[1024];
                if ((fd = open("/proc/sys/kernel/pid_max", 0)) < 0)
-                       return _LOCAL_PID_MAX_DEFAULT;
+                       return 1;
                if ((n = read(fd, buf, sizeof(buf)-1)) < 2)
-                       return _LOCAL_PID_MAX_DEFAULT;
+                       return 1;
                buf[n] = 0;
                n = (int)strtol(buf, (char**)0, 0);
-               close(fd);
-               if (n <= 0)
-                       return _LOCAL_PID_MAX_DEFAULT;
-               return n;
-       }
-PIPE_BUF               55      POSIX   PC 1 LMU        512
-PRIORITIZED_IO         57      POSIX   SC 1 FU
-PRIORITY_SCHEDULING    58      POSIX   SC 1 FU
-PRIO_IO                        59      POSIX   PC 1 FU
-REALTIME_SIGNALS       60      POSIX   SC 1 FU
-REGEXP                 95      POSIX   SC 1 FU
-RESOURCE_LIMITS                96      POSIX   SC 1 FU
-RE_DUP_MAX             61      POSIX   SC 2 LMN        255
-RTSIG_MAX              62      POSIX   SC 1 LMU        8
-SAVED_IDS              63      POSIX   SC 1 FU
+               printf("%ld", n);
+               return 0;
+       }
+}
+PIPE_BUF                       POSIX   PC 1 LMU        512
+PRIORITIZED_IO                 POSIX   SC 1 FU
+PRIORITY_SCHEDULING            POSIX   SC 1 FU
+PRIO_IO                                POSIX   PC 1 FU
+REALTIME_SIGNALS               POSIX   SC 1 FU
+REGEXP                         POSIX   SC 1 FU
+RESOURCE_LIMITS                        POSIX   SC 1 FU
+RE_DUP_MAX                     POSIX   SC 2 LMN        255
+RTSIG_MAX                      POSIX   SC 1 LMU        8
+SAVED_IDS                      POSIX   SC 1 FU         cc{
        #if _lib_setuid && !_lib_setreuid
-       #define _LOCAL_SAVED_IDS        1
-       #endif
-SCHAR_MAX              64      C       XX 1 L          127
-SCHAR_MIN              65      C       XX 1 L          -127
-SEMAPHORES             66      POSIX   SC 1 FU
-SEM_NSEMS_MAX          67      POSIX   SC 1 LMU        256
-SEM_VALUE_MAX          68      POSIX   SC 1 LMU        32767
-SHARED_MEMORY_OBJECTS  69      POSIX   SC 1 FU
-SHELL                  120     AST     CS 1 MU         "/bin/sh"
-SHM                    118     XOPEN   SC 1 FSU
-SHRT_MAX               70      C       XX 1 L          32767
-SHRT_MIN               71      C       XX 1 L          -32767
-SIGQUEUE_MAX           72      POSIX   SC 1 LMU        32
-SIGRT_MAX              126     SVID    SC 1 0
-SIGRT_MIN              127     SVID    SC 1 0
-SSIZE_MAX              73      POSIX   XX 1 LMU        INT_MAX 32767
-STD_BLK                        74      SVID    SC 1 LMU        1024
-STREAM_MAX             75      POSIX   SC 1 LMU        OPEN_MAX 8
-SW_DEV                 76      POSIX   SC 2 FU
-SYMLINK_MAX            93      POSIX   PC 1 LMU        255
-       #if defined(PATH_MAX) && (PATH_MAX-0) > 0
-       #define _LOCAL_SYMLINK_MAX      (PATH_MAX-1)
-       #endif
-SYMLOOP_MAX            94      POSIX   SC 1 LMU        8
-SYNCHRONIZED_IO                77      POSIX   SC 1 FU
-SYNC_IO                        78      POSIX   PC 1 FU
-SYSPID_MAX             79      SVID    SC 1 LMU        2
-TIMERS                 80      POSIX   SC 1 FU
-TIMER_MAX              81      POSIX   SC 1 LMU        32
-TMP                    131     AST     CS 1 MU         "/tmp"
-TMP_MAX                        128     C       SC 1 LMU        33520641
-TZNAME_MAX             83      POSIX   SC 1 LMU        6
-UCHAR_MAX              84      C       XX 1 L          255
-UID_MAX                        85      SVID    SC 1 LMU        60002
-UINT_MAX               86      C       XX 1 L          65535
-ULONG_MAX              87      C       XX 1 L          4294967295
-UNIX                   115     XOPEN   SC 1 FSU
-UPE                    89      POSIX   SC 2 FU
-USHRT_MAX              88      C       XX 1 L          65535
-VDISABLE               90      POSIX   PC 1 FU
-VERSION                        91      POSIX   SC 1 FU         200112
-VERSION                        92      POSIX   SC 2 FU         200112
-VERSION                        110     XOPEN   SC 1 FSU        600
-WORD_BIT               56      XOPEN   XX 1 L          16
-       #ifdef  CHAR_BIT
-       #define _LOCAL_WORD_BIT         (CHAR_BIT*sizeof(int))
-       #else
-       #define _LOCAL_WORD_BIT         (8*sizeof(int))
+       int main()
+       {
+               printf("1");
+               return 0;
+       }
        #endif
-XCU_VERSION            111     XOPEN   SC 1 FSU
-XPG2                   112     XOPEN   XX 1 FU
-XPG3                   113     XOPEN   XX 1 FU
-XPG4                   114     XOPEN   XX 1 FU
+}
+SCHAR_MAX                      C       XX 1 L          127
+SCHAR_MIN                      C       XX 1 L          -127
+SEMAPHORES                     POSIX   SC 1 FU
+SEM_NSEMS_MAX                  POSIX   SC 1 LMU        256
+SEM_VALUE_MAX                  POSIX   SC 1 LMU        32767
+SH                             AST     CS 1 MU         sh{
+       ifs=$IFS
+       IFS=:
+       set '' `$CONF_getconf PATH 2>/dev/null` /bin /usr/bin /sbin /usr/sbin
+       shift
+       path=$*
+       IFS=$ifs
+       for s in ksh ksh93 sh
+       do      for d in $path
+               do      if      test -x $d/$s
+                       then    case $s in
+                               ksh)    case `$d/$s '--?-author' 2>&1` in
+                                       *'David Korn'*) ;;
+                                       *)              continue ;;
+                                       esac
+                                       ;;
+                               esac
+                               echo "\"$d/$s\""
+                               exit
+                       fi
+               done
+       done
+       echo '"/bin/sh"'
+}
+SHARED_MEMORY_OBJECTS          POSIX   SC 1 FU
+SHM                            XOPEN   SC 1 FSU
+SHRT_MAX                       C       XX 1 L          32767
+SHRT_MIN                       C       XX 1 L          -32767
+SIGQUEUE_MAX                   POSIX   SC 1 LMU        32
+SIGRT_MAX                      SVID    SC 1 0
+SIGRT_MIN                      SVID    SC 1 0
+SIZE_MAX                       C       XX 1 LMX        UINT_MAX 65535
+SSIZE_MAX                      POSIX   XX 1 LMUX       INT_MAX 32767
+STD_BLK                                SVID    SC 1 LMU        1024
+STREAM_MAX                     POSIX   SC 1 LMU        OPEN_MAX 8
+SW_DEV                         POSIX   SC 2 FU
+SYMLINK_MAX                    POSIX   PC 1 LMU        255     cc{
+       int main()
+       {
+               printf("%d", PATH_MAX-1);
+               return 0;
+       }
+}
+SYMLOOP_MAX                    POSIX   SC 1 LMU        8
+SYNCHRONIZED_IO                        POSIX   SC 1 FU
+SYNC_IO                                POSIX   PC 1 FU
+SYSPID_MAX                     SVID    SC 1 LMU        2
+TIMERS                         POSIX   SC 1 FU
+TIMER_MAX                      POSIX   SC 1 LMU        32
+TMP                            AST     CS 1 MU         "/tmp"
+TMP_MAX                                C       SC 1 LMU        33520641
+TZNAME_MAX                     POSIX   SC 1 LMU        6
+UCHAR_MAX                      C       XX 1 L          255
+UID_MAX                                SVID    SC 1 LMU        60002
+UINT_MAX                       C       XX 1 L          65535
+ULONG_MAX                      C       XX 1 L          4294967295
+UNIX                           XOPEN   SC 1 FSU
+UPE                            POSIX   SC 2 FU
+USHRT_MAX                      C       XX 1 L          65535
+VDISABLE                       POSIX   PC 1 FU
+VERSION                                POSIX   SC 1 FU         200112
+VERSION                                POSIX   SC 2 FU         200112
+VERSION                                XOPEN   SC 1 FSU        600
+WORD_BIT                       XOPEN   XX 1 L          (8*sizeof(int))
+XCU_VERSION                    XOPEN   SC 1 FSU
+XPG2                           XOPEN   XX 1 FU
+XPG3                           XOPEN   XX 1 FU
+XPG4                           XOPEN   XX 1 FU
 
 # confgen additions
 
-ABI_AIO_XFER_MAX               164     C       QQ 1 L
-ABI_ASYNCHRONOUS_IO            165     C       QQ 1 L
-ABI_ASYNC_IO                   166     C       QQ 1 L
-ADVISORY_INFO                  291     POSIX   SC 1 FU
-ALLOC_SIZE_MIN                 292     POSIX   PC 1 L
-AUDIT                          167     C       QQ 1 L
-AVAIL_PROCESSORS               168     C       QQ 1 L
-BARRIERS                       293     POSIX   SC 1 FU
-CLOCKS_PER_SEC                 169     C       QQ 1 L
-CPUTIME                                294     POSIX   SC 1 FU
-CPU_KEYBITS1                   170     C       QQ 1 L
-CPU_VERSION                    171     C       QQ 1 L
-DATAKEYS_MAX                   172     C       QQ 1 0
-EQUIV_CLASS_MAX                        173     C       QQ 1 L
-EXEC_INTERPRETER_LENGTH                174     C       QQ 1 L
-FILE_LOCKING                   295     POSIX   SC 1 FU
-GETGR_R_SIZE_MAX               175     C       QQ 1 L
-GETPW_R_SIZE_MAX               275     C       QQ 1 L
-HOSTID                         176     C       QQ 1 L
-HOST_NAME_MAX                  296     POSIX   SC 1 LMU        255
-HW_SERIAL                      177     C       QQ 1 L
-ILP32_OFF32                    178     XBS5    SC 1 FU
-ILP32_OFF32_CFLAGS             179     XBS5    CS 1 FU
-ILP32_OFF32_LDFLAGS            180     XBS5    CS 1 FU
-ILP32_OFF32_LIBS               181     XBS5    CS 1 FU
-ILP32_OFF32_LINTFLAGS          182     XBS5    CS 1 FU
-ILP32_OFFBIG                   183     XBS5    SC 1 FU
-ILP32_OFFBIG_CFLAGS            184     XBS5    CS 1 FU
-ILP32_OFFBIG_LDFLAGS           185     XBS5    CS 1 FU
-ILP32_OFFBIG_LIBS              186     XBS5    CS 1 FU
-ILP32_OFFBIG_LINTFLAGS         187     XBS5    CS 1 FU
-IO_TYPE                                188     C       QQ 1 L
-IPV6                           297     POSIX   SC 1 FU
-IP_SECOPTS                     189     C       QQ 1 L
-KERN_POINTERS                  190     C       QQ 1 L
-KERN_SIM                       191     C       QQ 1 L
-LEGACY                         192     XOPEN   SC 1 FU
-LOGIN_NAME_MAX                 193     POSIX   SC 1 LMU
-LONGLONG_MAX                   194     C       XX 1 L
-LONGLONG_MIN                   195     C       XX 1 L
-LP64_OFF64                     196     XBS5    SC 1 FU
-LP64_OFF64_CFLAGS              197     XBS5    CS 1 FU
-LP64_OFF64_LDFLAGS             198     XBS5    CS 1 FU
-LP64_OFF64_LIBS                        199     XBS5    CS 1 FU
-LP64_OFF64_LINTFLAGS           200     XBS5    CS 1 FU
-LPBIG_OFFBIG                   201     XBS5    SC 1 FU
-LPBIG_OFFBIG_CFLAGS            202     XBS5    CS 1 FU
-LPBIG_OFFBIG_LDFLAGS           203     XBS5    CS 1 FU
-LPBIG_OFFBIG_LIBS              204     XBS5    CS 1 FU
-LPBIG_OFFBIG_LINTFLAGS         205     XBS5    CS 1 FU
-MCAS_OFFSET                    206     C       QQ 1 L
-MMAP_FIXED_ALIGNMENT           207     C       QQ 1 L          PAGESIZE
-MONOTONIC_CLOCK                        298     POSIX   SC 1 FU
-MSEM_LOCKID                    208     C       QQ 1 L
-MULTI_PROCESS                  299     POSIX   SC 1 FU
-NL_MAX                         209     C       QQ 1 L
-NL_SPECMAX                     210     C       QQ 1 L
-NPROC_CONF                     211     C       QQ 1 L
-NPROC_ONLN                     212     C       QQ 1 L
-NSS_BUFLEN_GROUP               213     C       QQ 1 L
-NSS_BUFLEN_PASSWD              214     C       QQ 1 L
-NUM_PROCESSORS                 215     C       QQ 1 L
-OSREL_MAJ                      216     C       QQ 1 L
-OSREL_MIN                      217     C       QQ 1 L
-OSREL_PATCH                    218     C       QQ 1 L
-PBS                            300     POSIX   SC 2 FU
-PBS_ACCOUNTING                 301     POSIX   SC 2 FU
-PBS_CHECKPOINT                 302     POSIX   SC 2 FU
-PBS_LOCATE                     303     POSIX   SC 2 FU
-PBS_MESSAGE                    304     POSIX   SC 2 FU
-PBS_TRACK                      305     POSIX   SC 2 FU
-PII                            219     POSIX   SC 1 FU
-PII_INTERNET                   220     POSIX   SC 1 FU
-PII_INTERNET_DGRAM             221     POSIX   SC 1 FU
-PII_INTERNET_STREAM            222     POSIX   SC 1 FU
-PII_OSI                                223     POSIX   SC 1 FU
-PII_OSI_CLTS                   224     POSIX   SC 1 FU
-PII_OSI_COTS                   225     POSIX   SC 1 FU
-PII_OSI_M                      226     POSIX   SC 1 FU
-PII_SOCKET                     227     POSIX   SC 1 FU
-PII_XTI                                228     POSIX   SC 1 FU
-POLL                           229     POSIX   SC 1 FU
-PROC_RSRC_MGR                  230     C       QQ 1 L
-PTHREAD_DESTRUCTOR_ITERATIONS  231     C       QQ 1 L
-PTHREAD_KEYS_MAX               232     C       QQ 1 L
-PTHREAD_STACK_MIN              233     C       QQ 1 L
-PTHREAD_THREADS_MAX            234     C       QQ 1 L
-RAW_SOCKETS                    306     POSIX   SC 1 FU
-READER_WRITER_LOCKS            307     POSIX   SC 1 FU
-REALTIME                       235     XOPEN   SC 1 FU
-REALTIME_THREADS               236     XOPEN   SC 1 FU
-REC_INCR_XFER_SIZE             308     POSIX   PC 1 L
-REC_MIN_XFER_SIZE              309     POSIX   PC 1 L
-REC_MAX_XFER_SIZE              310     POSIX   PC 1 L
-REC_XFER_ALIGN                 311     POSIX   PC 1 L
-REENTRANT_FUNCTIONS            237     POSIX   SC 1 FU
-REGEX_VERSION                  312     POSIX   SC 1 F          20030916
-RELEASE                                238     C       QQ 1 L
-SECURITY_CLASS                 239     C       QQ 1 L
-SELECT                         240     POSIX   SC 1 FU
-SIZE_MAX                       241     C       XX 1 L
-SLVM_MAXNODES                  242     C       QQ 1 L
-SOCK_MAXBUF                    243     C       QQ 1 0
-SOFTPOWER                      244     C       QQ 1 L
-SPAWN                          313     POSIX   SC 1 FU
-SPIN_LOCKS                     314     POSIX   SC 1 FU
-SPORADIC_SERVER                        315     POSIX   SC 1 FU
-SRPC_DOMAIN                    245     C       QQ 1 0
-THREADS                                246     POSIX   SC 1 FU
-THREADS_PRIO_CEILING           247     POSIX   SC 1 FU
-THREADS_PRIO_INHERIT           248     POSIX   SC 1 FU
-THREAD_ATTR_STACKADDR          249     POSIX   SC 1 FU
-THREAD_ATTR_STACKSIZE          250     POSIX   SC 1 FU
-THREAD_CPUTIME                 316     POSIX   SC 1 FU
-THREAD_DESTRUCTOR_ITERATIONS   251     POSIX   SC 1 LMU        
PTHREAD_DESTRUCTOR_ITERATIONS 4
-THREAD_KEYS_MAX                        252     POSIX   SC 1 LMU        
PTHREAD_KEYS_MAX 128
-THREAD_PRIORITY_SCHEDULING     253     POSIX   SC 1 FU
-THREAD_PRIO_INHERIT            254     POSIX   SC 1 FU
-THREAD_PRIO_PROTECT            255     POSIX   SC 1 FU
-THREAD_PROCESS_SHARED          256     POSIX   SC 1 FU
-THREAD_SAFE_FUNCTIONS          257     POSIX   SC 1 FU
-THREAD_SPORADIC_SERVER         317     POSIX   SC 1 FU
-THREAD_STACK_MIN               258     POSIX   SC 1 LU         
PTHREAD_STACK_MIN
-THREAD_THREADS_MAX             259     POSIX   SC 1 LMU        
PTHREAD_THREADS_MAX 64
-TIMEOUTS                       318     POSIX   SC 1 FU
-TRACE                          319     POSIX   SC 1 FU
-TRACE_EVENT_FILTER             320     POSIX   SC 1 FU
-TRACE_INHERIT                  321     POSIX   SC 1 FU
-TRACE_LOG                      322     POSIX   SC 1 FU
-TTY_NAME_MAX                   260     POSIX   SC 1 LMU        9
-TYPED_MEMORY_OBJECTS           323     POSIX   SC 1 FU
-T_IOV_MAX                      261     C       QQ 1 0
-UCHAR_MIN                      262     C       XX 1 L
-UIO_MAXIOV                     263     C       QQ 1 0
-ULONGLONG_MAX                  264     C       XX 1 L
-V6_ILP32_OFF32                 324     POSIX   SC 1 FU
-V6_ILP32_OFFBIG                        325     POSIX   SC 1 FU
-V6_LP64_OFF64                  326     POSIX   SC 1 FU
-V6_LPBIG_OFFBIG                        327     POSIX   SC 1 FU
-VERSION                                266     XPG     SC 3 FU
-VERSION                                267     XPG     SC 4 FU
-VERSION_88                     268     POSIX   SC 1 FU
-VERSION_88                     269     C       XX 1 L
-VERSION_90                     270     POSIX   SC 1 FU
-VERSION_90                     271     C       XX 1 L
-VERSION_93                     272     POSIX   SC 1 FU
-VERSION_93                     273     C       XX 1 L
-VERSION                                274     AST     XX 1 MU         
_AST_VERSION
+ABI_AIO_XFER_MAX               C       QQ 1 L
+ABI_ASYNCHRONOUS_IO            C       QQ 1 L
+ABI_ASYNC_IO                   C       QQ 1 L
+ADVISORY_INFO                  POSIX   SC 1 FU
+ALLOC_SIZE_MIN                 POSIX   PC 1 L
+AUDIT                          C       QQ 1 L
+AVAIL_PROCESSORS               C       QQ 1 L
+BARRIERS                       POSIX   SC 1 FU
+CLOCKS_PER_SEC                 C       QQ 1 L
+CPUTIME                                POSIX   SC 1 FU
+CPU_KEYBITS1                   C       QQ 1 L
+CPU_VERSION                    C       QQ 1 L
+DATAKEYS_MAX                   C       QQ 1 0
+EQUIV_CLASS_MAX                        C       QQ 1 L
+EXEC_INTERPRETER_LENGTH                C       QQ 1 L
+FILE_LOCKING                   POSIX   SC 1 FU
+GETGR_R_SIZE_MAX               C       QQ 1 L
+GETPW_R_SIZE_MAX               C       QQ 1 L
+HOSTID                         C       QQ 1 L
+HOST_NAME_MAX                  POSIX   SC 1 LMU        255
+HW_SERIAL                      C       QQ 1 L
+ILP32_OFF32                    XBS5    SC 1 FU
+ILP32_OFF32_CFLAGS             XBS5    CS 1 FU
+ILP32_OFF32_LDFLAGS            XBS5    CS 1 FU
+ILP32_OFF32_LIBS               XBS5    CS 1 FU
+ILP32_OFF32_LINTFLAGS          XBS5    CS 1 FU
+ILP32_OFFBIG                   XBS5    SC 1 FU
+ILP32_OFFBIG_CFLAGS            XBS5    CS 1 FU
+ILP32_OFFBIG_LDFLAGS           XBS5    CS 1 FU
+ILP32_OFFBIG_LIBS              XBS5    CS 1 FU
+ILP32_OFFBIG_LINTFLAGS         XBS5    CS 1 FU
+IO_TYPE                                C       QQ 1 L
+IPV6                           POSIX   SC 1 FU
+IP_SECOPTS                     C       QQ 1 L
+KERN_POINTERS                  C       QQ 1 L
+KERN_SIM                       C       QQ 1 L
+LEGACY                         XOPEN   SC 1 FU
+LOGIN_NAME_MAX                 POSIX   SC 1 LMU
+LONGLONG_MAX                   C       XX 1 L
+LONGLONG_MIN                   C       XX 1 L
+LP64_OFF64                     XBS5    SC 1 FU
+LP64_OFF64_CFLAGS              XBS5    CS 1 FU
+LP64_OFF64_LDFLAGS             XBS5    CS 1 FU
+LP64_OFF64_LIBS                        XBS5    CS 1 FU
+LP64_OFF64_LINTFLAGS           XBS5    CS 1 FU
+LPBIG_OFFBIG                   XBS5    SC 1 FU
+LPBIG_OFFBIG_CFLAGS            XBS5    CS 1 FU
+LPBIG_OFFBIG_LDFLAGS           XBS5    CS 1 FU
+LPBIG_OFFBIG_LIBS              XBS5    CS 1 FU
+LPBIG_OFFBIG_LINTFLAGS         XBS5    CS 1 FU
+MCAS_OFFSET                    C       QQ 1 L
+MMAP_FIXED_ALIGNMENT           C       QQ 1 L          _AST_PAGESIZE
+MONOTONIC_CLOCK                        POSIX   SC 1 FU
+MSEM_LOCKID                    C       QQ 1 L
+MULTI_PROCESS                  POSIX   SC 1 FU
+NL_MAX                         C       QQ 1 L
+NL_SPECMAX                     C       QQ 1 L
+NPROC_CONF                     C       QQ 1 L
+NPROC_ONLN                     C       QQ 1 L
+NSS_BUFLEN_GROUP               C       QQ 1 L
+NSS_BUFLEN_PASSWD              C       QQ 1 L
+NUM_PROCESSORS                 C       QQ 1 L
+OSREL_MAJ                      C       QQ 1 L
+OSREL_MIN                      C       QQ 1 L
+OSREL_PATCH                    C       QQ 1 L
+PBS                            POSIX   SC 2 FU
+PBS_ACCOUNTING                 POSIX   SC 2 FU
+PBS_CHECKPOINT                 POSIX   SC 2 FU
+PBS_LOCATE                     POSIX   SC 2 FU
+PBS_MESSAGE                    POSIX   SC 2 FU
+PBS_TRACK                      POSIX   SC 2 FU
+PII                            POSIX   SC 1 FU
+PII_INTERNET                   POSIX   SC 1 FU
+PII_INTERNET_DGRAM             POSIX   SC 1 FU
+PII_INTERNET_STREAM            POSIX   SC 1 FU
+PII_OSI                                POSIX   SC 1 FU
+PII_OSI_CLTS                   POSIX   SC 1 FU
+PII_OSI_COTS                   POSIX   SC 1 FU
+PII_OSI_M                      POSIX   SC 1 FU
+PII_SOCKET                     POSIX   SC 1 FU
+PII_XTI                                POSIX   SC 1 FU
+POLL                           POSIX   SC 1 FU
+PROC_RSRC_MGR                  C       QQ 1 L
+PTHREAD_DESTRUCTOR_ITERATIONS  C       QQ 1 L
+PTHREAD_KEYS_MAX               C       QQ 1 L
+PTHREAD_STACK_MIN              C       QQ 1 L
+PTHREAD_THREADS_MAX            C       QQ 1 L
+RAW_SOCKETS                    POSIX   SC 1 FU
+READER_WRITER_LOCKS            POSIX   SC 1 FU
+REALTIME                       XOPEN   SC 1 FU
+REALTIME_THREADS               XOPEN   SC 1 FU
+REC_INCR_XFER_SIZE             POSIX   PC 1 L
+REC_MIN_XFER_SIZE              POSIX   PC 1 L
+REC_MAX_XFER_SIZE              POSIX   PC 1 L
+REC_XFER_ALIGN                 POSIX   PC 1 L
+REENTRANT_FUNCTIONS            POSIX   SC 1 FU
+REGEX_VERSION                  POSIX   SC 1 F          20030916
+RELEASE                                C       QQ 1 L
+SECURITY_CLASS                 C       QQ 1 L
+SELECT                         POSIX   SC 1 FU
+SLVM_MAXNODES                  C       QQ 1 L
+SOCK_MAXBUF                    C       QQ 1 0
+SOFTPOWER                      C       QQ 1 L
+SPAWN                          POSIX   SC 1 FU
+SPIN_LOCKS                     POSIX   SC 1 FU
+SPORADIC_SERVER                        POSIX   SC 1 FU
+SRPC_DOMAIN                    C       QQ 1 0
+THREADS                                POSIX   SC 1 FU
+THREADS_PRIO_CEILING           POSIX   SC 1 FU
+THREADS_PRIO_INHERIT           POSIX   SC 1 FU
+THREAD_ATTR_STACKADDR          POSIX   SC 1 FU
+THREAD_ATTR_STACKSIZE          POSIX   SC 1 FU
+THREAD_CPUTIME                 POSIX   SC 1 FU
+THREAD_DESTRUCTOR_ITERATIONS   POSIX   SC 1 LMU        
PTHREAD_DESTRUCTOR_ITERATIONS 4
+THREAD_KEYS_MAX                        POSIX   SC 1 LMU        
PTHREAD_KEYS_MAX 128
+THREAD_PRIORITY_SCHEDULING     POSIX   SC 1 FU
+THREAD_PRIO_INHERIT            POSIX   SC 1 FU
+THREAD_PRIO_PROTECT            POSIX   SC 1 FU
+THREAD_PROCESS_SHARED          POSIX   SC 1 FU
+THREAD_SAFE_FUNCTIONS          POSIX   SC 1 FU
+THREAD_SPORADIC_SERVER         POSIX   SC 1 FU
+THREAD_STACK_MIN               POSIX   SC 1 LU         PTHREAD_STACK_MIN
+THREAD_THREADS_MAX             POSIX   SC 1 LMU        PTHREAD_THREADS_MAX 64
+TIMEOUTS                       POSIX   SC 1 FU
+TRACE                          POSIX   SC 1 FU
+TRACE_EVENT_FILTER             POSIX   SC 1 FU
+TRACE_INHERIT                  POSIX   SC 1 FU
+TRACE_LOG                      POSIX   SC 1 FU
+TTY_NAME_MAX                   POSIX   SC 1 LMU        9
+TYPED_MEMORY_OBJECTS           POSIX   SC 1 FU
+T_IOV_MAX                      C       QQ 1 0
+UCHAR_MIN                      C       XX 1 L
+UIO_MAXIOV                     C       QQ 1 0
+ULONGLONG_MAX                  C       XX 1 L
+V6_ILP32_OFF32                 POSIX   SC 1 FU
+V6_ILP32_OFFBIG                        POSIX   SC 1 FU
+V6_LP64_OFF64                  POSIX   SC 1 FU
+V6_LPBIG_OFFBIG                        POSIX   SC 1 FU
+VERSION                                XPG     SC 3 FU
+VERSION                                XPG     SC 4 FU
+VERSION_88                     POSIX   SC 1 FU
+VERSION_88                     C       XX 1 L
+VERSION_90                     POSIX   SC 1 FU
+VERSION_90                     C       XX 1 L
+VERSION_93                     POSIX   SC 1 FU
+VERSION_93                     C       XX 1 L
+VERSION                                AST     XX 1 MU         _AST_VERSION
 
 # sys/systeminfo sysinfo additions
 
-ARCHITECTURE                   276     SVID    SI 1 0
-BUSTYPES                       277     SVID    SI 1 0
-HOSTNAME                       278     SVID    SI 1 0
-HW_PROVIDER                    279     SVID    SI 1 0
-HW_SERIAL                      280     SVID    SI 1 0
-INITTAB_NAME                   281     SVID    SI 1 0
-KERNEL_STAMP                   282     SVID    SI 1 0
-MACHINE                                283     SVID    SI 1 0
-OS_BASE                                284     SVID    SI 1 0
-OS_PROVIDER                    285     SVID    SI 1 0
-RELEASE                                286     SVID    SI 1 0
-SRPC_DOMAIN                    287     SVID    SI 1 0
-SYSNAME                                288     SVID    SI 1 0
-USER_LIMIT                     289     SVID    SI 1 0
-VERSION                                290     SVID    SI 1 0
+ARCHITECTURE                   SVID    SI 1 0
+BUSTYPES                       SVID    SI 1 0
+HOSTNAME                       SVID    SI 1 0
+HW_PROVIDER                    SVID    SI 1 0
+INITTAB_NAME                   SVID    SI 1 0
+KERNEL_STAMP                   SVID    SI 1 0
+MACHINE                                SVID    SI 1 0
+OS_BASE                                SVID    SI 1 0
+OS_PROVIDER                    SVID    SI 1 0
+SYSNAME                                SVID    SI 1 0
+USER_LIMIT                     SVID    SI 1 0
+VERSION                                SVID    SI 1 0
+
+# vendor prefixes
 
-# 328 is the next index #
+VERSION                                GNU             XX 1 0
+VERSION                                TRUSTEDBSD      XX 1 0
diff -r -N -u ksh93_2006_09_12/src/lib/libast/comp/dirname.c 
ksh93_2006_10_31/src/lib/libast/comp/dirname.c
--- ksh93_2006_09_12/src/lib/libast/comp/dirname.c      2001-06-21 
16:09:45.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/comp/dirname.c      2006-10-27 
22:53:03.000000000 +0200
@@ -24,10 +24,13 @@
  * dirname(3) implementation
  */
 
-#include <ast_map.h>
-#include <libgen.h>
+#include <ast_common.h>
 
-char *dirname(register char *pathname)
+#if defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
+extern char *dirname(register char *pathname)
 {
        register char  *last;
        /* go to end of path */
diff -r -N -u ksh93_2006_09_12/src/lib/libast/comp/execvpe.c 
ksh93_2006_10_31/src/lib/libast/comp/execvpe.c
--- ksh93_2006_09_12/src/lib/libast/comp/execvpe.c      2002-05-24 
20:05:26.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/comp/execvpe.c      2006-10-09 
22:44:32.000000000 +0200
@@ -48,7 +48,7 @@
        register const char*    path = name;
        char                    buffer[PATH_MAX];
 
-       if (*path != '/' && !(path = pathpath(buffer, name, NULL, 
X_OK|PATH_REGULAR)))
+       if (*path != '/' && !(path = pathpath(buffer, name, NULL, 
PATH_REGULAR|PATH_EXECUTE)))
                path = name;
        execve(path, argv, envv);
        if (errno == ENOEXEC)
diff -r -N -u ksh93_2006_09_12/src/lib/libast/comp/fmtmsglib.c 
ksh93_2006_10_31/src/lib/libast/comp/fmtmsglib.c
--- ksh93_2006_09_12/src/lib/libast/comp/fmtmsglib.c    2004-10-27 
21:43:20.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/comp/fmtmsglib.c    2006-10-12 
20:23:46.000000000 +0200
@@ -258,7 +258,12 @@
                                n = MM_LABEL_1_MAX;
                        sfprintf(sp, "%*.*s", n, n, s);
                }
-               strcpy(lab, sfstruse(sp));
+               if (!(s = sfstruse(sp)))
+               {
+                       sfstrclose(sp);
+                       return MM_NOTOK;
+               }
+               strcpy(lab, s);
        }
        for (;;)
        {
@@ -320,8 +325,7 @@
                        sfputc(sp, '\n');
                }
                n = sfstrtell(sp);
-               s = sfstruse(sp);
-               if (write(fd, s, n) != n)
+               if (!(s = sfstruse(sp)) || write(fd, s, n) != n)
                        r |= c;
        }
        sfstrclose(sp);
diff -r -N -u ksh93_2006_09_12/src/lib/libast/comp/fnmatch.h 
ksh93_2006_10_31/src/lib/libast/comp/fnmatch.h
--- ksh93_2006_09_12/src/lib/libast/comp/fnmatch.h      2006-07-27 
03:53:21.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/comp/fnmatch.h      2006-09-23 
06:08:28.000000000 +0200
@@ -49,6 +49,12 @@
 
 #define FNM_NOMATCH    1               /* == REG_NOMATCH               */
 
+#if _BLD_ast && defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
 extern int     fnmatch(const char*, const char*, int);
 
+#undef extern
+
 #endif
diff -r -N -u ksh93_2006_09_12/src/lib/libast/comp/getdate.c 
ksh93_2006_10_31/src/lib/libast/comp/getdate.c
--- ksh93_2006_09_12/src/lib/libast/comp/getdate.c      2004-12-08 
07:39:32.000000000 +0100
+++ ksh93_2006_10_31/src/lib/libast/comp/getdate.c      2006-09-22 
17:29:32.000000000 +0200
@@ -24,25 +24,14 @@
  * getdate implementation
  */
 
-#define _def_map_ast   1
-
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-__STDPP__directive pragma pp:hide getdate
-#else
 #define getdate        ______getdate
-#endif
 
 #include <ast.h>
 #include <tm.h>
 
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-__STDPP__directive pragma pp:nohide getdate
-#else
 #undef getdate
-#endif
 
 #undef _def_map_ast
-
 #include <ast_map.h>
 
 #undef _lib_getdate    /* we can pass X/Open */
@@ -57,6 +46,10 @@
 __DEFINE__(int, getdate_err, 0);
 #endif
 
+#if defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
 extern struct tm*
 getdate(const char* s)
 {
diff -r -N -u ksh93_2006_09_12/src/lib/libast/comp/getopt.c 
ksh93_2006_10_31/src/lib/libast/comp/getopt.c
--- ksh93_2006_09_12/src/lib/libast/comp/getopt.c       2003-01-31 
22:33:53.000000000 +0100
+++ ksh93_2006_10_31/src/lib/libast/comp/getopt.c       2006-09-28 
23:14:15.000000000 +0200
@@ -23,6 +23,8 @@
 
 #include <ast.h>
 
+#undef _lib_getopt     /* we can satisfy the api */
+
 #if _lib_getopt
 
 NoN(getopt)
diff -r -N -u ksh93_2006_09_12/src/lib/libast/comp/getoptl.c 
ksh93_2006_10_31/src/lib/libast/comp/getoptl.c
--- ksh93_2006_09_12/src/lib/libast/comp/getoptl.c      2004-10-27 
21:43:24.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/comp/getoptl.c      2006-10-12 
20:21:33.000000000 +0200
@@ -95,7 +95,8 @@
                                }
                        }
                sfputc(up, '\n');
-               usage = sfstruse(up);
+               if (!(usage = sfstruse(up)))
+                       return -1;
                lastoptstring = optstring;
                lastlongopts = longopts;
        }
diff -r -N -u ksh93_2006_09_12/src/lib/libast/comp/getpgrp.c 
ksh93_2006_10_31/src/lib/libast/comp/getpgrp.c
--- ksh93_2006_09_12/src/lib/libast/comp/getpgrp.c      2001-09-21 
02:23:10.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/comp/getpgrp.c      2006-09-22 
06:37:24.000000000 +0200
@@ -30,6 +30,8 @@
  * user                SOL
  */
 
+#undef getpgrp
+
 extern int     getpgrp(int);
 
 #if defined(__EXPORT__)
diff -r -N -u ksh93_2006_09_12/src/lib/libast/comp/getsubopt.c 
ksh93_2006_10_31/src/lib/libast/comp/getsubopt.c
--- ksh93_2006_09_12/src/lib/libast/comp/getsubopt.c    2001-10-03 
22:16:57.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/comp/getsubopt.c    2006-09-28 
23:14:53.000000000 +0200
@@ -26,6 +26,8 @@
 
 #include <ast_lib.h>
 
+#undef _lib_getsubopt  /* we can satisfy the api */
+
 #if _lib_getsubopt
 
 #include <ast.h>
diff -r -N -u ksh93_2006_09_12/src/lib/libast/comp/mktemp.c 
ksh93_2006_10_31/src/lib/libast/comp/mktemp.c
--- ksh93_2006_09_12/src/lib/libast/comp/mktemp.c       2003-06-12 
04:37:13.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/comp/mktemp.c       2006-09-22 
17:27:06.000000000 +0200
@@ -24,29 +24,22 @@
  * mktemp,mkstemp implementation
  */
 
-#define _def_map_ast   1
-
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-__STDPP__directive pragma pp:hide mktemp mkstemp
-#else
 #define mktemp         ______mktemp
 #define mkstemp                ______mkstemp
-#endif
 
 #include <ast.h>
 #include <stdio.h>
 
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-__STDPP__directive pragma pp:nohide mktemp mkstemp
-#else
 #undef mktemp
 #undef mkstemp
-#endif
 
 #undef _def_map_ast
-
 #include <ast_map.h>
 
+#if defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
 static char*
 temp(char* buf, int* fdp)
 {
@@ -77,10 +70,6 @@
        return buf;
 }
 
-#if defined(__EXPORT__)
-#define extern __EXPORT__
-#endif
-
 extern char*
 mktemp(char* buf)
 {
diff -r -N -u ksh93_2006_09_12/src/lib/libast/comp/mktime.c 
ksh93_2006_10_31/src/lib/libast/comp/mktime.c
--- ksh93_2006_09_12/src/lib/libast/comp/mktime.c       2004-12-30 
11:32:25.000000000 +0100
+++ ksh93_2006_10_31/src/lib/libast/comp/mktime.c       2006-09-22 
17:23:45.000000000 +0200
@@ -24,25 +24,14 @@
  * mktime implementation
  */
 
-#define _def_map_ast   1
-
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-__STDPP__directive pragma pp:hide mktime
-#else
 #define mktime         ______mktime
-#endif
 
 #include <ast.h>
 #include <tm.h>
 
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-__STDPP__directive pragma pp:nohide mktime
-#else
 #undef mktime
-#endif
 
 #undef _def_map_ast
-
 #include <ast_map.h>
 
 #undef _lib_mktime     /* we can pass X/Open */
diff -r -N -u ksh93_2006_09_12/src/lib/libast/comp/omitted.c 
ksh93_2006_10_31/src/lib/libast/comp/omitted.c
--- ksh93_2006_09_12/src/lib/libast/comp/omitted.c      2005-04-22 
23:20:06.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/comp/omitted.c      2006-09-25 
19:33:23.000000000 +0200
@@ -1029,18 +1029,18 @@
 #undef getpagesize
 
 #ifdef _SC_PAGESIZE
-#undef PAGESIZE
-#define PAGESIZE       (int)sysconf(_SC_PAGESIZE)
+#undef _AST_PAGESIZE
+#define _AST_PAGESIZE  (int)sysconf(_SC_PAGESIZE)
 #else
-#ifndef PAGESIZE
-#define PAGESIZE       4096
+#ifndef _AST_PAGESIZE
+#define _AST_PAGESIZE  4096
 #endif
 #endif
 
 int
 getpagesize()
 {
-       return PAGESIZE;
+       return _AST_PAGESIZE;
 }
 
 #endif
diff -r -N -u ksh93_2006_09_12/src/lib/libast/comp/putenv.c 
ksh93_2006_10_31/src/lib/libast/comp/putenv.c
--- ksh93_2006_09_12/src/lib/libast/comp/putenv.c       2002-11-13 
16:58:27.000000000 +0100
+++ ksh93_2006_10_31/src/lib/libast/comp/putenv.c       2006-10-27 
22:10:26.000000000 +0200
@@ -21,8 +21,25 @@
 ***********************************************************************/
 #pragma prototyped
 
+#define putenv         ______putenv
+
+#if _UWIN
+#define _STDLIB_H_     1
+#endif
+
 #include <ast.h>
 
+#undef putenv
+
+#if _lib_putenv
+
+NoN(putenv)
+
+#else
+
+#undef _def_map_ast
+#include <ast_map.h>
+
 #if defined(__EXPORT__)
 #define extern __EXPORT__
 #endif
@@ -33,23 +50,4 @@
        return setenviron(s) ? 0 : -1;
 }
 
-extern int
-setenv(const char* name, const char* value, int overwrite)
-{
-       char*   s;
-
-       if (overwrite || !getenv(name))
-       {
-               if (!(s = sfprints("%s=%s", name, value)) || !(s = strdup(s)))
-                       return -1;
-               return setenviron(s) ? 0 : -1;
-       }
-       return 0;
-}
-
-extern void
-unsetenv(const char *name)
-{
-       if (!strchr(name, '='))
-               setenviron(name);
-}
+#endif
diff -r -N -u ksh93_2006_09_12/src/lib/libast/comp/realpath.c 
ksh93_2006_10_31/src/lib/libast/comp/realpath.c
--- ksh93_2006_09_12/src/lib/libast/comp/realpath.c     2002-10-29 
20:39:55.000000000 +0100
+++ ksh93_2006_10_31/src/lib/libast/comp/realpath.c     2006-09-25 
20:44:30.000000000 +0200
@@ -24,8 +24,17 @@
  * realpath implementation
  */
 
+#define realpath       ______realpath
+#define resolvepath    ______resolvepath
+
 #include <ast.h>
 
+#undef realpath
+#undef resolvepath
+
+#undef _def_map_ast
+#include <ast_map.h>
+
 extern char*           resolvepath(const char*, char*, size_t);
 
 #if defined(__EXPORT__)
diff -r -N -u ksh93_2006_09_12/src/lib/libast/comp/regcmp.c 
ksh93_2006_10_31/src/lib/libast/comp/regcmp.c
--- ksh93_2006_09_12/src/lib/libast/comp/regcmp.c       2004-10-27 
21:43:28.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/comp/regcmp.c       2006-10-12 
20:26:30.000000000 +0200
@@ -30,7 +30,7 @@
 #include <align.h>
 
 #define INC            (2*1024)
-#define MAX            (16*1024)
+#define TOT            (16*1024)
 #define SUB            10
 
 typedef struct
@@ -146,12 +146,16 @@
                }
        } while (s = va_arg(ap, char*));
        va_end(ap);
-       s = sfstruse(sp);
+       if (!(s = sfstruse(sp)))
+       {
+               sfstrclose(sp);
+               return 0;
+       }
        re = 0;
        n = 0;
        do
        {
-               if ((n += INC) > MAX || !(re = newof(re, Regex_t, 0, n)))
+               if ((n += INC) > TOT || !(re = newof(re, Regex_t, 0, n)))
                {
                        if (re)
                                free(re);
diff -r -N -u ksh93_2006_09_12/src/lib/libast/comp/remove.c 
ksh93_2006_10_31/src/lib/libast/comp/remove.c
--- ksh93_2006_09_12/src/lib/libast/comp/remove.c       2001-10-01 
23:53:12.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/comp/remove.c       2006-09-22 
17:31:32.000000000 +0200
@@ -27,14 +27,15 @@
 
 #undef remove
 
+#undef _def_map_ast
+#include <ast_map.h>
+
 #if _std_remove || !_lib_unlink
 
 NoN(remove)
 
 #else
 
-#undef remove
-
 #if defined(__EXPORT__)
 #define extern __EXPORT__
 #endif
diff -r -N -u ksh93_2006_09_12/src/lib/libast/comp/resolvepath.c 
ksh93_2006_10_31/src/lib/libast/comp/resolvepath.c
--- ksh93_2006_09_12/src/lib/libast/comp/resolvepath.c  2002-10-29 
15:06:17.000000000 +0100
+++ ksh93_2006_10_31/src/lib/libast/comp/resolvepath.c  2006-09-23 
08:46:31.000000000 +0200
@@ -24,9 +24,16 @@
  * resolvepath implementation
  */
 
+#define resolvepath    ______resolvepath
+
 #include <ast.h>
 #include <error.h>
 
+#undef resolvepath
+
+#undef _def_map_ast
+#include <ast_map.h>
+
 #if defined(__EXPORT__)
 #define extern __EXPORT__
 #endif
diff -r -N -u ksh93_2006_09_12/src/lib/libast/comp/setenv.c 
ksh93_2006_10_31/src/lib/libast/comp/setenv.c
--- ksh93_2006_09_12/src/lib/libast/comp/setenv.c       1970-01-01 
01:00:00.000000000 +0100
+++ ksh93_2006_10_31/src/lib/libast/comp/setenv.c       2006-10-03 
21:13:41.000000000 +0200
@@ -0,0 +1,58 @@
+/***********************************************************************
+*                                                                      *
+*               This software is part of the ast package               *
+*           Copyright (c) 1985-2006 AT&T Knowledge Ventures            *
+*                      and is licensed under the                       *
+*                  Common Public License, Version 1.0                  *
+*                      by AT&T Knowledge Ventures                      *
+*                                                                      *
+*                A copy of the License is available at                 *
+*            http://www.opensource.org/licenses/cpl1.0.txt             *
+*         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
+*                                                                      *
+*              Information and Software Systems Research               *
+*                            AT&T Research                             *
+*                           Florham Park NJ                            *
+*                                                                      *
+*                 Glenn Fowler <gsf at research.att.com>                  *
+*                  David Korn <dgk at research.att.com>                   *
+*                   Phong Vo <kpv at research.att.com>                    *
+*                                                                      *
+***********************************************************************/
+#pragma prototyped
+
+#define setenv         ______setenv
+
+#include <ast.h>
+
+#undef setenv
+#undef _lib_setenv     /* procopen() calls setenv() */
+
+#if _lib_setenv
+
+NoN(setenv)
+
+#else
+
+#undef _def_map_ast
+#include <ast_map.h>
+
+#if defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
+extern int
+setenv(const char* name, const char* value, int overwrite)
+{
+       char*   s;
+
+       if (overwrite || !getenv(name))
+       {
+               if (!(s = sfprints("%s=%s", name, value)) || !(s = strdup(s)))
+                       return -1;
+               return setenviron(s) ? 0 : -1;
+       }
+       return 0;
+}
+
+#endif
diff -r -N -u ksh93_2006_09_12/src/lib/libast/comp/spawnveg.c 
ksh93_2006_10_31/src/lib/libast/comp/spawnveg.c
--- ksh93_2006_09_12/src/lib/libast/comp/spawnveg.c     2006-01-20 
06:04:37.000000000 +0100
+++ ksh93_2006_10_31/src/lib/libast/comp/spawnveg.c     2006-11-03 
01:04:06.000000000 +0100
@@ -42,6 +42,7 @@
 
 #include <spawn.h>
 #include <error.h>
+#include <wait.h>
 
 pid_t
 spawnveg(const char* path, char* const argv[], char* const envv[], pid_t pgid)
@@ -62,6 +63,15 @@
        if (err = posix_spawn(&pid, path, NiL, &attr, argv, envv ? envv : 
environ))
                goto bad;
        posix_spawnattr_destroy(&attr);
+#if _lib_posix_spawn < 2
+       if (waitpid(pid, &err, WNOHANG|WNOWAIT) == pid && EXIT_STATUS(err) == 
127)
+       {
+               while (waitpid(pid, NiL, 0) == -1 && errno == EINTR);
+               if (!access(path, X_OK))
+                       errno = ENOEXEC;
+               pid = -1;
+       }
+#endif
        return pid;
  bad:
        errno = err;
@@ -114,6 +124,7 @@
 #else
 
 #include <error.h>
+#include <wait.h>
 #include <sig.h>
 #include <ast_vfork.h>
 
diff -r -N -u ksh93_2006_09_12/src/lib/libast/comp/strftime.c 
ksh93_2006_10_31/src/lib/libast/comp/strftime.c
--- ksh93_2006_09_12/src/lib/libast/comp/strftime.c     2004-12-16 
07:47:37.000000000 +0100
+++ ksh93_2006_10_31/src/lib/libast/comp/strftime.c     2006-09-22 
17:29:56.000000000 +0200
@@ -24,25 +24,14 @@
  * strftime implementation
  */
 
-#define _def_map_ast   1
-
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-__STDPP__directive pragma pp:hide strftime
-#else
 #define strftime       ______strftime
-#endif
 
 #include <ast.h>
 #include <tm.h>
 
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-__STDPP__directive pragma pp:nohide strftime
-#else
 #undef strftime
-#endif
 
 #undef _def_map_ast
-
 #include <ast_map.h>
 
 #undef _lib_strftime   /* we can pass X/Open */
diff -r -N -u ksh93_2006_09_12/src/lib/libast/comp/strptime.c 
ksh93_2006_10_31/src/lib/libast/comp/strptime.c
--- ksh93_2006_09_12/src/lib/libast/comp/strptime.c     2004-12-08 
07:43:24.000000000 +0100
+++ ksh93_2006_10_31/src/lib/libast/comp/strptime.c     2006-09-22 
17:30:11.000000000 +0200
@@ -24,25 +24,14 @@
  * strptime implementation
  */
 
-#define _def_map_ast   1
-
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-__STDPP__directive pragma pp:hide strptime
-#else
 #define strptime       ______strptime
-#endif
 
 #include <ast.h>
 #include <tm.h>
 
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-__STDPP__directive pragma pp:nohide strptime
-#else
 #undef strptime
-#endif
 
 #undef _def_map_ast
-
 #include <ast_map.h>
 
 #if _lib_strptime
diff -r -N -u ksh93_2006_09_12/src/lib/libast/comp/strtold.c 
ksh93_2006_10_31/src/lib/libast/comp/strtold.c
--- ksh93_2006_09_12/src/lib/libast/comp/strtold.c      2001-03-29 
17:33:26.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/comp/strtold.c      2006-10-24 
19:26:26.000000000 +0200
@@ -26,4 +26,18 @@
 #define S2F_function   strtold
 #define S2F_type       2
 
+/*
+ * ast strtold() => strtod() when double == long double
+ */
+
+#define _AST_STD_H     1
+#define strtold                ______strtold
+
+#include <ast_common.h>
+#include <ast_lib.h>
+#include <ast_sys.h>
+
+#undef strtold
+#undef _AST_STD_H
+
 #include "sfstrtof.h"
diff -r -N -u ksh93_2006_09_12/src/lib/libast/comp/strtoll.c 
ksh93_2006_10_31/src/lib/libast/comp/strtoll.c
--- ksh93_2006_09_12/src/lib/libast/comp/strtoll.c      2001-03-29 
17:34:09.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/comp/strtoll.c      2006-10-27 
22:00:40.000000000 +0200
@@ -23,6 +23,20 @@
  * strtoll() implementation
  */
 
+#define strtoll                ______strtoll
+
+#include <ast.h>
+
+#undef strtoll
+
+#if !_UWIN
+
+#undef _def_map_ast
+
+#include <ast_map.h>
+
+#endif
+
 #define S2I_function   strtoll
 #define S2I_number     _ast_intmax_t
 
diff -r -N -u ksh93_2006_09_12/src/lib/libast/comp/strtoull.c 
ksh93_2006_10_31/src/lib/libast/comp/strtoull.c
--- ksh93_2006_09_12/src/lib/libast/comp/strtoull.c     2001-03-29 
17:34:27.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/comp/strtoull.c     2006-10-27 
22:00:52.000000000 +0200
@@ -23,6 +23,20 @@
  * strtoull() implementation
  */
 
+#define strtoull       ______strtoull
+
+#include <ast.h>
+
+#undef strtoull
+
+#if !_UWIN
+
+#undef _def_map_ast
+
+#include <ast_map.h>
+
+#endif
+
 #define S2I_function   strtoull
 #define S2I_number     _ast_intmax_t
 #define S2I_unsigned   1
diff -r -N -u ksh93_2006_09_12/src/lib/libast/comp/syslog.c 
ksh93_2006_10_31/src/lib/libast/comp/syslog.c
--- ksh93_2006_09_12/src/lib/libast/comp/syslog.c       2004-10-27 
21:46:01.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/comp/syslog.c       2006-10-12 
20:28:07.000000000 +0200
@@ -344,7 +344,8 @@
                }
                if ((s = sfstrseek(sp, 0, SEEK_CUR)) && *(s - 1) != '\n')
                        sfputc(sp, '\n');
-               sendlog(sfstruse(sp));
+               if (s = sfstruse(sp))
+                       sendlog(s);
                sfstrclose(sp);
        }
 }
diff -r -N -u ksh93_2006_09_12/src/lib/libast/comp/system.c 
ksh93_2006_10_31/src/lib/libast/comp/system.c
--- ksh93_2006_09_12/src/lib/libast/comp/system.c       2004-07-23 
08:13:53.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/comp/system.c       2006-09-22 
17:28:36.000000000 +0200
@@ -24,27 +24,16 @@
  * ast library system(3)
  */
 
-#define _def_map_ast   1
-
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-__STDPP__directive pragma pp:hide system
-#else
 #define system         ______system
-#endif
 
 #define _STDLIB_H_     1       /* uwin workaround */
 
 #include <ast.h>
 #include <proc.h>
 
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-__STDPP__directive pragma pp:nohide system
-#else
 #undef system
-#endif
 
 #undef _def_map_ast
-
 #include <ast_map.h>
 
 #if defined(__EXPORT__)
diff -r -N -u ksh93_2006_09_12/src/lib/libast/comp/tmpnam.c 
ksh93_2006_10_31/src/lib/libast/comp/tmpnam.c
--- ksh93_2006_09_12/src/lib/libast/comp/tmpnam.c       2003-06-12 
04:37:09.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/comp/tmpnam.c       2006-09-22 
17:28:13.000000000 +0200
@@ -24,35 +24,24 @@
  * tmpnam implementation
  */
 
-#define _def_map_ast   1
-
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-__STDPP__directive pragma pp:hide tmpnam
-#else
 #define tmpnam         ______tmpnam
-#endif
 
 #include <ast.h>
 #include <stdio.h>
 
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-__STDPP__directive pragma pp:nohide tmpnam
-#else
 #undef tmpnam
-#endif
 
 #undef _def_map_ast
-
 #include <ast_map.h>
 
-#ifndef L_tmpnam
-#define L_tmpnam       25
-#endif
-
 #if defined(__EXPORT__)
 #define extern __EXPORT__
 #endif
 
+#ifndef L_tmpnam
+#define L_tmpnam       25
+#endif
+
 extern char*
 tmpnam(char* s)
 {
diff -r -N -u ksh93_2006_09_12/src/lib/libast/comp/transition.c 
ksh93_2006_10_31/src/lib/libast/comp/transition.c
--- ksh93_2006_09_12/src/lib/libast/comp/transition.c   1970-01-01 
01:00:00.000000000 +0100
+++ ksh93_2006_10_31/src/lib/libast/comp/transition.c   2006-10-03 
08:49:55.000000000 +0200
@@ -0,0 +1,86 @@
+/***********************************************************************
+*                                                                      *
+*               This software is part of the ast package               *
+*           Copyright (c) 1985-2006 AT&T Knowledge Ventures            *
+*                      and is licensed under the                       *
+*                  Common Public License, Version 1.0                  *
+*                      by AT&T Knowledge Ventures                      *
+*                                                                      *
+*                A copy of the License is available at                 *
+*            http://www.opensource.org/licenses/cpl1.0.txt             *
+*         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
+*                                                                      *
+*              Information and Software Systems Research               *
+*                            AT&T Research                             *
+*                           Florham Park NJ                            *
+*                                                                      *
+*                 Glenn Fowler <gsf at research.att.com>                  *
+*                  David Korn <dgk at research.att.com>                   *
+*                   Phong Vo <kpv at research.att.com>                    *
+*                                                                      *
+***********************************************************************/
+#pragma prototyped
+
+/*
+ * transient code to aid transition between releases
+ */
+
+#include <ast.h>
+
+#if defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
+#define STUB           1
+
+/*
+ * 2006-09-28
+ *
+ *     on some systems the _std_strtol iffe changed (due to a faulty
+ *     test prototype) and the cause programs dynamically linked to
+ *     an updated -last to fail at runtime with missing _ast_strtol etc.
+ */
+
+#if !_std_strtol
+
+#ifndef strtol
+#undef STUB
+extern long
+_ast_strtol(const char* a, char** b, int c)
+{
+       return strtol(a, b, c);
+}
+#endif
+
+#ifndef strtoul
+#undef STUB
+extern unsigned long
+_ast_strtoul(const char* a, char** b, int c)
+{
+       return strtoul(a, b, c);
+}
+#endif
+
+#ifndef strtoll
+#undef STUB
+extern _ast_intmax_t
+_ast_strtoll(const char* a, char** b, int c)
+{
+       return strtoll(a, b, c);
+}
+#endif
+
+#ifndef strtoull
+#undef STUB
+extern unsigned
+_ast_intmax_t _ast_strtoull(const char* a, char** b, int c)
+{
+       return strtoull(a, b, c);
+}
+#endif
+
+#endif
+
+#if STUB
+NoN(transition)
+#endif
diff -r -N -u ksh93_2006_09_12/src/lib/libast/comp/unsetenv.c 
ksh93_2006_10_31/src/lib/libast/comp/unsetenv.c
--- ksh93_2006_09_12/src/lib/libast/comp/unsetenv.c     1970-01-01 
01:00:00.000000000 +0100
+++ ksh93_2006_10_31/src/lib/libast/comp/unsetenv.c     2006-10-03 
21:15:03.000000000 +0200
@@ -0,0 +1,50 @@
+/***********************************************************************
+*                                                                      *
+*               This software is part of the ast package               *
+*           Copyright (c) 1985-2006 AT&T Knowledge Ventures            *
+*                      and is licensed under the                       *
+*                  Common Public License, Version 1.0                  *
+*                      by AT&T Knowledge Ventures                      *
+*                                                                      *
+*                A copy of the License is available at                 *
+*            http://www.opensource.org/licenses/cpl1.0.txt             *
+*         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
+*                                                                      *
+*              Information and Software Systems Research               *
+*                            AT&T Research                             *
+*                           Florham Park NJ                            *
+*                                                                      *
+*                 Glenn Fowler <gsf at research.att.com>                  *
+*                  David Korn <dgk at research.att.com>                   *
+*                   Phong Vo <kpv at research.att.com>                    *
+*                                                                      *
+***********************************************************************/
+#pragma prototyped
+
+#define unsetenv       ______unsetenv
+
+#include <ast.h>
+
+#undef unsetenv
+
+#if _lib_unsetenv
+
+NoN(unsetenv)
+
+#else
+
+#undef _def_map_ast
+#include <ast_map.h>
+
+#if defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
+extern void
+unsetenv(const char *name)
+{
+       if (!strchr(name, '='))
+               setenviron(name);
+}
+
+#endif
diff -r -N -u ksh93_2006_09_12/src/lib/libast/comp/wc.c 
ksh93_2006_10_31/src/lib/libast/comp/wc.c
--- ksh93_2006_09_12/src/lib/libast/comp/wc.c   2001-10-17 15:56:33.000000000 
+0200
+++ ksh93_2006_10_31/src/lib/libast/comp/wc.c   2006-09-24 11:59:58.000000000 
+0200
@@ -28,7 +28,10 @@
 #include <ast.h>
 #include <wchar.h>
 
+#define STUB   1
+
 #if !_lib_mbtowc
+#undef STUB
 size_t
 mbtowc(wchar_t* t, const char* s, size_t n)
 {
@@ -39,10 +42,12 @@
 #endif
 
 #if !_lib_mbrtowc
+#undef STUB
 size_t
 mbrtowc(wchar_t* t, const char* s, size_t n, mbstate_t* q)
 {
 #if _lib_mbtowc
+#undef STUB
        memset(q, 0, sizeof(*q));
        return mbtowc(t, s, n);
 #else
@@ -55,6 +60,7 @@
 #endif
 
 #if !_lib_mbstowcs
+#undef STUB
 size_t
 mbstowcs(wchar_t* t, const char* s, size_t n)
 {
@@ -71,6 +77,7 @@
 #endif
 
 #if !_lib_wctomb
+#undef STUB
 int
 wctomb(char* s, wchar_t c)
 {
@@ -81,10 +88,12 @@
 #endif
 
 #if !_lib_wcrtomb
+#undef STUB
 size_t
 wcrtomb(char* s, wchar_t c, mbstate_t* q)
 {
 #if _lib_wctomb
+#undef STUB
        memset(q, 0, sizeof(*q));
        return wctomb(s, c);
 #else
@@ -97,6 +106,7 @@
 #endif
 
 #if !_lib_wcslen
+#undef STUB
 size_t
 wcslen(const wchar_t* s)
 {
@@ -109,6 +119,7 @@
 #endif
 
 #if !_lib_wcstombs
+#undef STUB
 size_t
 wcstombs(char* t, register const wchar_t* s, size_t n)
 {
@@ -122,3 +133,7 @@
        return p - t;
 }
 #endif
+
+#if STUB
+NoN(wc)
+#endif
diff -r -N -u ksh93_2006_09_12/src/lib/libast/disc/sfdcseekable.c 
ksh93_2006_10_31/src/lib/libast/disc/sfdcseekable.c
--- ksh93_2006_09_12/src/lib/libast/disc/sfdcseekable.c 2003-03-14 
05:52:17.000000000 +0100
+++ ksh93_2006_10_31/src/lib/libast/disc/sfdcseekable.c 2006-11-02 
17:05:24.000000000 +0100
@@ -23,12 +23,17 @@
 
 /*     Discipline to make an unseekable read stream seekable
 **
+**     sfraise(f,SFSK_DISCARD,0) discards previous seek data
+**     but seeks from current offset on still allowed
+**
 **     Written by Kiem-Phong Vo, kpv at research.att.com, 03/18/1998.
 */
 
 typedef struct _skable_s
 {      Sfdisc_t        disc;   /* sfio discipline */
        Sfio_t*         shadow; /* to shadow data */
+       Sfoff_t         discard;/* sfseek(f,-1,SEEK_SET) discarded data */
+       Sfoff_t         extent; /* shadow extent */
        int             eof;    /* if eof has been reached */
 } Seek_t;
 
@@ -57,34 +62,38 @@
 {
        Seek_t*         sk;
        Sfio_t*         sf;
-       Sfoff_t         addr, extent;
-       ssize_t         r, w;
+       Sfoff_t         addr;
+       ssize_t         r, w, p;
 
        sk = (Seek_t*)disc;
        sf = sk->shadow;
        if(sk->eof)
                return sfread(sf,buf,n);
 
-       addr = sfseek(sf,(Sfoff_t)0,1);
-       extent = sfsize(sf);
+       addr = sfseek(sf,(Sfoff_t)0,SEEK_CUR);
 
-       if(addr+n <= extent)
+       if(addr+n <= sk->extent)
                return sfread(sf,buf,n);
 
-       if((r = (ssize_t)(extent-addr)) > 0)
+       if((r = (ssize_t)(sk->extent-addr)) > 0)
        {       if((w = sfread(sf,buf,r)) != r)
                        return w;
                buf = (char*)buf + r;
                n -= r;
        }
-               
+
        /* do a raw read */
        if((w = sfrd(f,buf,n,disc)) <= 0)
        {       sk->eof = 1;
                w = 0;
        }
-       else if(sfwrite(sf,buf,w) != w)
-               sk->eof = 1;
+       else
+       {
+               if((p = sfwrite(sf,buf,w)) != w)
+                       sk->eof = 1;
+               if(p > 0)
+                       sk->extent += p;
+       }
 
        return r+w;
 }
@@ -99,50 +108,55 @@
 Sfdisc_t*      disc;
 #endif
 {
-       Sfoff_t         extent;
        Seek_t*         sk;
        Sfio_t*         sf;
        char            buf[SF_BUFSIZE];
        ssize_t         r, w;
 
-       if(type < 0 || type > 2)
-               return (Sfoff_t)(-1);
-
        sk = (Seek_t*)disc;
        sf = sk->shadow;
 
-       extent = sfseek(sf,(Sfoff_t)0,2);
-       if(type == 1)
+       switch (type)
+       {
+       case SEEK_SET:
+               addr -= sk->discard;
+               break;
+       case SEEK_CUR:
                addr += sftell(sf);
-       else if(type == 2)
-               addr += extent;
+               break;
+       case SEEK_END:
+               addr += sk->extent;
+               break;
+       default:
+               return -1;
+       }
 
        if(addr < 0)
                return (Sfoff_t)(-1);
-       else if(addr > extent)
+       else if(addr > sk->extent)
        {       if(sk->eof)
                        return (Sfoff_t)(-1);
 
                /* read enough to reach the seek point */
-               while(addr > extent)
-               {       if(addr > extent+sizeof(buf) )
+               while(addr > sk->extent)
+               {       if(addr > sk->extent+sizeof(buf) )
                                w = sizeof(buf);
-                       else    w = (int)(addr-extent);
+                       else    w = (int)(addr-sk->extent);
                        if((r = sfrd(f,buf,w,disc)) <= 0)
                                w = r-1;
                        else if((w = sfwrite(sf,buf,r)) > 0)
-                               extent += r;
+                               sk->extent += w;
                        if(w != r)
                        {       sk->eof = 1;
                                break;
                        }
                }
 
-               if(addr > extent)
+               if(addr > sk->extent)
                        return (Sfoff_t)(-1);
        }
 
-       return sfseek(sf,addr,0);
+       return sfseek(sf,addr,SEEK_SET) + sk->discard;
 }
 
 /* on close, remove the discipline */
@@ -156,9 +170,23 @@
 Sfdisc_t*      disc;
 #endif
 {
-       if(type == SF_FINAL || type == SF_DPOP)
-       {       sfclose(((Seek_t*)disc)->shadow);
+       Seek_t*         sk;
+
+       sk = (Seek_t*)disc;
+
+       switch (type)
+       {
+       case SF_FINAL:
+       case SF_DPOP:
+               sfclose(sk->shadow);
                free(disc);
+               break;
+       case SFSK_DISCARD:
+               sk->eof = 0;
+               sk->discard += sk->extent;
+               sk->extent = 0;
+               sfseek(sk->shadow,(Sfoff_t)0,SEEK_SET);
+               break;
        }
        return 0;
 }
@@ -173,7 +201,7 @@
        reg Seek_t*     sk;
 
        /* see if already seekable */
-       if(sfseek(f,(Sfoff_t)0,1) >= 0)
+       if(sfseek(f,(Sfoff_t)0,SEEK_CUR) >= 0)
                return 0;
 
        if(!(sk = (Seek_t*)malloc(sizeof(Seek_t))) )
@@ -185,6 +213,8 @@
        sk->disc.seekf = skseek;
        sk->disc.exceptf = skexcept;
        sk->shadow = sftmp(SF_BUFSIZE);
+       sk->discard = 0;
+       sk->extent = 0;
        sk->eof = 0;
 
        if(sfdisc(f, (Sfdisc_t*)sk) != (Sfdisc_t*)sk)
diff -r -N -u ksh93_2006_09_12/src/lib/libast/disc/sfkeyprintf.c 
ksh93_2006_10_31/src/lib/libast/disc/sfkeyprintf.c
--- ksh93_2006_09_12/src/lib/libast/disc/sfkeyprintf.c  2004-12-09 
20:32:05.000000000 +0100
+++ ksh93_2006_10_31/src/lib/libast/disc/sfkeyprintf.c  2006-10-27 
16:17:27.000000000 +0200
@@ -220,6 +220,7 @@
                value->c = s ? *s : n;
                break;
        case 'd':
+       case 'i':
                fp->fmt.size = sizeof(Sflong_t);
                value->q = (Sflong_t)(s ? strtoll(s, NiL, 0) : n);
                break;
@@ -230,7 +231,9 @@
                value->q = s ? (Sflong_t)strtoull(s, NiL, 0) : n;
                break;
        case 'p':
-               value->p = (char**)(s ? strtol(s, NiL, 0) : n);
+               if (s)
+                       n = strtoll(s, NiL, 0);
+               value->p = pointerof(n);
                break;
        case 'q':
                if (s)
@@ -245,21 +248,8 @@
                }
                break;
        case 's':
-               if (!s)
-               {
-                       if (h)
-                       {
-                               if (fp->tmp[1] || (fp->tmp[1] = sfstropen()))
-                               {
-                                       sfprintf(fp->tmp[1], "%I*d", sizeof(n), 
n);
-                                       s = sfstruse(fp->tmp[1]);
-                               }
-                               else
-                                       s = "";
-                       }
-                       else
-                               s = "";
-               }
+               if (!s && (!h || !fp->tmp[1] && !(fp->tmp[1] = sfstropen()) || 
sfprintf(fp->tmp[1], "%I*d", sizeof(n), n) <= 0 || !(s = sfstruse(fp->tmp[1]))))
+                       s = "";
                if (x)
                {
                        h = 0;
@@ -277,12 +267,7 @@
                                                fmt.fmt.form = v;
                                                for (h = 0; h < 
elementsof(fmt.tmp); h++)
                                                        fmt.tmp[h] = 0;
-                                               if (fp->tmp[0] || (fp->tmp[0] = 
sfstropen()))
-                                               {
-                                                       sfprintf(fp->tmp[0], 
"%!", &fmt);
-                                                       s = 
sfstruse(fp->tmp[0]);
-                                               }
-                                               else
+                                               if (!fp->tmp[0] && !(fp->tmp[0] 
= sfstropen()) || sfprintf(fp->tmp[0], "%!", &fmt) <= 0 || !(s = 
sfstruse(fp->tmp[0])))
                                                        s = "";
                                                *(v - 1) = d;
                                                if (f.delimiter)
@@ -338,11 +323,8 @@
                value->i = n;
                break;
        default:
-               if ((!fp->convert || !(value->s = (*fp->convert)(fp->handle, 
&fp->fmt, a, s, n))) && (fp->tmp[0] || (fp->tmp[0] = sfstropen())))
-               {
-                       sfprintf(fp->tmp[0], "%%%c", fp->fmt.fmt);
-                       value->s = sfstruse(fp->tmp[0]);
-               }
+               if ((!fp->convert || !(value->s = (*fp->convert)(fp->handle, 
&fp->fmt, a, s, n))) && (!fp->tmp[0] && !(fp->tmp[0] = sfstropen()) || 
sfprintf(fp->tmp[0], "%%%c", fp->fmt.fmt) <= 0 || !(value->s = 
sfstruse(fp->tmp[0]))))
+                       value->s = "";
                break;
        }
        fp->level--;
diff -r -N -u ksh93_2006_09_12/src/lib/libast/features/common 
ksh93_2006_10_31/src/lib/libast/features/common
--- ksh93_2006_09_12/src/lib/libast/features/common     2006-09-01 
03:02:05.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/features/common     2006-09-28 
19:52:10.000000000 +0200
@@ -276,7 +276,6 @@
 tst    - -DN=1 - -DN=0 output{
        #define _BYTESEX_H
 
-       #include <stdio.h>
        #include <string.h>
        #include <sys/types.h>
 
@@ -331,7 +330,6 @@
 }end
 
 tst    - -DTRY=1 - -DTRY=1 -Dvoid=char - -DTRY=2 - -DTRY=3 - -DTRY=4 output{
-       #define printf  ______printf
        #if _STD_ && _hdr_stdarg
        #include <stdarg.h>
        static void
@@ -372,7 +370,6 @@
                va_end(ap);
        }
        #endif
-       #undef  printf
        int
        main()
        {
@@ -402,6 +399,12 @@
                        printf("/* va_arg() va_list type */\n");
        #endif /*TRY == 4*/
        
+       #if _UWIN
+               printf("#ifndef va_copy\n");
+               printf("#define va_copy(to,fr) ((to)=(fr))\t");
+                       printf("/* copy va_list fr -> to */\n");
+               printf("#endif\n");
+       #else
        #if !defined(va_copy)
        #if defined(__va_copy)
                printf("#ifndef va_copy\n");
@@ -422,6 +425,7 @@
        #endif
        #endif
        #endif
+       #endif
        
                r = 1;
                printf("#undef  _ast_va_list\n");
@@ -463,9 +467,6 @@
 
 cat{
        #ifndef _AST_STD_H
-       #       if _def_map_ast
-       #               include <ast_map.h>
-       #       endif
        #       if __STD_C && _hdr_stddef
        #       include <stddef.h>
        #       endif
@@ -481,6 +482,12 @@
        #       define _typ_ssize_t     1
                typedef int ssize_t;
        #endif
+       #ifndef _AST_STD_H
+       #       define _def_map_ast     1
+       #       if !_def_map_ast
+       #               include <ast_map.h>
+       #       endif
+       #endif
 }end
 
 run{
diff -r -N -u ksh93_2006_09_12/src/lib/libast/features/fcntl.c 
ksh93_2006_10_31/src/lib/libast/features/fcntl.c
--- ksh93_2006_09_12/src/lib/libast/features/fcntl.c    2005-05-24 
05:51:04.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/features/fcntl.c    2006-10-26 
19:19:10.000000000 +0200
@@ -27,9 +27,7 @@
  * generate POSIX fcntl.h
  */
 
-#include <stdio.h>
 #include <sys/types.h>
-#include <sys/stat.h>
 
 #include "FEATURE/lib"
 
@@ -44,8 +42,15 @@
 #endif
 #endif
 
-#include "FEATURE/fcntl.lcl"
-#include "FEATURE/unistd.lcl"
+#if _hdr_fcntl
+#include <fcntl.h>
+#endif
+#if _hdr_unistd
+#include <unistd.h>
+#endif
+
+#include <sys/stat.h>
+
 #include "FEATURE/fs"
 
 #undef getdtablesize   
@@ -64,7 +69,6 @@
 {
        int             f_local = 0;
        int             f_lck = 0;
-       int             f_lk = 0;
        int             o_local = 2;
 
        printf("#pragma prototyped\n");
@@ -72,49 +76,19 @@
        printf("#if _typ_off64_t\n");
        printf("#undef  off_t\n");
        printf("#ifdef __STDC__\n");
-       printf("#define off_t   off_t\n");
+       printf("#define off_t           off_t\n");
        printf("#endif\n");
        printf("#endif\n");
        printf("\n");
-#if _lcl_fcntl || _hdr_lcl_fcntl /* _hdr_lcl_ workaround iffe pre 2002-09-11 */
-       printf("#if defined(__STDPP__directive) && defined(__STDPP__hide)\n");
-       printf("__STDPP__directive pragma pp:hide chmod creat fcntl mkdir 
mkfifo mmap mmap64 munmap");
-#if !_lib__xmknod && !defined(mknod)
-       printf(" mknod");
-#endif
-       printf(" open umask\n");
-       printf("#else\n");
-       printf("#define chmod   ______chmod\n");
-#ifndef creat
-       printf("#undef  creat\n");
-       printf("#define creat   ______creat\n");
-#endif
-       printf("#define fcntl   ______fcntl\n");
-       printf("#define mkdir   ______mkdir\n");
-       printf("#define mkfifo  ______mkfifo\n");
-#if !_lib__xmknod && !defined(mknod)
-       printf("#define mknod   ______mknod\n");
-#endif
-       printf("#undef  mmap\n");
-       printf("#define mmap    ______mmap\n");
-       printf("#undef  mmap64\n");
-       printf("#define mmap64  ______mmap64\n");
-       printf("#undef  munmap\n");
-       printf("#define munmap  ______munmap\n");
-       printf("#undef  open\n");
-       printf("#define open    ______open\n");
-       printf("#define umask   ______umask\n");
-       printf("#endif \n");
+       printf("#include <ast_fs.h>\n");
        printf("\n");
-#if defined(S_IRUSR)
-       printf("#include <ast_fs.h>     /* <fcntl.h> includes <sys/stat.h>! 
part I*/\n");
        printf("#if _typ_off64_t\n");
        printf("#undef  off_t\n");
        printf("#ifdef __STDC__\n");
-       printf("#define off_t   off_t\n");
+       printf("#define off_t           off_t\n");
        printf("#endif\n");
        printf("#endif\n");
-#endif
+       printf("\n");
        printf("#include <fcntl.h>\n");
 #if _hdr_mman
        printf("#include <mman.h>\n");
@@ -124,58 +98,6 @@
 #endif
 #endif
        printf("\n");
-       printf("#if defined(_AST_STD_H) || defined(_POSIX_SOURCE) || 
defined(_XOPEN_SOURCE)\n");
-       printf("#define _AST_mode_t     mode_t\n");
-       printf("#else\n");
-       printf("#define _AST_mode_t     int\n");
-       printf("#endif\n");
-       printf("#if defined(__STDPP__directive) && defined(__STDPP__hide)\n");
-       printf("__STDPP__directive pragma pp:nohide chmod creat fcntl mkdir 
mkfifo mmap mmap64 munmap");
-#if !_lib__xmknod && !defined(mknod)
-       printf(" mknod");
-#endif
-       printf(" open umask\n");
-       printf("extern int      creat(const char*, _AST_mode_t);\n");
-       printf("extern int      fcntl(int, int, ...);\n");
-       printf("extern int      open(const char*, int, ...);\n");
-       printf("extern void*    mmap(void*, size_t, int, int, int, off_t);\n");
-       printf("extern int      munmap(void*, size_t);\n");
-       printf("#else\n");
-       printf("#ifdef  creat\n");
-       printf("#undef  creat\n");
-       printf("extern int      creat(const char*, _AST_mode_t);\n");
-       printf("#endif \n");
-       printf("#ifdef  fcntl\n");
-       printf("#undef  fcntl\n");
-       printf("extern int      fcntl(int, int, ...);\n");
-       printf("#endif \n");
-       printf("#ifdef  mmap\n");
-       printf("#undef  mmap\n");
-       printf("extern void*    mmap(void*, size_t, int, int, int, off_t);\n");
-       printf("#endif \n");
-       printf("#undef  mmap64\n");
-       printf("#ifdef  munmap\n");
-       printf("#undef  munmap\n");
-       printf("extern int      munmap(void*, size_t);\n");
-       printf("#endif \n");
-       printf("#ifdef  open\n");
-       printf("#undef  open\n");
-       printf("extern int      open(const char*, int, ...);\n");
-       printf("#endif \n");
-       printf("\n");
-       printf("#undef  chmod\n");
-       printf("#undef  mkdir\n");
-       printf("#undef  mkfifo\n");
-#if !_lib__xmknod && !defined(mknod)
-       printf("#undef  mknod\n");
-#endif
-       printf("#undef  umask\n");
-       printf("#endif \n");
-       printf("\n");
-       printf("#undef  _AST_mode_t\n");
-       printf("\n");
-#endif
-
 #ifndef        FD_CLOEXEC
        printf("#define FD_CLOEXEC      1\n");
        printf("\n");
@@ -198,7 +120,6 @@
 #endif
 #ifndef        F_GETLK
 #define NEED_F 1
-       f_lk++;
 #else
        if (F_GETLK > f_local) f_local = F_GETLK;
 #endif
@@ -220,13 +141,11 @@
 #endif
 #ifndef        F_SETLK
 #define NEED_F 1
-       f_lk++;
 #else
        if (F_SETLK > f_local) f_local = F_SETLK;
 #endif
 #ifndef        F_SETLKW
 #define NEED_F 1
-       f_lk++;
 #else
        if (F_SETLKW > f_local) f_local = F_SETLKW;
 #endif
@@ -346,71 +265,61 @@
 #endif
 
 #if    NEED_O
-       printf("#define open            _ast_open\n");
-       printf("#define _ast_O_LOCAL    0%o\n", o_local<<1);
+       printf("#define open                    _ast_open\n");
+       printf("#define _ast_O_LOCAL            0%o\n", o_local<<1);
 #ifndef        O_RDONLY
-       printf("#define O_RDONLY        0\n");
+       printf("#define O_RDONLY                0\n");
 #endif
 #ifndef        O_WRONLY
-       printf("#define O_WRONLY        1\n");
+       printf("#define O_WRONLY                1\n");
 #endif
 #ifndef        O_RDWR
-       printf("#define O_RDWR          2\n");
+       printf("#define O_RDWR                  2\n");
 #endif
 #ifndef        O_APPEND
-       printf("#define O_APPEND        0%o\n", o_local <<= 1);
+       printf("#define O_APPEND                0%o\n", o_local <<= 1);
 #endif
 #ifndef        O_CREAT
-       printf("#define O_CREAT         0%o\n", o_local <<= 1);
+       printf("#define O_CREAT                 0%o\n", o_local <<= 1);
 #endif
 #ifndef        O_EXCL
-       printf("#define O_EXCL          0%o\n", o_local <<= 1);
+       printf("#define O_EXCL                  0%o\n", o_local <<= 1);
 #endif
 #ifndef        O_NOCTTY
 #ifdef TIOCNOTTY
-       printf("#define O_NOCTTY        0%o\n", o_local <<= 1);
+       printf("#define O_NOCTTY                0%o\n", o_local <<= 1);
 #endif
 #endif
 #ifndef        O_NONBLOCK
 #ifndef        O_NDELAY
-       printf("#define O_NONBLOCK      0%o\n", o_local <<= 1);
+       printf("#define O_NONBLOCK              0%o\n", o_local <<= 1);
 #endif
 #endif
 #ifndef        O_TRUNC
-       printf("#define O_TRUNC         0%o\n", o_local <<= 1);
+       printf("#define O_TRUNC                 0%o\n", o_local <<= 1);
 #endif
 #endif
 #ifndef        O_ACCMODE
-       printf("#define O_ACCMODE       (O_RDONLY|O_WRONLY|O_RDWR)\n");
+       printf("#define O_ACCMODE               (O_RDONLY|O_WRONLY|O_RDWR)\n");
 #endif
 #ifndef        O_NOCTTY
 #ifndef        TIOCNOTTY
-       printf("#define O_NOCTTY        0\n");
+       printf("#define O_NOCTTY                0\n");
 #endif
 #endif
 #ifndef        O_NONBLOCK
 #ifdef O_NDELAY
-       printf("#define O_NONBLOCK      O_NDELAY\n");
+       printf("#define O_NONBLOCK              O_NDELAY\n");
 #endif
 #endif
 #ifndef        O_BINARY
-       printf("#define O_BINARY        0\n");
+       printf("#define O_BINARY                0\n");
 #endif
 #ifndef        O_TEMPORARY
-       printf("#define O_TEMPORARY     0\n");
+       printf("#define O_TEMPORARY             0\n");
 #endif
 #ifndef        O_TEXT
-       printf("#define O_TEXT          0\n");
-#endif
-#if defined(S_IRUSR)
-       printf("\n");
-       printf("#include <ls.h> /* <fcntl.h> includes <sys/stat.h> part II! 
*/\n");
-       printf("#if _typ_off64_t\n");
-       printf("#undef  off_t\n");
-       printf("#ifdef __STDC__\n");
-       printf("#define off_t   off_t\n");
-       printf("#endif\n");
-       printf("#endif\n");
+       printf("#define O_TEXT                  0\n");
 #endif
 #if    NEED_F || NEED_O
        printf("\n");
@@ -421,25 +330,30 @@
        printf("extern int      open(const char*, int, ...);\n");
 #endif
 #endif
+       printf("\n");
+       printf("#include <ast_fs.h>\n");
        printf("#if _typ_off64_t\n");
        printf("#undef  off_t\n");
-       printf("#define off_t   off64_t\n");
+       printf("#define off_t           off64_t\n");
        printf("#endif\n");
-       printf("#if _lib_creat64\n");
-       printf("#define creat   creat64\n");
-       printf("#if !defined(__USE_LARGEFILE64)\n");
-       printf("extern int      creat64(const char*, mode_t);\n");
+       printf("#if _lib_fstat64\n");
+       printf("#define fstat           fstat64\n");
+       printf("#endif\n");
+       printf("#if _lib_lstat64\n");
+       printf("#define lstat           lstat64\n");
        printf("#endif\n");
+       printf("#if _lib_stat64\n");
+       printf("#define stat            stat64\n");
+       printf("#endif\n");
+       printf("#if _lib_creat64\n");
+       printf("#define creat           creat64\n");
        printf("#endif\n");
        printf("#if _lib_mmap64\n");
-       printf("#define mmap    mmap64\n");
-       printf("extern void*    mmap64(void*, size_t, int, int, int, 
off64_t);\n");
+       printf("#define mmap            mmap64\n");
        printf("#endif\n");
        printf("#if _lib_open64\n");
-       printf("#define open    open64\n");
-       printf("#if !defined(__USE_LARGEFILE64)\n");
-       printf("extern int      open64(const char*, int, ...);\n");
-       printf("#endif\n");
+       printf("#undef  open\n");
+       printf("#define open            open64\n");
        printf("#endif\n");
 
        return 0;
diff -r -N -u ksh93_2006_09_12/src/lib/libast/features/fs 
ksh93_2006_10_31/src/lib/libast/features/fs
--- ksh93_2006_09_12/src/lib/libast/features/fs 2005-07-28 00:16:40.000000000 
+0200
+++ ksh93_2006_10_31/src/lib/libast/features/fs 2006-09-21 06:41:53.000000000 
+0200
@@ -2,6 +2,7 @@
 lib    
_fxstat,__fxstat,_lxstat,__lxstat,_xmknod,__xmknod,_xstat,__xstat,lstat,mknod,sync
 sys/types.h sys/stat.h
 lib    _fxstat64,__fxstat64,_lxstat64,__lxstat64,_xstat64,__xstat64 
-D_LARGEFILE64_SOURCE sys/types.h sys/stat.h
 mac    fstat,lstat,stat,mknod sys/types.h sys/stat.h
+
 lcl    xstat -D_LARGEFILE64_SOURCE link{
        #include <sys/types.h>
        #include <sys/stat.h>
@@ -27,6 +28,7 @@
                return stat(".",&st) < 0;
        }
 }end
+
 lcl    xstat64 -D_LARGEFILE64_SOURCE link{
        #include <sys/types.h>
        #include <sys/stat.h>
@@ -50,77 +52,20 @@
                return stat64(".",&st) < 0;
        }
 }end
-cat{
-       #if _typ_off64_t
-       #undef  off_t
-       #ifdef __STDC__
-       #define off_t   off_t
-       #endif
-       #endif
-       #ifndef _def_param_lcl
-       #ifndef S_ISUID
-       #if !defined(_AST_H) && !defined(_TM_H)
-       #include <sys/types.h>
-       #endif
-       #if defined(__STDPP__directive) && defined(__STDPP__hide)
-       #if !_lib__xmknod && !_mac_mknod && !defined(__RENAME)
-       __STDPP__directive pragma pp:hide mknod
-       #endif
-       #if !_lib__fxstat && !_mac_fstat && !defined(__RENAME)
-       __STDPP__directive pragma pp:hide fstat
-       #endif
-       #if !_lib__lxstat && !_mac_lstat && !defined(__RENAME)
-       __STDPP__directive pragma pp:hide lstat
-       #endif
-       __STDPP__directive pragma pp:hide chmod mkdir mkfifo mount umask
-       #else
-       #if !_lib__xmknod && !_mac_mknod && !defined(__RENAME)
-       #define mknod ______mknod
-       #endif
-       #if !_lib__fxstat && !_mac_fstat && !defined(__RENAME)
-       #define fstat ______fstat
-       #endif
-       #if !_lib__lxstat && !_mac_lstat && !defined(__RENAME)
-       #define lstat ______lstat
-       #endif
-       #define chmod ______chmod
-       #define mkdir ______mkdir
-       #define mkfifo ______mkfifo
-       #define mount ______mount
-       #define umask ______umask
-       #endif
-       #include <sys/stat.h>
-       #if defined(__STDPP__directive) && defined(__STDPP__hide)
-       #if !_lib__xmknod && !_mac_mknod && !defined(__RENAME)
-       __STDPP__directive pragma pp:nohide mknod
-       #endif
-       #if !_lib__fxstat && !_mac_fstat && !defined(__RENAME)
-       __STDPP__directive pragma pp:nohide fstat
-       #endif
-       #if !_lib__lxstat && !_mac_lstat && !defined(__RENAME)
-       __STDPP__directive pragma pp:nohide lstat
-       #endif
-       __STDPP__directive pragma pp:nohide chmod mkdir mkfifo mount umask
-       #else
-       #if !_lib__xmknod && !_mac_mknod && !defined(__RENAME)
-       #undef  mknod
-       #endif
-       #if !_lib__fxstat && !_mac_fstat && !defined(__RENAME)
-       #undef  fstat
-       #endif
-       #if !_lib_lxstat && !_mac_lstat && !defined(__RENAME)
-       #undef  lstat
-       #endif
-       #undef  chmod
-       #undef  mkdir
-       #undef  mkfifo
-       #undef  mount
-       #undef  umask
-       #endif
-       #endif
-       #endif
-       #define FS_default      "ufs"
-}end
+
+header sys/stat.h
+
+extern chmod           int     (const char*, mode_t)
+extern fstat           int     (int, struct stat*)
+extern lstat           int     (const char*, struct stat*)
+extern mkdir           int     (const char*, mode_t)
+extern mkfifo          int     (const char*, mode_t)
+extern mknod           int     (const char*, mode_t, dev_t)
+extern stat            int     (const char*, struct stat*)
+extern mkfifo          mode_t  (mode_t)
+
+define FS_default      "ufs"
+
 macro{
        #include <sys/types.h>
        #include <sys/stat.h>
@@ -182,20 +127,24 @@
        #endif
        !
 }end
+
 mem    mnttab.mt_dev,mnttab.mt_filsys,mnttab.mt_fstyp sys/types.h mnttab.h
 mem    mntent.mnt_opts,w_mntent.mnt_opts,mnttab.mnt_opts sys/types.h stdio.h 
mntent.h sys/mntent.h
 mem    mntent.mnt_opts,mnttab.mnt_opts sys/types.h mnttab.h sys/mnttab.h
 mem    stat.st_blocks,stat.st_blksize,stat.st_rdev sys/types.h sys/stat.h
 mem    statfs.f_files,statfs.f_bavail sys/types.h - sys/statfs.h - sys/vfs.h - 
sys/param.h sys/mount.h
 mem    statvfs.f_basetype,statvfs.f_frsize sys/types.h sys/statvfs.h
+
 ary    f_reserved7 sys/types.h sys/statvfs.h note{ statvfs.f_reserved7 can 
double for statvfs.f_basetype }end compile{
        int f(vp)struct statvfs* vp;{return vp->f_reserved7[0] = 1;}
 }end
+
 hdr    mntent,mnttab
 lib    getmntent,getmntinfo,mntctl,mntopen,mntread,mntclose,setmntent
 lib    w_getmntent
 lib    statfs,statvfs
 sys    fs_types,mntent,mnttab,mount,statfs,statvfs,vfs,vmount
+
 lib    statfs4 sys/types.h - sys/statfs.h - sys/vfs.h - sys/mount.h compile{
        int f()
        {
@@ -203,6 +152,7 @@
                return statfs("/",&fs,sizeof(fs),0);
        }
 }end
+
 lib    getmntinfo_statvfs note{ getmntinfo uses statvfs -- since when? }end 
compile{
        #include <sys/types.h>
        #include <sys/mount.h>
@@ -213,6 +163,7 @@
                return getmntinfo(fs, 0);
        }
 }end
+
 cat{
        #if _sys_statvfs
        #include <sys/statvfs.h>
@@ -261,18 +212,23 @@
        #endif
        #endif
 }end
+
 str    st_fstype sys/types.h sys/stat.h note{ stat.st_fstype is a string }end 
compile{
        int f(st)struct stat* st;{return st->st_fstype[0];}
 }end
+
 int    st_fstype sys/types.h sys/stat.h note{ stat.st_fstype is an int }end 
compile{
        int f(st)struct stat* st;{return st->st_fstype = 1;}
 }end
+
 int    st_spare1 sys/types.h sys/stat.h note{ stat.st_spare1 is an int }end 
compile{
        int f(st)struct stat* st;{return st->st_spare1 = 1;}
 }end
+
 ary    st_spare4 sys/types.h sys/stat.h note{ stat.st_spare4 is an array }end 
compile{
        int f(st)struct stat* st;{return st->st_spare4[0] = 1;}
 }end
+
 ary    st_pad4 sys/types.h sys/stat.h note{ stat.st_pad4 is an array }end 
compile{
        int f(st)struct stat* st;{return st->st_pad4[0] = 1;}
 }end
diff -r -N -u ksh93_2006_09_12/src/lib/libast/features/hdr 
ksh93_2006_10_31/src/lib/libast/features/hdr
--- ksh93_2006_09_12/src/lib/libast/features/hdr        2003-06-12 
12:50:04.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/features/hdr        1970-01-01 
01:00:00.000000000 +0100
@@ -1,97 +0,0 @@
-tst std_stddef note{ <stddef.h> looks ok }end compile{
-       #include <sys/types.h>
-       #include <stddef.h>
-       ptrdiff_t i;
-       size_t j;
-       wchar_t k;
-}end
-tst std_stdlib note{ <stdlib.h> looks ok }end compile{
-       #include <sys/types.h>
-       #if _std_stddef
-       #include <stddef.h>
-       #endif
-       #include <stdlib.h>
-       div_t i;
-       ldiv_t j;
-}end
-tst std_def_calloc note{ <std*.h> defines calloc macro }end compile{
-       #include <sys/types.h>
-       #if _std_stddef
-       #include <stddef.h>
-       #endif
-       #include <stdlib.h>
-       #ifndef calloc
-       (
-       #endif
-}end
-tst std_def_cfree note{ <std*.h> defines cfree macro }end compile{
-       #include <sys/types.h>
-       #if _std_stddef
-       #include <stddef.h>
-       #endif
-       #include <stdlib.h>
-       #ifndef cfree
-       (
-       #endif
-}end
-tst std_def_free note{ <std*.h> defines free macro }end compile{
-       #include <sys/types.h>
-       #if _std_stddef
-       #include <stddef.h>
-       #endif
-       #include <stdlib.h>
-       #ifndef free
-       (
-       #endif
-}end
-tst std_def_malloc note{ <std*.h> defines malloc macro }end compile{
-       #include <sys/types.h>
-       #if _std_stddef
-       #include <stddef.h>
-       #endif
-       #include <stdlib.h>
-       #ifndef malloc
-       (
-       #endif
-}end
-tst std_def_memalign note{ <std*.h> defines memalign macro }end compile{
-       #include <sys/types.h>
-       #if _std_stddef
-       #include <stddef.h>
-       #endif
-       #include <stdlib.h>
-       #ifndef memalign
-       (
-       #endif
-}end
-tst std_def_pvalloc note{ <std*.h> defines pvalloc macro }end compile{
-       #include <sys/types.h>
-       #if _std_stddef
-       #include <stddef.h>
-       #endif
-       #include <stdlib.h>
-       #ifndef pvalloc
-       (
-       #endif
-}end
-tst std_def_realloc note{ <std*.h> defines realloc macro }end compile{
-       #include <sys/types.h>
-       #if _std_stddef
-       #include <stddef.h>
-       #endif
-       #include <stdlib.h>
-       #ifndef realloc
-       (
-       #endif
-}end
-tst std_def_valloc note{ <std*.h> defines valloc macro }end compile{
-       #include <sys/types.h>
-       #if _std_stddef
-       #include <stddef.h>
-       #endif
-       #include <stdlib.h>
-       #ifndef valloc
-       (
-       #endif
-}end
-npt    getpagesize,sbrk unistd.h
diff -r -N -u ksh93_2006_09_12/src/lib/libast/features/iffeio 
ksh93_2006_10_31/src/lib/libast/features/iffeio
--- ksh93_2006_09_12/src/lib/libast/features/iffeio     2002-02-28 
05:25:52.000000000 +0100
+++ ksh93_2006_10_31/src/lib/libast/features/iffeio     1970-01-01 
01:00:00.000000000 +0100
@@ -1,5 +0,0 @@
-iff    SFSTDIO
-cat{
-       #include "FEATURE/common"
-}end
-lcl    stdio
diff -r -N -u ksh93_2006_09_12/src/lib/libast/features/lib 
ksh93_2006_10_31/src/lib/libast/features/lib
--- ksh93_2006_09_12/src/lib/libast/features/lib        2005-07-28 
00:16:54.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/features/lib        2006-10-31 
17:02:05.000000000 +0100
@@ -1,7 +1,9 @@
+ref    -D_def_map_ast=1
+
 cmd    universe
 
-hdr    dirent,direntry,filio,fmtmsg,fnmatch,jioctl,libgen,locale
-hdr    ndir,nl_types,process,spawn,syslog,utime,vfork,wctype
+hdr    dirent,direntry,filio,fmtmsg,fnmatch,jioctl,libgen,limits
+hdr    locale,ndir,nl_types,process,spawn,syslog,utime,vfork,wctype
 hdr    wchar note{ <wchar.h> and isw*() really work }end execute{
        #include <wchar.h>
        int
@@ -21,6 +23,7 @@
 lib    fchmod,fcntl,fmtmsg,fnmatch,fork,fsync
 lib    getconf,getdents,getdirentries,getdtablesize,getdate
 lib    getgroups,gethostname,getlogin,getpagesize,getrlimit,getuniverse
+lib    getopt,getsubopt,getopt_long,getopt_long_only
 lib    glob,index,iswblank,iswctype,killpg,link,localeconv,madvise
 lib    mbtowc,mbrtowc,memalign,memchr,memcpy,memdup,memmove,memset
 lib    mkdir,mkfifo,mktemp,mktime
@@ -30,14 +33,15 @@
 lib    sigprocmask,sigsetmask,sigunblock,sigvec,socketpair
 lib    spawn,spawnve,spawnveg
 lib    strchr,strcoll,strdup,strerror,strcasecmp,strncasecmp,strrchr,strstr
-lib    strtod,strtold,strtol,strtoll,strtoul,strtoull
-lib    strxfrm,strftime,swab,symlink,sysconf,sysinfo,syslog
+lib    strmode,strxfrm,strftime,swab,symlink,sysconf,sysinfo,syslog
 lib    telldir,tmpnam,tzset,universe,unlink,utime,wctype
 lib    ftruncate,truncate
 lib    creat64,fstat64,fstatvfs64,ftruncate64 -D_LARGEFILE64_SOURCE
 lib    lseek64,lstat64 -D_LARGEFILE64_SOURCE
 lib    open64,readdir64,stat64,statvfs64,truncate64 -D_LARGEFILE64_SOURCE
 
+lib,npt        strtod,strtold,strtol,strtoll,strtoul,strtoull stdlib.h
+
 mem    direct.d_reclen sys/types.h sys/dir.h
 mem    
dirent.d_fileno,dirent.d_ino,dirent.d_namlen,dirent.d_off,dirent.d_reclen,dirent.d_type
 sys/types.h dirent.h
 mem    DIR sys/types.h - dirent.h - sys/dir.h
@@ -220,13 +224,19 @@
        }
 }end
 
-tst    lib_posix_spawn unistd.h stdlib.h spawn.h note{ posix_spawn exists and 
it works and its worth using }end execute{
+tst    lib_posix_spawn unistd.h stdlib.h spawn.h -Dfork=______fork note{ 
posix_spawn exists and it works and its worth using }end status{
+       #include <sys/types.h>
+       #include <sys/stat.h>
+       #include <sys/wait.h>
        #include <spawn.h>
        #include <signal.h>
+       #include <fcntl.h>
+       #include <string.h>
+       #undef fork
        /* if it uses fork() why bother? */
-       int fork() { return -1; }
-       int _fork() { return -1; }
-       int __fork() { return -1; }
+       pid_t fork _ARG_((void)) { return -1; }
+       pid_t _fork _ARG_((void)) { return -1; }
+       pid_t __fork _ARG_((void)) { return -1; }
        int
        main(argc, argv)
        int     argc;
@@ -243,36 +253,40 @@
                        _exit(signal(SIGHUP, SIG_DFL) != SIG_IGN);
                signal(SIGHUP, SIG_IGN);
                if (posix_spawnattr_init(&attr))
-                       _exit(1);
+                       _exit(0);
                if (posix_spawnattr_setpgroup(&attr, 0))
-                       _exit(1);
+                       _exit(0);
                /* first try an a.out and verify that SIGHUP is ignored */
                cmd[0] = argv[0];
                cmd[1] = "test";
                cmd[2] = 0;
                if (posix_spawn(&pid, cmd[0], 0, &attr, cmd, 0))
-                       _exit(1);
+                       _exit(0);
                status = 1;
                if (wait(&status) < 0 || status != 0)
-                       _exit(1);
+                       _exit(0);
                /* passing ENOEXEC to the shell is bogus */
                n = strlen(cmd[0]);
                if (n >= (sizeof(tmp) - 3))
-                       _exit(1);
+                       _exit(0);
                strcpy(tmp, cmd[0]);
                tmp[n] = '.';
                tmp[n+1] = 's';
                tmp[n+2] = 'h';
                tmp[n+3] = 0;
-               if (close(creat(tmp, 0777)) < 0 || chmod(tmp, 0777) < 0)
-                       _exit(1);
+               if (close(open(tmp, O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO)) < 0 || 
chmod(tmp, S_IRWXU|S_IRWXG|S_IRWXO) < 0)
+                       _exit(0);
                cmd[0] = tmp;
-               if (!posix_spawn(&pid, cmd[0], 0, &attr, cmd, 0))
+               n = 0;
+               pid = -1;
+               if (posix_spawn(&pid, cmd[0], 0, &attr, cmd, 0))
+                       n = 2;
+               else
                {
+                       n = pid != -1 && waitpid(pid, &status, WNOHANG|WNOWAIT) 
== pid && ((status>>8)&0x7f) == 127;
                        wait(&status);
-                       _exit(1);
                }
-               _exit(0);
+               _exit(n);
        }
 }end
 
@@ -559,13 +573,13 @@
        _BEGIN_EXTERNS_
        #if _STD_
        extern long atol(const char*);
-       long strtol(const char* s, char** e) { return 0; }
+       long strtol(const char* s, char** e, int b) { return 0; }
        #else
        extern long atol();
-       long strtol(s, e) char* s; char** e; { return 0; }
+       long strtol(s, e, b) char* s; char** e; int b; { return 0; }
        #endif
        _END_EXTERNS_
-       int main() { printf(""); return (atol("1") + strtol("1",0)) != 0; }
+       int main() { printf(""); return (atol("1") + strtol("1",(char**)0,0)) 
!= 0; }
 }end
 
 tst    - output{
diff -r -N -u ksh93_2006_09_12/src/lib/libast/features/limits.c 
ksh93_2006_10_31/src/lib/libast/features/limits.c
--- ksh93_2006_09_12/src/lib/libast/features/limits.c   2005-05-24 
05:52:04.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/features/limits.c   2006-10-19 
23:16:47.000000000 +0200
@@ -49,25 +49,31 @@
  */
 
 #include "FEATURE/standards"
+#include "FEATURE/lib"
 
 #ifdef __sun
 #define _timespec      timespec
 #endif
 
-#include <stdio.h>
 #include <sys/types.h>
 
 #undef _SGIAPI
 #define _SGIAPI                1
 
-#include "FEATURE/limits.lcl"
+#if _hdr_limits
+#include <limits.h>
+#endif
 
 #undef _SGIAPI
 #define _SGIAPI                0
 
 #include "FEATURE/lib"
 #include "FEATURE/common"
-#include "FEATURE/unistd.lcl"
+
+#if _hdr_unistd
+#include <unistd.h>
+#endif
+
 #include "FEATURE/param"
 
 #if defined(__STDPP__directive) && defined(__STDPP__hide)
@@ -77,8 +83,6 @@
 #undef getdtablesize   
 #endif
 
-#include "conflib.h"
-
 int main()
 {
        char                    c;
@@ -97,23 +101,17 @@
         */
 
        printf("\n");
-#ifdef CHAR_BIT
-       val = CHAR_BIT;
-       printf("#undef  CHAR_BIT\n");
-#else
+#ifndef CHAR_BIT
        uc = 0;
        uc = ~uc;
        val = 1;
        while (uc >>= 1) val++;
-#endif
        printf("#define CHAR_BIT        %lu\n", val);
-#ifdef MB_LEN_MAX
-       val = MB_LEN_MAX;
-       printf("#undef  MB_LEN_MAX\n");
-#else
-       val = 1;
 #endif
+#ifndef MB_LEN_MAX
+       val = 1;
        printf("#define MB_LEN_MAX      %lu\n", val);
+#endif
 
        c = 0;
        c = ~c;
@@ -130,245 +128,191 @@
        ull = ~ull;
 #endif
 
-#ifdef UCHAR_MAX
-       val = UCHAR_MAX;
-       printf("#undef  UCHAR_MAX\n");
-#else
+#ifndef UCHAR_MAX
        val = uc;
-#endif
        printf("#if defined(__STDC__)\n");
        printf("#define UCHAR_MAX       %luU\n", val);
        printf("#else\n");
        printf("#define UCHAR_MAX       %lu\n", val);
        printf("#endif\n");
+#endif
 
-#ifdef SCHAR_MIN
-       val = -(unsigned long)(SCHAR_MIN);
-       printf("#undef  SCHAR_MIN\n");
-#else
+#ifndef SCHAR_MIN
        val = (unsigned char)(uc >> 1) + 1;
-#endif
        printf("#define SCHAR_MIN       (-%lu)\n", val);
+#endif
 
-#ifdef SCHAR_MAX
-       val = SCHAR_MAX;
-       printf("#undef  SCHAR_MAX\n");
-#else
+#ifndef SCHAR_MAX
        val = (unsigned char)(uc >> 1);
-#endif
        printf("#define SCHAR_MAX       %lu\n", val);
+#endif
 
        if (c < 0)
        {
-#ifdef CHAR_MIN
-               printf("#undef  CHAR_MIN\n");
-#endif
+#ifndef CHAR_MIN
                printf("#define CHAR_MIN        SCHAR_MIN\n");
-
-#ifdef CHAR_MAX
-               printf("#undef  CHAR_MAX\n");
 #endif
+
+#ifndef CHAR_MAX
                printf("#define CHAR_MAX        SCHAR_MAX\n");
+#endif
        }
        else
        {
-#ifdef CHAR_MIN
-               printf("#undef  CHAR_MIN\n");
-#endif
+#ifndef CHAR_MIN
                printf("#define CHAR_MIN        0\n");
-
-#ifdef CHAR_MAX
-               printf("#undef  CHAR_MAX\n");
 #endif
+
+#ifndef CHAR_MAX
                printf("#define CHAR_MAX        UCHAR_MAX\n");
+#endif
        }
 
-#ifdef USHRT_MAX
-       val = USHRT_MAX;
-       printf("#undef  USHRT_MAX\n");
-#else
+#ifndef USHRT_MAX
        val = us;
-#endif
        printf("#if defined(__STDC__)\n");
        printf("#define USHRT_MAX       %luU\n", val);
        printf("#else\n");
        printf("#define USHRT_MAX       %lu\n", val);
        printf("#endif\n");
+#endif
 
-#ifdef SHRT_MIN
-       val = -(unsigned long)(SHRT_MIN);
-       printf("#undef  SHRT_MIN\n");
-#else
+#ifndef SHRT_MIN
        val = (unsigned short)(us >> 1) + 1;
-#endif
        printf("#define SHRT_MIN        (-%lu)\n", val);
+#endif
 
-#ifdef SHRT_MAX
-       val = SHRT_MAX;
-       printf("#undef  SHRT_MAX\n");
-#else
+#ifndef SHRT_MAX
        val = (unsigned short)(us >> 1);
-#endif
        printf("#define SHRT_MAX        %lu\n", val);
+#endif
 
        if (ui == us)
        {
-#ifdef UINT_MAX
-               printf("#undef  UINT_MAX\n");
-#endif
+#ifndef UINT_MAX
                printf("#define UINT_MAX        USHRT_MAX\n");
-
-#ifdef INT_MIN
-               printf("#undef  INT_MIN\n");
 #endif
-               printf("#define INT_MIN         SHRT_MIN\n");
 
-#ifdef INT_MAX
-               printf("#undef  INT_MAX\n");
+#ifndef INT_MIN
+               printf("#define INT_MIN         SHRT_MIN\n");
 #endif
+
+#ifndef INT_MAX
                printf("#define INT_MAX         SHRT_MAX\n");
+#endif
        }
        else
        {
-#ifdef UINT_MAX
-               val = UINT_MAX;
-               printf("#undef  UINT_MAX\n");
-#else
+#ifndef UINT_MAX
                val = ui;
-#endif
                printf("#if defined(__STDC__)\n");
                printf("#define UINT_MAX        %luU\n", val);
                printf("#else\n");
                printf("#define UINT_MAX        %lu\n", val);
                printf("#endif\n");
+#endif
 
-#ifdef INT_MIN
-               val = -(unsigned long)(INT_MIN);
-               printf("#undef  INT_MIN\n");
-#else
+#ifndef INT_MIN
                val = (unsigned int)(ui >> 1) + 1;
-#endif
                if (ui == ul) printf("#define INT_MIN           (-%lu-1)\n", 
val - 1);
                else printf("#define INT_MIN            (-%lu)\n", val);
+#endif
 
-#ifdef INT_MAX
-               val = INT_MAX;
-               printf("#undef  INT_MAX\n");
-#else
+#ifndef INT_MAX
                val = (unsigned int)(ui >> 1);
-#endif
                printf("#define INT_MAX         %lu\n", val);
+#endif
        }
 
        if (ul == ui)
        {
-#ifdef ULONG_MAX
-               printf("#undef  ULONG_MAX\n");
-#endif
+#ifndef ULONG_MAX
                printf("#define ULONG_MAX       UINT_MAX\n");
-
-#ifdef LONG_MIN
-               printf("#undef  LONG_MIN\n");
 #endif
-               printf("#define LONG_MIN        INT_MIN\n");
 
-#ifdef LONG_MAX
-               printf("#undef  LONG_MAX\n");
+#ifndef LONG_MIN
+               printf("#define LONG_MIN        INT_MIN\n");
 #endif
+
+#ifndef LONG_MAX
                printf("#define LONG_MAX        INT_MAX\n");
+#endif
        }
        else
        {
-#ifdef ULONG_MAX
-               val = ULONG_MAX;
-               printf("#undef  ULONG_MAX\n");
-#else
+#ifndef ULONG_MAX
                val = ul;
-#endif
                printf("#if defined(__STDC__)\n");
                printf("#define ULONG_MAX       %luLU\n", val);
                printf("#else\n");
                printf("#define ULONG_MAX       %lu\n", val);
                printf("#endif\n");
+#endif
 
-#ifdef LONG_MIN
-               val = -(unsigned long)(LONG_MIN);
-               printf("#undef  LONG_MIN\n");
-#else
+#ifndef LONG_MIN
                val = (unsigned long)(ul >> 1) + 1;
-#endif
                printf("#define LONG_MIN        (-%luL-1L)\n", val - 1);
+#endif
 
-#ifdef LONG_MAX
-               val = LONG_MAX;
-               printf("#undef  LONG_MAX\n");
-#else
+#ifndef LONG_MAX
                val = (unsigned long)(ul >> 1);
-#endif
                printf("#define LONG_MAX        %luL\n", val);
+#endif
        }
 
-#ifdef _ast_int8_t
+#if defined(_ast_int8_t) && !_ast_intmax_long
        if (ull == ul)
        {
-#ifdef ULONGLONG_MAX
-               printf("#undef  ULONGLONG_MAX\n");
-#endif
+#ifndef ULONGLONG_MAX
                printf("#define ULONGLONG_MAX   ULONG_MAX\n");
-
-#ifdef LONGLONG_MIN
-               printf("#undef  LONGLONG_MIN\n");
 #endif
-               printf("#define LONGLONG_MIN    LONG_MIN\n");
 
-#ifdef LONGLONG_MAX
-               printf("#undef  LONGLONG_MAX\n");
+#ifndef LONGLONG_MIN
+               printf("#define LONGLONG_MIN    LONG_MIN\n");
 #endif
+
+#ifndef LONGLONG_MAX
                printf("#define LONGLONG_MAX    LONG_MAX\n");
+#endif
        }
        else
        {
-#ifdef ULONGLONG_MAX
-               vll = ULONGLONG_MAX;
-               printf("#undef  ULONGLONG_MAX\n");
-#else
+#ifndef ULONGLONG_MAX
                vll = ull;
-#endif
+               printf("#ifndef ULONGLONG_MAX\n");
                printf("#if defined(__STDC__) && _ast_LL\n");
                printf("#define ULONGLONG_MAX   %lluULL\n", vll);
                printf("#else\n");
                printf("#define ULONGLONG_MAX   %llu\n", vll);
                printf("#endif\n");
+               printf("#endif\n");
+#endif
 
-#ifdef LONGLONG_MIN
-               vll = -(unsigned _ast_int8_t)(LONGLONG_MIN);
-               printf("#undef  LONGLONG_MIN\n");
-#else
+#ifndef LONGLONG_MIN
                vll = (unsigned _ast_int8_t)(ull >> 1) + 1;
-#endif
+               printf("#ifndef LONGLONG_MIN\n");
                printf("#if defined(__STDC__) && _ast_LL\n");
                printf("#define LONGLONG_MIN    (-%lluLL-1LL)\n", vll - 1);
                printf("#else\n");
                printf("#define LONGLONG_MIN    (-%llu-1)\n", vll - 1);
                printf("#endif\n");
+               printf("#endif\n");
+#endif
 
-#ifdef LONGLONG_MAX
-               vll = LONGLONG_MAX;
-               printf("#undef  LONGLONG_MAX\n");
-#else
+#ifndef LONGLONG_MAX
                vll = (unsigned _ast_int8_t)(ull >> 1);
-#endif
+               printf("#ifndef LONGLONG_MAX\n");
                printf("#if defined(__STDC__) && _ast_LL\n");
                printf("#define LONGLONG_MAX    %lluLL\n", vll);
                printf("#else\n");
                printf("#define LONGLONG_MAX    %llu\n", vll);
                printf("#endif\n");
+               printf("#endif\n");
+#endif
        }
 #endif
 
        printf("\n");
-#include "conflim.h"
-       printf("\n");
 #ifdef _UWIN
        printf("#ifdef _UWIN\n");
        printf("#ifndef DBL_DIG\n");
@@ -387,81 +331,8 @@
        printf("\n");
 #endif
 
-       /*
-        * pollution control
-        */
+#include "conflim.h"
 
-       printf("/*\n");
-       printf(" * pollution control\n");
-       printf(" */\n");
-       printf("\n");
-       printf("#if defined(__STDPP__directive) && defined(__STDPP__ignore)\n");
-       printf("__STDPP__directive pragma pp:ignore \"limits.h\"\n");
-       printf("__STDPP__directive pragma pp:ignore \"bits/posix1_lim.h\"\n");
-       printf("#else\n");
-#ifdef _limits_h
-       printf("#define _limits_h\n");
-#endif
-#ifdef __limits_h
-       printf("#define __limits_h\n");
-#endif
-#ifdef _sys_limits_h
-       printf("#define _sys_limits_h\n");
-#endif
-#ifdef __sys_limits_h
-       printf("#define __sys_limits_h\n");
-#endif
-#ifdef _BITS_POSIX1_LIM_H
-       printf("#ifndef _BITS_POSIX1_LIM_H\n");
-       printf("#define _BITS_POSIX1_LIM_H\n");
-       printf("#endif\n");
-#endif
-#ifdef _LIMITS_H_
-       printf("#define _LIMITS_H_\n");
-#endif
-#ifdef _LIMITS_H__
-       printf("#define _LIMITS_H__\n");
-#endif
-#ifdef _LIMITS_H___
-       printf("#define _LIMITS_H___\n");
-#endif
-#ifdef __LIMITS_H
-       printf("#define __LIMITS_H\n");
-#endif
-#ifdef __LIMITS_INCLUDED
-       printf("#define __LIMITS_INCLUDED\n");
-#endif
-#ifdef _MACH_MACHLIMITS_H_
-       printf("#define _MACH_MACHLIMITS_H_\n");
-#endif
-#ifdef _MACHINE_LIMITS_H_
-       printf("#define _MACHINE_LIMITS_H_\n");
-#endif
-#ifdef _SYS_LIMITS_H_
-       printf("#define _SYS_LIMITS_H_\n");
-#endif
-#ifdef __SYS_LIMITS_H
-       printf("#define __SYS_LIMITS_H\n");
-#endif
-#ifdef __SYS_LIMITS_INCLUDED
-       printf("#define __SYS_LIMITS_INCLUDED\n");
-#endif
-#ifdef _SYS_SYSLIMITS_H_
-       printf("#define _SYS_SYSLIMITS_H_\n");
-#endif
-#ifdef _H_LIMITS
-       printf("#define _H_LIMITS\n");
-#endif
-#ifdef __H_LIMITS
-       printf("#define __H_LIMITS\n");
-#endif
-#ifdef _H_SYS_LIMITS
-       printf("#define _H_SYS_LIMITS\n");
-#endif
-#ifdef __H_SYS_LIMITS
-       printf("#define __H_SYS_LIMITS\n");
-#endif
-       printf("#endif\n");
        printf("\n");
 
        return 0;
diff -r -N -u ksh93_2006_09_12/src/lib/libast/features/map.c 
ksh93_2006_10_31/src/lib/libast/features/map.c
--- ksh93_2006_09_12/src/lib/libast/features/map.c      2006-07-19 
23:03:37.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/features/map.c      2006-10-26 
23:35:24.000000000 +0200
@@ -21,7 +21,12 @@
 ***********************************************************************/
 #pragma prototyped
 
-#include <stdio.h>
+/*
+ * some systems may pull in <ast_common.h> and its <ast_map.h>
+ * which we are in the process of generating ... this prevents it
+ */
+
+#define _def_map_ast   1
 
 #include "FEATURE/lib"
 #include "FEATURE/mmap"
@@ -30,6 +35,18 @@
 int
 main()
 {
+       printf("#pragma prototyped\n");
+       printf("\n");
+       printf("/*\n");
+       printf(" * prototypes provided for standard interfaces hijacked\n");
+       printf(" * by ast and mapped to _ast_* but already prototyped\n");
+       printf(" * unmapped in native headers included by <ast_std.h>\n");
+       printf(" */\n");
+       printf("\n");
+       printf("#if _BLD_ast && defined(__EXPORT__)\n");
+       printf("#define extern          __EXPORT__\n");
+       printf("#endif\n");
+       printf("\n");
 #if __MVS__
 #undef _map_libc
 #define _map_libc      1
@@ -43,155 +60,320 @@
 #define _map_malloc    1
        printf("\n");
        printf("#define _map_libc       1\n");
+       printf("#undef  basename\n");
        printf("#define basename        _ast_basename\n");
+       printf("#undef  dirname\n");
        printf("#define dirname         _ast_dirname\n");
+       printf("#undef  eaccess\n");
+       printf("#define eaccess         _ast_eaccess\n");
 #if !_lib_execvpe
+       printf("#undef  execvpe\n");
        printf("#define execvpe         _ast_execvpe\n");
+       printf("extern int              execvpe(const char*, char* const[], 
char* const[]);\n");
 #endif
+       printf("#undef  fnmatch\n");
        printf("#define fnmatch         _ast_fnmatch\n");
+       printf("#undef  fts_children\n");
        printf("#define fts_children    _ast_fts_children\n");
+       printf("#undef  fts_close\n");
        printf("#define fts_close       _ast_fts_close\n");
+       printf("#undef  fts_flags\n");
        printf("#define fts_flags       _ast_fts_flags\n");
+       printf("#undef  fts_notify\n");
        printf("#define fts_notify      _ast_fts_notify\n");
+       printf("#undef  fts_open\n");
        printf("#define fts_open        _ast_fts_open\n");
+       printf("#undef  fts_read\n");
        printf("#define fts_read        _ast_fts_read\n");
+       printf("#undef  fts_set\n");
        printf("#define fts_set         _ast_fts_set\n");
+       printf("#undef  ftw\n");
        printf("#define ftw             _ast_ftw\n");
+       printf("#undef  ftwalk\n");
        printf("#define ftwalk          _ast_ftwalk\n");
+       printf("#undef  ftwflags\n");
        printf("#define ftwflags        _ast_ftwflags\n");
 #if !_WINIX
+       printf("#undef  getcwd\n");
        printf("#define getcwd          _ast_getcwd\n");
+       printf("extern char*            getcwd(char*, size_t);\n");
 #endif
+       printf("#undef  getdate\n");
        printf("#define getdate         _ast_getdate\n");
-#if !_lib_getopt
+#if _lib_getopt || _lib_getsubopt || _lib_getopt_long || _lib_getopt_long_only
+       printf("#undef  getopt\n");
        printf("#define getopt          _ast_getopt\n");
-#endif
-#if !_lib_getsubopt
+       printf("#undef  getsubopt\n");
        printf("#define getsubopt       _ast_getsubopt\n");
+       printf("#undef  getopt_long\n");
+       printf("#define getopt_long     _ast_getopt_long\n");
+       printf("#undef  getopt_long_only\n");
+       printf("#define getopt_long_only _ast_getopt_long_only\n");
 #endif
+       printf("#undef  getwd\n");
        printf("#define getwd           _ast_getwd\n");
+       printf("extern char*            getwd(char*);\n");
+       printf("#undef  glob\n");
        printf("#define glob            _ast_glob\n");
+       printf("#undef  globfree\n");
        printf("#define globfree        _ast_globfree\n");
+       printf("#undef  memdup\n");
        printf("#define memdup          _ast_memdup\n");
+       printf("#undef  memfatal\n");
        printf("#define memfatal        _ast_memfatal\n");
+       printf("#undef  memhash\n");
        printf("#define memhash         _ast_memhash\n");
+       printf("#undef  memsum\n");
+       printf("#define memsum          _ast_memsum\n");
+       printf("#undef  mkstemp\n");
        printf("#define mkstemp         _ast_mkstemp\n");
+       printf("extern int              mkstemp(char*);\n");
+       printf("#undef  mktemp\n");
        printf("#define mktemp          _ast_mktemp\n");
+       printf("extern char*            mktemp(char*);\n");
+       printf("#undef  mktime\n");
        printf("#define mktime          _ast_mktime\n");
+       printf("#undef  nftw\n");
        printf("#define nftw            _ast_nftw\n");
+       printf("#undef  optesc\n");
        printf("#define optesc          _ast_optesc\n");
+       printf("#undef  optget\n");
        printf("#define optget          _ast_optget\n");
+       printf("#undef  opthelp\n");
        printf("#define opthelp         _ast_opthelp\n");
+       printf("#undef  optjoin\n");
        printf("#define optjoin         _ast_optjoin\n");
+       printf("#undef  optstr\n");
        printf("#define optstr          _ast_optstr\n");
+       printf("#undef  optusage\n");
        printf("#define optusage        _ast_optusage\n");
+       printf("#undef  pathaccess\n");
        printf("#define pathaccess      _ast_pathaccess\n");
+       printf("#undef  pathbin\n");
        printf("#define pathbin         _ast_pathbin\n");
+       printf("#undef  pathcanon\n");
        printf("#define pathcanon       _ast_pathcanon\n");
+       printf("#undef  pathcat\n");
        printf("#define pathcat         _ast_pathcat\n");
+       printf("#undef  pathcd\n");
        printf("#define pathcd          _ast_pathcd\n");
+       printf("#undef  pathcheck\n");
        printf("#define pathcheck       _ast_pathcheck\n");
+       printf("#undef  pathexists\n");
        printf("#define pathexists      _ast_pathexists\n");
+       printf("#undef  pathfind\n");
        printf("#define pathfind        _ast_pathfind\n");
+       printf("#undef  pathgetlink\n");
        printf("#define pathgetlink     _ast_pathgetlink\n");
+       printf("#undef  pathinclude\n");
        printf("#define pathinclude     _ast_pathinclude\n");
+       printf("#undef  pathkey\n");
        printf("#define pathkey         _ast_pathkey\n");
+       printf("#undef  pathnative\n");
        printf("#define pathnative      _ast_pathnative\n");
+       printf("#undef  pathpath\n");
        printf("#define pathpath        _ast_pathpath\n");
+       printf("#undef  pathposix\n");
        printf("#define pathposix       _ast_pathposix\n");
+       printf("#undef  pathprobe\n");
        printf("#define pathprobe       _ast_pathprobe\n");
+       printf("#undef  pathrepl\n");
        printf("#define pathrepl        _ast_pathrepl\n");
+       printf("#undef  pathsetlink\n");
        printf("#define pathsetlink     _ast_pathsetlink\n");
+       printf("#undef  pathshell\n");
        printf("#define pathshell       _ast_pathshell\n");
+       printf("#undef  pathstat\n");
        printf("#define pathstat        _ast_pathstat\n");
+       printf("#undef  pathtemp\n");
        printf("#define pathtemp        _ast_pathtemp\n");
+       printf("#undef  pathtmp\n");
        printf("#define pathtmp         _ast_pathtmp\n");
+       printf("#undef  procclose\n");
        printf("#define procclose       _ast_procclose\n");
+       printf("#undef  procfree\n");
        printf("#define procfree        _ast_procfree\n");
+       printf("#undef  procopen\n");
        printf("#define procopen        _ast_procopen\n");
+       printf("#undef  procrun\n");
        printf("#define procrun         _ast_procrun\n");
+       printf("#undef  putenv\n");
        printf("#define putenv          _ast_putenv\n");
+       printf("#undef  re_comp\n");
        printf("#define re_comp         _ast_re_comp\n");
+       printf("#undef  re_exec\n");
        printf("#define re_exec         _ast_re_exec\n");
+       printf("#undef  realpath\n");
        printf("#define realpath        _ast_realpath\n");
+       printf("extern char*            realpath(const char*, char*);\n");
+       printf("#undef  regaddclass\n");
        printf("#define regaddclass     _ast_regaddclass\n");
+       printf("#undef  regalloc\n");
        printf("#define regalloc        _ast_regalloc\n");
+       printf("#undef  regcache\n");
        printf("#define regcache        _ast_regcache\n");
+       printf("#undef  regclass\n");
        printf("#define regclass        _ast_regclass\n");
+       printf("#undef  regcmp\n");
        printf("#define regcmp          _ast_regcmp\n");
+       printf("#undef  regcollate\n");
        printf("#define regcollate      _ast_regcollate\n");
+       printf("#undef  regcomb\n");
        printf("#define regcomb         _ast_regcomb\n");
+       printf("#undef  regcomp\n");
        printf("#define regcomp         _ast_regcomp\n");
+       printf("#undef  regdup\n");
        printf("#define regdup          _ast_regdup\n");
+       printf("#undef  regerror\n");
        printf("#define regerror        _ast_regerror\n");
+       printf("#undef  regex\n");
        printf("#define regex           _ast_regex\n");
+       printf("#undef  regexec\n");
        printf("#define regexec         _ast_regexec\n");
+       printf("#undef  regfatal\n");
        printf("#define regfatal        _ast_regfatal\n");
+       printf("#undef  regfatalpat\n");
        printf("#define regfatalpat     _ast_regfatalpat\n");
+       printf("#undef  regfree\n");
        printf("#define regfree         _ast_regfree\n");
+       printf("#undef  regncomp\n");
        printf("#define regncomp        _ast_regncomp\n");
+       printf("#undef  regnexec\n");
        printf("#define regnexec        _ast_regnexec\n");
+       printf("#undef  regrecord\n");
        printf("#define regrecord       _ast_regrecord\n");
+       printf("#undef  regrexec\n");
        printf("#define regrexec        _ast_regrexec\n");
+       printf("#undef  regstat\n");
        printf("#define regstat         _ast_regstat\n");
+       printf("#undef  regsub\n");
        printf("#define regsub          _ast_regsub\n");
+       printf("#undef  regsubcomp\n");
        printf("#define regsubcomp      _ast_regsubcomp\n");
+       printf("#undef  regsubexec\n");
        printf("#define regsubexec      _ast_regsubexec\n");
+       printf("#undef  regsubflags\n");
        printf("#define regsubflags     _ast_regsubflags\n");
+       printf("#undef  regsubfree\n");
        printf("#define regsubfree      _ast_regsubfree\n");
+       printf("#undef  remove\n");
+       printf("#define remove          _ast_remove\n");
+       printf("extern int              remove(const char*);\n");
+       printf("#undef  resolvepath\n");
        printf("#define resolvepath     _ast_resolvepath\n");
+       printf("extern char*            resolvepath(const char*, char*, 
size_t);\n");
+       printf("#undef  setenv\n");
+       printf("#define setenv          _ast_setenv\n");
+       printf("extern int              setenv(const char*, const char*, 
int);\n");
+       printf("#undef  setenviron\n");
        printf("#define setenviron      _ast_setenviron\n");
+       printf("#undef  sigcritical\n");
+       printf("#define sigcritical      _ast_sigcritical\n");
+       printf("#undef  signal\n");
+       printf("#define signal          _ast_signal\n");
+       printf("#undef  sigunblock\n");
+       printf("#define sigunblock      _ast_sigunblock\n");
+       printf("#undef  stracmp\n");
        printf("#define stracmp         _ast_stracmp\n");
+       printf("#undef  strcopy\n");
        printf("#define strcopy         _ast_strcopy\n");
+       printf("#undef  strelapsed\n");
        printf("#define strelapsed      _ast_strelapsed\n");
+       printf("#undef  stresc\n");
        printf("#define stresc          _ast_stresc\n");
+       printf("#undef  streval\n");
        printf("#define streval         _ast_streval\n");
+       printf("#undef  strexpr\n");
        printf("#define strexpr         _ast_strexpr\n");
+       printf("#undef  strftime\n");
        printf("#define strftime        _ast_strftime\n");
+       printf("#undef  strgid\n");
        printf("#define strgid          _ast_strgid\n");
+       printf("#undef  strgrpmatch\n");
        printf("#define strgrpmatch     _ast_strgrpmatch\n");
+       printf("#undef  strhash\n");
+       printf("#define strhash         _ast_strhash\n");
+       printf("#undef  strkey\n");
        printf("#define strkey          _ast_strkey\n");
+       printf("#undef  strlcat\n");
        printf("#define strlcat         _ast_strlcat\n");
+       printf("extern size_t           strlcat(char*, const char*, 
size_t);\n");
+       printf("#undef  strlcpy\n");
        printf("#define strlcpy         _ast_strlcpy\n");
+       printf("extern size_t           strlcpy(char*, const char*, 
size_t);\n");
+       printf("#undef  strlook\n");
        printf("#define strlook         _ast_strlook\n");
+       printf("#undef  strmatch\n");
        printf("#define strmatch        _ast_strmatch\n");
+#endif
+#if _map_libc || _lib_strmode
+       printf("#undef  strmode\n");
        printf("#define strmode         _ast_strmode\n");
+#endif
+#if _map_libc
+       printf("#undef  strnacmp\n");
        printf("#define strnacmp        _ast_strnacmp\n");
+       printf("#undef  strncopy\n");
        printf("#define strncopy        _ast_strncopy\n");
+       printf("#undef  strntod\n");
        printf("#define strntod         _ast_strntod\n");
+       printf("#undef  strntol\n");
        printf("#define strntol         _ast_strntol\n");
+       printf("#undef  strntold\n");
        printf("#define strntold        _ast_strntold\n");
+       printf("#undef  strntoll\n");
        printf("#define strntoll        _ast_strntoll\n");
+       printf("#undef  strntoul\n");
+       printf("#define strntoul        _ast_strntoul\n");
+       printf("#undef  strntoull\n");
+       printf("#define strntoull       _ast_strntoull\n");
+       printf("#undef  stropt\n");
        printf("#define stropt          _ast_stropt\n");
+       printf("#undef  strperm\n");
        printf("#define strperm         _ast_strperm\n");
+       printf("#undef  strpsearch\n");
        printf("#define strpsearch      _ast_strpsearch\n");
 #if !_lib_strptime
+       printf("#undef  strptime\n");
        printf("#define strptime        _ast_strptime\n");
 #endif
+       printf("#undef  strsearch\n");
        printf("#define strsearch       _ast_strsearch\n");
+       printf("#undef  strsort\n");
        printf("#define strsort         _ast_strsort\n");
+       printf("#undef  strsubmatch\n");
        printf("#define strsubmatch     _ast_strsubmatch\n");
+       printf("#undef  strsum\n");
        printf("#define strsum          _ast_strsum\n");
+       printf("#undef  strtape\n");
        printf("#define strtape         _ast_strtape\n");
-       printf("#define strtod          _ast_strtod\n");
+       printf("#undef  strtoip4\n");
        printf("#define strtoip4        _ast_strtoip4\n");
-       printf("#define strtold         _ast_strtold\n");
+       printf("#undef  strton\n");
        printf("#define strton          _ast_strton\n");
+       printf("#undef  strtonll\n");
        printf("#define strtonll        _ast_strtonll\n");
+       printf("#undef  struid\n");
        printf("#define struid          _ast_struid\n");
+       printf("#undef  struniq\n");
        printf("#define struniq         _ast_struniq\n");
-#if !__CYGWIN__
-       printf("#define strtol          _ast_strtol\n");
-       printf("#define strtoul         _ast_strtoul\n");
-#endif
-       printf("#define strtoll         _ast_strtoll\n");
-       printf("#define strtoull        _ast_strtoull\n");
+       printf("#undef  system\n");
        printf("#define system          _ast_system\n");
+       printf("extern int              system(const char*);\n");
+       printf("#undef  tempnam\n");
        printf("#define tempnam         _ast_tempnam\n");
+       printf("extern char*            tempnam(const char*, const char*);\n");
+       printf("#undef  tmpnam\n");
        printf("#define tmpnam          _ast_tmpnam\n");
+       printf("extern char*            tmpnam(char*);\n");
+       printf("#undef  touch\n");
        printf("#define touch           _ast_touch\n");
+       printf("#undef  wordexp\n");
        printf("#define wordexp         _ast_wordexp\n");
+       printf("#undef  wordfree\n");
        printf("#define wordfree        _ast_wordfree\n");
+       printf("#undef  unsetenv\n");
+       printf("#define unsetenv        _ast_unsetenv\n");
 #endif
 #if _std_malloc
        printf("\n");
@@ -204,16 +386,20 @@
        printf("#define _map_malloc     1\n");
        printf("#undef  calloc\n");
        printf("#define calloc          _ast_calloc\n");
+       printf("extern void*            calloc(size_t, size_t);\n");
        printf("#undef  cfree\n");
        printf("#define cfree           _ast_cfree\n");
+       printf("extern void             cfree(void*);\n");
        printf("#undef  free\n");
        printf("#define free            _ast_free\n");
+       printf("extern void             free(void*);\n");
 #if _lib_mallinfo
        printf("#undef  mallinfo\n");
        printf("#define mallinfo        _ast_mallinfo\n");
 #endif
        printf("#undef  malloc\n");
        printf("#define malloc          _ast_malloc\n");
+       printf("extern void*            malloc(size_t);\n");
 #if _lib_mallopt
        printf("#undef  mallopt\n");
        printf("#define mallopt         _ast_mallopt\n");
@@ -221,6 +407,7 @@
 #if _lib_memalign
        printf("#undef  memalign\n");
        printf("#define memalign        _ast_memalign\n");
+       printf("extern void*            memalign(size_t, size_t);\n");
 #endif
 #if _lib_mstats
        printf("#undef  mstats\n");
@@ -232,13 +419,101 @@
 #endif
        printf("#undef  realloc\n");
        printf("#define realloc         _ast_realloc\n");
+       printf("extern void*            realloc(void*, size_t);\n");
        printf("#undef  strdup\n");
        printf("#define strdup          _ast_strdup\n");
+       printf("extern char*            strdup(const char*);\n");
 #if _lib_valloc
        printf("#undef  valloc\n");
        printf("#define valloc          _ast_valloc\n");
+       printf("extern void*            valloc(size_t);\n");
 #endif
 #endif
 #endif
+
+       /*
+        * overriding <stdlib.h> strto*() is problematic to say the least
+        */
+
+#if _map_libc || _std_strtol
+#if !__CYGWIN__
+       printf("#undef  strtol\n");
+       printf("#define strtol          _ast_strtol\n");
+       printf("#undef  strtoul\n");
+       printf("#define strtoul         _ast_strtoul\n");
+#endif
+       printf("#undef  strtoll\n");
+       printf("#define strtoll         _ast_strtoll\n");
+       printf("#undef  strtoull\n");
+       printf("#define strtoull        _ast_strtoull\n");
+#endif
+#if _map_libc || _std_strtod
+       printf("#undef  strtod\n");
+       printf("#define strtod          _ast_strtod\n");
+       printf("#undef  strtold\n");
+       printf("#define strtold         _ast_strtold\n");
+#endif
+#if !__CYGWIN__
+#if _npt_strtol || _map_libc || _std_strtol
+#if _npt_strtol && !_map_libc && !_std_strtol
+       printf("#ifndef _ISOC99_SOURCE\n");
+#endif
+       printf("extern long             strtol(const char*, char**, int);\n");
+#if _npt_strtol && !_map_libc && !_std_strtol
+       printf("#endif\n");
+#endif
+#endif
+#if _npt_strtoul || _map_libc || _std_strtol
+#if _npt_strtoul && !_map_libc && !_std_strtol
+       printf("#ifndef _ISOC99_SOURCE\n");
+#endif
+       printf("extern unsigned long    strtoul(const char*, char**, int);\n");
+#if _npt_strtoul && !_map_libc && !_std_strtol
+       printf("#endif\n");
+#endif
+#endif
+#endif
+#if _npt_strtod || _map_libc || _std_strtod
+#if _npt_strtod && !_map_libc && !_std_strtod
+       printf("#ifndef _ISOC99_SOURCE\n");
+#endif
+       printf("extern double           strtod(const char*, char**);\n");
+#if _npt_strtod && !_map_libc && !_std_strtod
+       printf("#endif\n");
+#endif
+#endif
+       printf("#if !_UWIN\n");
+       printf("#undef  extern\n");
+       printf("#endif\n");
+#if _npt_strtold || _map_libc || _std_strtod
+#if _npt_strtold && !_map_libc && !_std_strtod
+       printf("#ifndef _ISOC99_SOURCE\n");
+#endif
+       printf("extern _ast_fltmax_t    strtold(const char*, char**);\n");
+#if _npt_strtold && !_map_libc && !_std_strtod
+       printf("#endif\n");
+#endif
+#endif
+       printf("#undef  extern\n");
+#if _npt_strtoll || _map_libc || _std_strtol
+#if _npt_strtoll && !_map_libc && !_std_strtol
+       printf("#ifndef _ISOC99_SOURCE\n");
+#endif
+       printf("extern _ast_intmax_t            strtoll(const char*, char**, 
int);\n");
+#if _npt_strtoll && !_map_libc && !_std_strtol
+       printf("#endif\n");
+#endif
+#endif
+#if _npt_strtoull || _map_libc || _std_strtol
+#if _npt_strtoull && !_map_libc && !_std_strtol
+       printf("#ifndef _ISOC99_SOURCE\n");
+#endif
+       printf("extern unsigned _ast_intmax_t   strtoull(const char*, char**, 
int);\n");
+#if _npt_strtoull && !_map_libc && !_std_strtoul
+       printf("#endif\n");
+#endif
+#endif
+       printf("\n");
+       printf("#undef  extern\n");
        return 0;
 }
diff -r -N -u ksh93_2006_09_12/src/lib/libast/features/mmap 
ksh93_2006_10_31/src/lib/libast/features/mmap
--- ksh93_2006_09_12/src/lib/libast/features/mmap       2005-07-28 
00:17:06.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/features/mmap       2006-09-21 
19:03:00.000000000 +0200
@@ -1,3 +1,5 @@
+ref    -D_def_map_ast=1
+
 sys    mman
 
 tst    lib_mmap note{ standard mmap interface that works }end execute{
diff -r -N -u ksh93_2006_09_12/src/lib/libast/features/mode.c 
ksh93_2006_10_31/src/lib/libast/features/mode.c
--- ksh93_2006_09_12/src/lib/libast/features/mode.c     2005-05-24 
09:54:34.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/features/mode.c     2006-09-28 
20:16:42.000000000 +0200
@@ -27,8 +27,6 @@
  * generate mode features
  */
 
-#include <stdio.h>
-
 #include "limits.h"
 
 #include "FEATURE/param"
diff -r -N -u ksh93_2006_09_12/src/lib/libast/features/sfinit.c 
ksh93_2006_10_31/src/lib/libast/features/sfinit.c
--- ksh93_2006_09_12/src/lib/libast/features/sfinit.c   2005-06-03 
07:35:01.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/features/sfinit.c   2006-09-28 
20:16:45.000000000 +0200
@@ -23,8 +23,6 @@
  * generate sfio _Sftable static initializers
  */
 
-#include <stdio.h>
-
 #include "FEATURE/common"
 #include "FEATURE/float"
 
diff -r -N -u ksh93_2006_09_12/src/lib/libast/features/sfio 
ksh93_2006_10_31/src/lib/libast/features/sfio
--- ksh93_2006_09_12/src/lib/libast/features/sfio       2005-06-03 
07:35:33.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/features/sfio       2006-09-28 
20:16:53.000000000 +0200
@@ -1,10 +1,10 @@
+ref    -D_def_map_ast=1
 hdr    float,floatingpoint,math,values
 sys    filio,ioctl
 lib    qfrexp,qldexp
 key    signed
 
 tst    tmp_rmfail note{ open files cannot be removed }end execute{
-       #include <stdio.h>
        #include <string.h>
        #include <time.h>
        int
@@ -116,7 +116,6 @@
 }end
 
 tst    xopen_stdio note{ Stdio fseek/fflush are X/Open-compliant }end execute{
-       #include <stdio.h>
        #define Failed(file)    (unlink(file),1)
        int
        main(argc, argv)
diff -r -N -u ksh93_2006_09_12/src/lib/libast/features/signal.c 
ksh93_2006_10_31/src/lib/libast/features/signal.c
--- ksh93_2006_09_12/src/lib/libast/features/signal.c   2005-05-24 
05:52:39.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/features/signal.c   2006-09-28 
20:16:56.000000000 +0200
@@ -27,7 +27,6 @@
  * generate signal features
  */
 
-#include <stdio.h>
 #include <signal.h>
 
 struct _m_
diff -r -N -u ksh93_2006_09_12/src/lib/libast/features/standards 
ksh93_2006_10_31/src/lib/libast/features/standards
--- ksh93_2006_09_12/src/lib/libast/features/standards  2004-08-13 
05:12:24.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/features/standards  2006-10-23 
20:18:45.000000000 +0200
@@ -1,4 +1,34 @@
-if tst note{ _POSIX_SOURCE & _XOPEN_SOURCE & __EXTENSIONS__ works }end compile{
+if tst note{ _ISOC99_SOURCE & _POSIX_SOURCE & _POSIX_C_SOURCE & _XOPEN_SOURCE 
& __EXTENSIONS__ works }end compile{
+               #define _ISOC99_SOURCE  1
+               #define _POSIX_SOURCE   1
+               #define _POSIX_C_SOURCE 21000101L
+               #define _XOPEN_SOURCE   9900
+               #define _GNU_SOURCE     1
+               #define __EXTENSIONS__  1
+               #include <sys/types.h>
+               #include <sys/stat.h>
+               #include <stdlib.h>
+       }end {
+               #ifndef _ISOC99_SOURCE
+               #define _ISOC99_SOURCE  1
+               #endif
+               #ifndef _POSIX_SOURCE
+               #define _POSIX_SOURCE   1
+               #endif
+               #ifndef _POSIX_C_SOURCE
+               #define _POSIX_C_SOURCE 21000101L
+               #endif
+               #ifndef _XOPEN_SOURCE
+               #define _XOPEN_SOURCE   9900
+               #endif
+               #ifndef _GNU_SOURCE
+               #define _GNU_SOURCE     1
+               #endif
+               #ifndef __EXTENSIONS__
+               #define __EXTENSIONS__  1
+               #endif
+       }
+elif tst note{ _POSIX_SOURCE & _XOPEN_SOURCE & __EXTENSIONS__ works }end 
compile{
                #define _POSIX_SOURCE   1
                #define _XOPEN_SOURCE   1
                #define __EXTENSIONS__  1
diff -r -N -u ksh93_2006_09_12/src/lib/libast/features/stdio 
ksh93_2006_10_31/src/lib/libast/features/stdio
--- ksh93_2006_09_12/src/lib/libast/features/stdio      2005-06-07 
10:56:25.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/features/stdio      2006-10-04 
19:36:17.000000000 +0200
@@ -1,4 +1,5 @@
 set    prototyped
+ref    -D_def_map_ast=1
 iff    SFSTDIO
 cat{
        #define __FILE_typedef  1
@@ -49,7 +50,7 @@
        #define SEEK_END        2
        #endif
 
-       #include <ast_common.h>
+       #include <ast_std.h>
 
        #include <sfio_s.h>
 
@@ -275,6 +276,7 @@
                printf("#define rewind          _ast_rewind\n");
                printf("#define scanf           _ast_scanf\n");
                printf("#define setbuf          _ast_setbuf\n");
+               printf("#undef  setbuffer\n");
                printf("#define setbuffer       _ast_setbuffer\n");
                printf("#define setlinebuf      _ast_setlinebuf\n");
                printf("#define setvbuf         _ast_setvbuf\n");
@@ -320,7 +322,6 @@
        }
 }end
 macro{
-       #include <stdio.h>
        <<"#if defined(__STDPP__directive) && defined(__STDPP__initial)">>
        <<"__STDPP__directive pragma pp:initial">>
        <<"#endif">>
diff -r -N -u ksh93_2006_09_12/src/lib/libast/features/sys 
ksh93_2006_10_31/src/lib/libast/features/sys
--- ksh93_2006_09_12/src/lib/libast/features/sys        1970-01-01 
01:00:00.000000000 +0100
+++ ksh93_2006_10_31/src/lib/libast/features/sys        2006-10-26 
19:58:15.000000000 +0200
@@ -0,0 +1,271 @@
+set    prototyped
+iff    AST_SYS
+ref    -D_def_map_ast
+
+print  #if __mips == 2 && !defined(_NO_LARGEFILE64_SOURCE)
+print  #define _NO_LARGEFILE64_SOURCE  1
+print  #endif
+print  #if !defined(_NO_LARGEFILE64_SOURCE) && _typ_off64_t && _lib_lseek64 && 
_lib_stat64
+print  #if !defined(_LARGEFILE64_SOURCE)
+print  #define _LARGEFILE64_SOURCE     1
+print  #endif
+print  #if !defined(_LARGEFILE_SOURCE)
+print  #define _LARGEFILE_SOURCE       1
+print  #endif
+print  #else
+print  #undef  _LARGEFILE64_SOURCE
+print  #undef  _LARGEFILE_SOURCE
+print  #undef  _typ_off64_t
+print  #undef  _typ_struct_dirent64
+print  #undef  _lib_creat64
+print  #undef  _lib_fstat64
+print  #undef  _lib_fstatvfs64
+print  #undef  _lib_ftruncate64
+print  #undef  _lib_lseek64
+print  #undef  _lib_lstat64
+print  #undef  _lib_mmap64
+print  #undef  _lib_open64
+print  #undef  _lib_readdir64
+print  #undef  _lib_stat64
+print  #undef  _lib_statvfs64
+print  #undef  _lib_truncate64
+print  #endif
+
+print  #if defined(__STDC__) && !defined(__USE_FIXED_PROTOTYPES__)
+print  #define __USE_FIXED_PROTOTYPES__        1       /* kick gcc out of the 
past */
+print  #endif
+
+header stdlib.h
+header stddef.h
+header sys/types.h
+header string.h
+header unistd.h
+header limits.h
+header fcntl.h
+header locale.h
+header sys/localedef.h
+
+typ dev_t,nlink_t fail{
+       echo "#ifndef $m"
+       echo "#define $m        1"
+       echo "typedef short $v;"
+       echo "#endif"
+}end
+typ gid_t,mode_t,uid_t fail{
+       echo "#ifndef $m"
+       echo "#define $m        1"
+       echo "typedef unsigned short $v;"
+       echo "#endif"
+}end
+typ wchar_t stdio.h wchar.h fail{
+       echo "#ifndef $m"
+       echo "#define $m        1"
+       echo "typedef unsigned short $v;"
+       echo "#endif"
+}end
+typ pid_t,ssize_t fail{
+       echo "#ifndef $m"
+       echo "#define $m        1"
+       echo "typedef int $v;"
+       echo "#endif"
+}end
+typ wint_t stdio.h wchar.h fail{
+       echo "#ifndef $m"
+       echo "#define $m        1"
+       echo "typedef int $v;"
+       echo "#endif"
+}end
+typ socklen_t sys/socket.h fail{
+       echo "#ifndef $m"
+       echo "#define $m        1"
+       echo "typedef int $v;"
+       echo "#endif"
+}end
+typ size_t fail{
+       echo "#ifndef $m"
+       echo "#define $m        1"
+       echo "typedef unsigned int $v;"
+       echo "#endif"
+}end
+typ clock_t,ino_t,off_t,ptrdiff_t fail{
+       echo "#ifndef $m"
+       echo "#define $m        1"
+       echo "typedef long $v;"
+       echo "#endif"
+}end
+typ time_t fail{
+       echo "#ifndef $m"
+       echo "#define $m        1"
+       echo "typedef unsigned long $v;"
+       echo "#endif"
+}end
+typ div_t fail{
+       echo "#ifndef $m"
+       echo "#define $m        1"
+       echo "typedef struct { int quot; int rem; } $v;"
+       echo "#endif"
+}end
+typ ldiv_t fail{
+       echo "#ifndef $m"
+       echo "#define $m        1"
+       echo "typedef struct { long quot; long rem; } $v;"
+       echo "#endif"
+}end
+tst    typ_signed_size_t output{
+       #include <sys/types.h>
+       int
+       main()
+       {
+               unsigned long u = ~0;
+               size_t s = ~0;
+               if (s >= 0)
+                       return 1;
+               printf("#if !defined(__cplusplus) && !defined(c_plusplus) && 
!defined(_typ_signed_size_t)\n/* what dipsticks made size_t signed? sun. 
*/\ntypedef unsigned %s _ast_size_t;\n#undef\tsize_t\n#define 
size_t\t_ast_size_t\n#endif\n", u == (unsigned long)s ? "long" : "int");
+               return 0;
+       }
+}end
+
+define offsetof        (type,member)   ((size_t)&(((type*)0)->member))
+define EXIT_FAILURE    1
+define EXIT_SUCCESS    0
+define MB_CUR_MAX      1
+define RAND_MAX        32767
+
+define STDIN_FILENO    0
+define STDOUT_FILENO   1
+define STDERR_FILENO   2
+
+define NULL            0
+
+define SEEK_SET        0
+define SEEK_CUR        1
+define SEEK_END        2
+
+define F_OK            0
+define X_OK            1
+define W_OK            2
+define R_OK            4
+
+print  #if _BLD_ast && defined(__EXPORT__)
+print  #define extern  __EXPORT__
+print  #endif
+
+extern _exit           void            (int)
+extern abort           void            (void)
+extern abs             int             (int)
+extern access          int             (const char*, int)
+extern alarm           unsigned        (unsigned)
+extern atexit          int             (void(*)(void))
+extern atof            double          (const char*)
+extern atoi            int             (const char*)
+extern atol            long            (const char*)
+extern bsearch         void*           (const void*, const void*, size_t, 
size_t, int(*)(const void*, const void*))
+extern calloc          void*           (size_t, size_t)
+extern cfree           void            (void*)
+extern chdir           int             (const char*)
+extern chown           int             (const char*, uid_t, gid_t)
+extern close           int             (int)
+extern confstr         size_t          (int, char*, size_t)
+extern div             div_t           (int, int)
+extern dup             int             (int)
+extern dup2            int             (int, int)
+extern eaccess         int             (const char*, int)
+extern execl           int             (const char*, const char*, ...)
+extern execle          int             (const char*, const char*, ...)
+extern execlp          int             (const char*, const char*, ...)
+extern execv           int             (const char*, char* const[])
+extern execve          int             (const char*, char* const[], char* 
const[])
+extern execve          int             (const char*, char* const[], char* 
const[])
+extern execvp          int             (const char*, char* const[])
+extern execvpe         int             (const char*, char* const[], char* 
const[])
+extern exit            void            (int)
+extern fork            pid_t           (void)
+extern fpathconf       long            (int, int)
+extern free            void            (void*)
+extern fsync           int             (int)
+extern ftruncate       int             (int, off_t)
+extern getcwd          char*           (char*, size_t)
+extern getegid         gid_t           (void)
+extern getenv          char*           (const char*)
+extern geteuid         uid_t           (void)
+extern getgid          gid_t           (void)
+extern getgroups       int             (int, gid_t[])
+extern getlogin        char*           (void)
+extern getpgrp         pid_t           (void)
+extern getpid          pid_t           (void)
+extern getppid         pid_t           (void)
+extern gettxt          char*           (const char*, const char*)
+extern getuid          uid_t           (void)
+extern isatty          int             (int)
+extern labs            long            (long)
+extern ldiv            ldiv_t          (long, long)
+extern link            int             (const char*, const char*)
+extern lseek           off_t           (int, off_t, int)
+extern malloc          void*           (size_t)
+extern mblen           int             (const char*, size_t)
+extern mbstowcs        size_t          (wchar_t*, const char*, size_t)
+extern mbtowc          int             (wchar_t*, const char*, size_t)
+extern memalign        void*           (size_t, size_t)
+extern memccpy         void*           (void*, const void*, int, size_t)
+extern memchr          void*           (const void*, int, size_t)
+extern memcmp          int             (const void*, const void*, size_t)
+extern memcpy          void*           (void*, const void*, size_t)
+extern memmove         void*           (void*, const void*, size_t)
+extern memset          void*           (void*, int, size_t)
+extern pathconf        long            (const char*, int)
+extern pause           int             (void)
+extern pipe            int             (int[])
+extern pvalloc         void*           (size_t)
+extern qsort           void            (void*, size_t, size_t, int(*)(const 
void*, const void*))
+extern rand            int             (void)
+extern read            ssize_t         (int, void*, size_t)
+extern realloc         void*           (void*, size_t)
+extern realpath        char*           (const char*, char*)
+extern resolvepath     char*           (const char*, char*, size_t)
+extern rmdir           int             (const char*)
+extern setgid          int             (gid_t)
+extern setpgid         int             (pid_t, pid_t)
+extern setsid          pid_t           (void)
+extern setuid          int             (uid_t)
+extern sleep           unsigned                (unsigned int)
+extern spawnveg        pid_t           (const char*, char* const[], char* 
const[], pid_t)
+extern srand           void            (unsigned int)
+extern strcasecmp      int             (const char*, const char*)
+extern strcat          char*           (char*, const char*)
+extern strchr          char*           (const char*, int)
+extern strcmp          int             (const char*, const char*)
+extern strcoll         int             (const char*, const char*)
+extern strcpy          char*           (char*, const char*)
+extern strcspn         size_t          (const char*, const char*)
+extern strdup          char*           (const char*)
+extern strlcat         size_t          (char*, const char*, size_t)
+extern strlcpy         size_t          (char*, const char*, size_t)
+extern strlen          size_t          (const char*)
+extern strncasecmp     int             (const char*, const char*, size_t)
+extern strncat         char*           (char*, const char*, size_t)
+extern strncmp         int             (const char*, const char*, size_t)
+extern strncpy         char*           (char*, const char*, size_t)
+extern strpbrk         char*           (const char*, const char*)
+extern strrchr         char*           (const char*, int)
+extern strspn          size_t          (const char*, const char*)
+extern strstr          char*           (const char*, const char*)
+extern strtok          char*           (char*, const char*)
+extern strxfrm         size_t          (char*, const char*, size_t)
+extern swab            void            (const void*, void*, ssize_t)
+extern sysconf         long            (int)
+extern system          int             (const char*)
+extern tcgetpgrp       pid_t           (int)
+extern tcsetpgrp       int             (int, pid_t)
+extern truncate        int             (const char*, off_t)
+extern ttyname         char*           (int)
+extern unlink          int             (const char*)
+extern valloc          void*           (size_t)
+extern wcstombs        size_t          (char*, const wchar_t*, size_t)
+extern wctomb          int             (char*, wchar_t)
+extern write           ssize_t         (int, const void*, size_t)
+
+print  #undef  extern
+
+# <stdarg.h> is handled by proto so this must be after the last test
+
+print  #include <stdarg.h>
diff -r -N -u ksh93_2006_09_12/src/lib/libast/features/time 
ksh93_2006_10_31/src/lib/libast/features/time
--- ksh93_2006_09_12/src/lib/libast/features/time       2004-12-08 
19:45:58.000000000 +0100
+++ ksh93_2006_10_31/src/lib/libast/features/time       2006-10-09 
03:16:04.000000000 +0200
@@ -41,13 +41,6 @@
 
 cat{
 #ifndef CLOCKS_PER_SEC
-#ifdef CLK_TCK
 #define CLOCKS_PER_SEC CLK_TCK
-#else
-#define CLOCKS_PER_SEC _AST_CLK_TCK
-#endif
-#endif
-#ifndef CLK_TCK
-#define CLK_TCK                _AST_CLK_TCK
 #endif
 }end
diff -r -N -u ksh93_2006_09_12/src/lib/libast/features/types 
ksh93_2006_10_31/src/lib/libast/features/types
--- ksh93_2006_09_12/src/lib/libast/features/types      2004-08-12 
22:58:54.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/features/types      1970-01-01 
01:00:00.000000000 +0100
@@ -1,74 +0,0 @@
-typ dev_t,nlink_t fail{
-       echo "#ifndef $m"
-       echo "#define $m        1"
-       echo "typedef short $v;"
-       echo "#endif"
-}end
-typ gid_t,mode_t,uid_t fail{
-       echo "#ifndef $m"
-       echo "#define $m        1"
-       echo "typedef unsigned short $v;"
-       echo "#endif"
-}end
-typ wchar_t stdio.h wchar.h fail{
-       echo "#ifndef $m"
-       echo "#define $m        1"
-       echo "typedef unsigned short $v;"
-       echo "#endif"
-}end
-typ pid_t,ssize_t fail{
-       echo "#ifndef $m"
-       echo "#define $m        1"
-       echo "typedef int $v;"
-       echo "#endif"
-}end
-typ wint_t stdio.h wchar.h fail{
-       echo "#ifndef $m"
-       echo "#define $m        1"
-       echo "typedef int $v;"
-       echo "#endif"
-}end
-typ size_t fail{
-       echo "#ifndef $m"
-       echo "#define $m        1"
-       echo "typedef unsigned int $v;"
-       echo "#endif"
-}end
-typ clock_t,ino_t,off_t,ptrdiff_t fail{
-       echo "#ifndef $m"
-       echo "#define $m        1"
-       echo "typedef long $v;"
-       echo "#endif"
-}end
-typ time_t fail{
-       echo "#ifndef $m"
-       echo "#define $m        1"
-       echo "typedef unsigned long $v;"
-       echo "#endif"
-}end
-typ div_t fail{
-       echo "#ifndef $m"
-       echo "#define $m        1"
-       echo "typedef struct { int quot; int rem; } $v;"
-       echo "#endif"
-}end
-typ ldiv_t fail{
-       echo "#ifndef $m"
-       echo "#define $m        1"
-       echo "typedef struct { long quot; long rem; } $v;"
-       echo "#endif"
-}end
-
-tst    typ_signed_size_t output{
-       #include <sys/types.h>
-       int
-       main()
-       {
-               unsigned long u = ~0;
-               size_t s = ~0;
-               if (s >= 0)
-                       return 1;
-               printf("#if !defined(__cplusplus) && !defined(c_plusplus) && 
!defined(_typ_signed_size_t)\n/* what dipsticks made size_t signed? sun. 
*/\ntypedef unsigned %s _ast_size_t;\n#undef\tsize_t\n#define 
size_t\t_ast_size_t\n#endif\n", u == (unsigned long)s ? "long" : "int");
-               return 0;
-       }
-}end
diff -r -N -u ksh93_2006_09_12/src/lib/libast/features/unistd.c 
ksh93_2006_10_31/src/lib/libast/features/unistd.c
--- ksh93_2006_09_12/src/lib/libast/features/unistd.c   2005-05-24 
05:53:12.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/features/unistd.c   2006-09-28 
20:17:24.000000000 +0200
@@ -34,20 +34,49 @@
 #define getdtablesize  ______getdtablesize
 #endif
 
+/*
+ * we'd like as many symbols as possible defined
+ * the standards push the vendors the other way
+ * but don't provide guard that lets everything through
+ * so each vendor adds their own guard
+ * many now include something like <standards.h> to
+ * get it straight in one place -- <sys/types.h> should
+ * kick that in
+ */
+
 #include "FEATURE/standards"
+#include "FEATURE/lib"
+
+#ifdef __sun
+#define _timespec      timespec
+#endif
 
-#include <stdio.h>
 #include <sys/types.h>
 
+#undef _SGIAPI
+#define _SGIAPI                1
+
+#if _hdr_limits
+#include <limits.h>
+#endif
+
+#undef _SGIAPI
+#define _SGIAPI                0
+
 #include "FEATURE/lib"
-#include "FEATURE/limits"
-#include "FEATURE/unistd.lcl"
+#include "FEATURE/common"
+
+#if _hdr_unistd
+#include <unistd.h>
+#endif
+
+#include "FEATURE/param"
 
 #if defined(__STDPP__directive) && defined(__STDPP__hide)
 __STDPP__directive pragma pp:nohide getpagesize getdtablesize
 #else
-#undef  getpagesize
-#undef  getdtablesize
+#undef getpagesize
+#undef getdtablesize   
 #endif
 
 #include "conflib.h"
diff -r -N -u ksh93_2006_09_12/src/lib/libast/features/uwin 
ksh93_2006_10_31/src/lib/libast/features/uwin
--- ksh93_2006_09_12/src/lib/libast/features/uwin       2002-05-13 
22:07:47.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/features/uwin       2006-09-24 
10:30:00.000000000 +0200
@@ -1,4 +1,6 @@
 lib    a64l,acosh,asinh,atanh,cbrt,ceil,crypt,erf,exp,expm1,floor
 lib    gamma,getpass,lgamma,log,log1p,random,rcmd,rint,srand48
 lib    copysign,logb,finite,drem,sqrt,ilogb,remainder,scalb
-lib    _copysign,_finite,_scalb
+lib    _copysign,_finite,_scalb,__iob_func,_p__iob
+
+dat    _iob
diff -r -N -u ksh93_2006_09_12/src/lib/libast/features/vmalloc 
ksh93_2006_10_31/src/lib/libast/features/vmalloc
--- ksh93_2006_09_12/src/lib/libast/features/vmalloc    2004-08-12 
23:20:40.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/features/vmalloc    2006-09-21 
19:03:13.000000000 +0200
@@ -6,6 +6,8 @@
 # repeating them here allows for single standalone and AST sources.
 #
 
+ref    -D_def_map_ast=1
+
 lib    atexit,getpagesize,mallinfo,mallopt,memalign,mstats
 lib    onexit,pvalloc,strdup,valloc,vmalloc
 lib    _malloc,__malloc,__libc_malloc
diff -r -N -u ksh93_2006_09_12/src/lib/libast/features/wchar 
ksh93_2006_10_31/src/lib/libast/features/wchar
--- ksh93_2006_09_12/src/lib/libast/features/wchar      2002-03-07 
10:21:18.000000000 +0100
+++ ksh93_2006_10_31/src/lib/libast/features/wchar      2006-09-22 
09:12:03.000000000 +0200
@@ -27,6 +27,7 @@
        #undef  fputws
        #undef  getwc
        #undef  getwchar
+       #undef  getws
        #undef  putwc
        #undef  putwchar
        #undef  ungetwc
@@ -40,6 +41,7 @@
        #define fwscanf         _ast_fwscanf
        #define getwc           _ast_getwc
        #define getwchar        _ast_getwchar
+       #define getws           _ast_getws
        #define putwc           _ast_putwc
        #define putwchar        _ast_putwchar
        #define swprintf        _ast_swprintf
@@ -89,6 +91,7 @@
        extern int              fwide(FILE*, int);
        extern wint_t           getwc(FILE*);
        extern wint_t           getwchar(void);
+       extern wchar_t*         getws(wchar_t*);
        extern wint_t           putwc(wchar_t, FILE*);
        extern wint_t           putwchar(wchar_t);
        extern int              swprintf(wchar_t*, size_t, const wchar_t*, ...);
diff -r -N -u ksh93_2006_09_12/src/lib/libast/include/ast.h 
ksh93_2006_10_31/src/lib/libast/include/ast.h
--- ksh93_2006_09_12/src/lib/libast/include/ast.h       2006-08-31 
08:44:35.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/include/ast.h       2006-10-11 
18:22:39.000000000 +0200
@@ -60,6 +60,9 @@
 #ifndef        __FILE_typedef
 #define __FILE_typedef 1
 #endif
+#ifndef _FILEDEFED
+#define _FILEDEFED     1
+#endif
 #endif
 
 /*
@@ -90,17 +93,20 @@
  * astconflist() flags
  */
 
-#define ASTCONF_parse          0x001
-#define ASTCONF_write          0x002
-#define ASTCONF_read           0x004
-#define ASTCONF_lower          0x008
-#define ASTCONF_base           0x010
-#define ASTCONF_defined                0x020
-#define ASTCONF_quote          0x040
-#define ASTCONF_table          0x080
-#define ASTCONF_matchcall      0x100
-#define ASTCONF_matchname      0x200
-#define ASTCONF_matchstandard  0x400
+#define ASTCONF_parse          0x0001
+#define ASTCONF_write          0x0002
+#define ASTCONF_read           0x0004
+#define ASTCONF_lower          0x0008
+#define ASTCONF_base           0x0010
+#define ASTCONF_defined                0x0020
+#define ASTCONF_quote          0x0040
+#define ASTCONF_table          0x0080
+#define ASTCONF_matchcall      0x0100
+#define ASTCONF_matchname      0x0200
+#define ASTCONF_matchstandard  0x0400
+#define ASTCONF_error          0x0800
+#define ASTCONF_system         0x1000
+#define ASTCONF_AST            0x2000
 
 /*
  * pathcanon() flags
@@ -226,7 +232,7 @@
 #define extern         __EXPORT__
 #endif
 
-extern char*           astgetconf(const char*, const char*, const char*, 
Error_f);
+extern char*           astgetconf(const char*, const char*, const char*, int, 
Error_f);
 extern char*           astconf(const char*, const char*, const char*);
 extern Ast_confdisc_f  astconfdisc(Ast_confdisc_f);
 extern void            astconflist(Sfio_t*, const char*, int, const char*);
@@ -350,51 +356,6 @@
 #define VMFL   1
 #include <vmalloc.h>
 
-#if defined(__STDPP__directive) && defined(__STDPP__ignore)
-
-__STDPP__directive pragma pp:ignore "malloc.h"
-
-#else
-
-#ifndef _malloc_h
-#define _malloc_h
-#endif
-#ifndef _malloc_h_
-#define _malloc_h_
-#endif
-#ifndef __malloc_h
-#define __malloc_h
-#endif
-#ifndef __malloc_h__
-#define __malloc_h__
-#endif
-#ifndef _MALLOC_H
-#define _MALLOC_H
-#endif
-#ifndef _MALLOC_H_
-#define _MALLOC_H_
-#endif
-#ifndef __MALLOC_H
-#define __MALLOC_H
-#endif
-#ifndef __MALLOC_H__
-#define __MALLOC_H__
-#endif
-#ifndef _MALLOC_INCLUDED
-#define _MALLOC_INCLUDED
-#endif
-#ifndef __MALLOC_INCLUDED
-#define __MALLOC_INCLUDED
-#endif
-#ifndef _H_MALLOC
-#define _H_MALLOC
-#endif
-#ifndef __H_MALLOC
-#define __H_MALLOC
-#endif
-
-#endif
-
 #endif
 
 #endif
diff -r -N -u ksh93_2006_09_12/src/lib/libast/include/ast_std.h 
ksh93_2006_10_31/src/lib/libast/include/ast_std.h
--- ksh93_2006_09_12/src/lib/libast/include/ast_std.h   2005-02-05 
09:41:41.000000000 +0100
+++ ksh93_2006_10_31/src/lib/libast/include/ast_std.h   2006-10-26 
23:17:58.000000000 +0200
@@ -24,28 +24,9 @@
  * Advanced Software Technology Library
  * AT&T Research
  *
- * a union of the following standard headers that works
- *
- *     <limits.h>
- *     <stdarg.h>
- *     <stddef.h>
- *     <stdlib.h>
- *     <sys/types.h>
- *     <string.h>
- *     <unistd.h>
- *     <fcntl.h>
- *     <locale.h>
- *
- * the following ast implementation specific headers are also included
- * these do not stomp on the std namespace
- *
- *     <ast_botch.h>
- *     <ast_common.h>
- *     <ast_fcntl.h>
- *     <ast_hdr.h>
- *     <ast_lib.h>
- *     <ast_types.h>
- *     <ast_unistd.h>
+ * a union of standard headers that works
+ * with local extensions enabled
+ * and local omission compensation
  */
 
 #ifndef _AST_STD_H
@@ -53,33 +34,6 @@
 #define _AST_STD_I             1
 
 #include <ast_common.h>
-#include <ast_lib.h>
-#include <ast_getopt.h>        /* <stdlib.h> does this */
-
-#if __mips == 2 && !defined(_NO_LARGEFILE64_SOURCE)
-#define        _NO_LARGEFILE64_SOURCE  1
-#endif
-#if !defined(_NO_LARGEFILE64_SOURCE) && _typ_off64_t && _lib_lseek64 && 
_lib_stat64
-#if !defined(_LARGEFILE64_SOURCE)
-#define _LARGEFILE64_SOURCE    1
-#endif
-#else
-#undef _LARGEFILE64_SOURCE
-#undef _typ_off64_t
-#undef _typ_struct_dirent64
-#undef _lib_creat64
-#undef _lib_fstat64
-#undef _lib_fstatvfs64
-#undef _lib_ftruncate64
-#undef _lib_lseek64
-#undef _lib_lstat64
-#undef _lib_mmap64
-#undef _lib_open64
-#undef _lib_readdir64
-#undef _lib_stat64
-#undef _lib_statvfs64
-#undef _lib_truncate64
-#endif
 
 #if _BLD_ast
 #define _BLD_cdt       1
@@ -89,8 +43,6 @@
 #endif
 #endif
 
-#include <ast_hdr.h>
-
 #ifdef _SFSTDIO_H
 #define _SKIP_SFSTDIO_H
 #else
@@ -103,138 +55,22 @@
 #ifndef        __FILE_typedef
 #define __FILE_typedef 1
 #endif
+#ifndef _FILEDEFED
+#define _FILEDEFED     1
 #endif
 #endif
-
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-#if !_std_def_calloc
-__STDPP__directive pragma pp:hide calloc
-#endif
-#if !_std_def_cfree
-__STDPP__directive pragma pp:hide cfree
-#endif
-#if !_std_def_free
-__STDPP__directive pragma pp:hide free
-#endif
-#if !_std_def_malloc
-__STDPP__directive pragma pp:hide malloc
-#endif
-#if !_std_def_memalign
-__STDPP__directive pragma pp:hide memalign
-#endif
-#if !_std_def_pvalloc
-__STDPP__directive pragma pp:hide pvalloc
-#endif
-#if !_std_def_realloc
-__STDPP__directive pragma pp:hide realloc
-#endif
-#if !_std_def_valloc
-__STDPP__directive pragma pp:hide valloc
-#endif
-__STDPP__directive pragma pp:hide execl execle execlp execv
-__STDPP__directive pragma pp:hide execve execvp execvpe
-__STDPP__directive pragma pp:hide getcwd getopt getsubopt putenv realpath
-__STDPP__directive pragma pp:hide resolvepath setenv setpgrp sleep spawnveg
-__STDPP__directive pragma pp:hide strtol strtoul strtoll strtoull
-__STDPP__directive pragma pp:hide strtod strtold strdup strmode
-__STDPP__directive pragma pp:hide unsetenv vfprintf vprintf vsprintf
-#else
-#if !_std_def_calloc
-#define calloc         ______calloc
-#endif
-#if !_std_def_cfree
-#define cfree          ______cfree
-#endif
-#if !_std_def_free
-#define free           ______free
-#endif
-#if !_std_def_malloc
-#define malloc         ______malloc
-#endif
-#if !_std_def_memalign
-#define memalign       ______memalign
-#endif
-#if !_std_def_pvalloc
-#define pvalloc                ______pvalloc
-#endif
-#if !_std_def_realloc
-#define realloc                ______realloc
-#endif
-#if !_std_def_valloc
-#define valloc         ______valloc
-#endif
-#define execl          ______execl
-#define execle         ______execle
-#define execlp         ______execlp
-#define execv          ______execv
-#define execve         ______execve
-#define execvpe                ______execvpe
-#define execvp         ______execvp
-#define getcwd         ______getcwd
-#define getopt         ______getopt
-#define getsubopt      ______getsubopt
-#define putenv         ______putenv
-#define realpath       ______realpath
-#define resolvepath    ______resolvepath
-#define setenv         ______setenv
-#define setpgrp                ______setpgrp
-#define sleep          ______sleep
-#define spawnveg       ______spawnveg
-#define strtol         ______strtol
-#define strtoul                ______strtoul
-#define strtoll                ______strtoll
-#define strtoull       ______strtoull
-#define strtod         ______strtod
-#define strtold                ______strtold
-#define strdup         ______strdup
-#define strmode                ______strmode
-#define unsetenv       ______unsetenv
-#define vfprintf       ______vfprintf
-#define vprintf                ______vprintf
-#define vsprintf       ______vsprintf
 #endif
 
-#include <sys/types.h>
-#include <stdarg.h>
+#include <ast_lib.h>
+#include <ast_sys.h>
+#include <ast_getopt.h>        /* <stdlib.h> does this */
+#include <ast_fcntl.h>
+#include <ast_limits.h>
+#include <ast_botch.h>
 
 #undef _ast_va_list
 #define _ast_va_list   va_list
 
-#if defined(__STDPP__directive) && defined(__STDPP__initial)
-__STDPP__directive pragma pp:initial
-#endif
-#include <limits.h>
-#if defined(__STDPP__directive) && defined(__STDPP__initial)
-__STDPP__directive pragma pp:noinitial
-#endif
-
-#if defined(__STDC__) && !defined(__USE_FIXED_PROTOTYPES__)
-#define __USE_FIXED_PROTOTYPES__       1       /* kick gcc out of the past */
-#endif
-
-#if defined(__STDC__) || defined(__cplusplus)|| defined(_std_stddef)
-
-#include <stddef.h>
-
-#endif
-
-#ifndef offsetof
-#define offsetof(type,member) ((size_t)&(((type*)0)->member))
-#endif
-
-#if defined(__STDC__) || !defined(__cplusplus) && defined(_std_stdlib)
-
-#include <stdlib.h>
-
-#else
-
-#define EXIT_FAILURE   1
-#define EXIT_SUCCESS   0
-#define MB_CUR_MAX     1
-#define RAND_MAX       32767
-
-#endif
-
 #ifdef _SKIP_SFSTDIO_H
 #undef _SKIP_SFSTDIO_H
 #else
@@ -242,730 +78,9 @@
 #undef FILE
 #endif
 
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-#if !_std_def_calloc
-__STDPP__directive pragma pp:nohide calloc
-#endif
-#if !_std_def_cfree
-__STDPP__directive pragma pp:nohide cfree
-#endif
-#if !_std_def_free
-__STDPP__directive pragma pp:nohide free
-#endif
-#if !_std_def_malloc
-__STDPP__directive pragma pp:nohide malloc
-#endif
-#if !_std_def_memalign
-__STDPP__directive pragma pp:nohide memalign
-#endif
-#if !_std_def_pvalloc
-__STDPP__directive pragma pp:nohide pvalloc
-#endif
-#if !_std_def_realloc
-__STDPP__directive pragma pp:nohide realloc
-#endif
-#if !_std_def_valloc
-__STDPP__directive pragma pp:nohide valloc
-#endif
-__STDPP__directive pragma pp:nohide execl execle execlp execv
-__STDPP__directive pragma pp:nohide execve execvp execvpe
-__STDPP__directive pragma pp:nohide getcwd getopt getsubopt putenv realpath
-__STDPP__directive pragma pp:nohide resolvepath setenv setpgrp sleep spawnveg
-__STDPP__directive pragma pp:nohide strtol strtoul strtoll strtoull
-__STDPP__directive pragma pp:nohide strtod strtold strdup strmode
-__STDPP__directive pragma pp:nohide unsetenv vfprintf vprintf vsprintf
-#else
-#if !_std_def_calloc
-#undef calloc  
-#endif
-#if !_std_def_cfree
-#undef cfree   
-#endif
-#if !_std_def_free
-#undef free    
-#endif
-#if !_std_def_malloc
-#undef malloc  
-#endif
-#if !_std_def_memalign
-#undef memalign        
-#endif
-#if !_std_def_pvalloc
-#undef pvalloc 
-#endif
-#if !_std_def_realloc
-#undef realloc 
-#endif
-#if !_std_def_valloc
-#undef valloc  
-#endif
-#undef execl
-#undef execle
-#undef execlp
-#undef execv
-#undef execve
-#undef execvp
-#undef execvpe
-#undef getcwd
-#undef getopt
-#undef getsubopt
-#undef putenv
-#undef realpath
-#undef resolvepath
-#undef setenv
-#undef setpgrp
-#undef sleep
-#undef spawnveg
-#undef strtol
-#undef strtoul
-#undef strtoll
-#undef strtoull
-#undef strtod
-#undef strtold
-#undef strdup
-#undef strmode
-#undef unsetenv
-#undef vfprintf
-#undef vprintf
-#undef vsprintf
-#endif
-
-#include <ast_map.h>
-#include <ast_types.h>
-
-#if !defined(__STDC__) && ( defined(__cplusplus) || !defined(_std_stdlib) )
-
-/* <stdlib.h> */
-
-extern double          atof(const char*);
-extern int             atoi(const char*);
-extern long            atol(const char*);
-
-extern int             rand(void);
-extern void            srand(unsigned int);
-
-extern void            abort(void);
-extern int             atexit(void(*)(void));
-extern void            exit(int);
-extern char*           getenv(const char*);
-extern char*           realpath(const char*, char*);
-extern char*           resolvepath(const char*, char*, size_t);
-extern void            swab(const void*, void*, ssize_t);
-extern int             system(const char*);
-
-extern void*           bsearch(const void*, const void*, size_t, size_t,
-                               int(*)(const void*, const void*));
-extern void            qsort(void*, size_t, size_t,
-                               int(*)(const void*, const void*));
-
-extern int             abs(int);
-extern div_t           div(int, int);
-extern long            labs(long);
-extern ldiv_t          ldiv(long, long);
-
-extern int             mblen(const char*, size_t);
-extern int             mbtowc(wchar_t*, const char*, size_t);
-extern int             wctomb(char*, wchar_t);
-extern size_t          mbstowcs(wchar_t*, const char*, size_t);
-extern size_t          wcstombs(char*, const wchar_t*, size_t);
-
-#endif
-
-#if !_UWIN || !_BLD_ast
-
-#if !_BLD_ast && defined(__IMPORT__)
-#define extern         __IMPORT__
-#endif
-
-#if _std_strtod
-#undef strtod
-#define strtod                 _ast_strtod
-#endif
-
-#if _std_strtol
-#undef strtol
-#undef strtoul
-#undef strtoll
-#undef strtoull
-#define strtol                 _ast_strtol
-#define strtoul                        _ast_strtoul
-#define strtoll                        _ast_strtoll
-#define strtoull               _ast_strtoull
-#endif
-
-extern long                    strtol(const char*, char**, int);
-extern unsigned long           strtoul(const char*, char**, int);
-
-extern double                  strtod(const char*, char**);
-
-#if !_UWIN
-#undef extern
-#endif
-
-extern _ast_fltmax_t           strtold(const char*, char**);
-
-#undef extern
-
-extern _ast_intmax_t           strtoll(const char*, char**, int);
-extern unsigned _ast_intmax_t  strtoull(const char*, char**, int);
-
-#endif
-
-#if !_std_def_calloc
-extern void*           calloc(size_t, size_t);
-#endif
-#if !_std_def_cfree
-extern void            cfree(void*);
-#endif
-#if !_std_def_free
-extern void            free(void*);
-#endif
-#if !_std_def_malloc
-extern void*           malloc(size_t);
-#endif
-#if !_std_def_memalign
-extern void*           memalign(size_t, size_t);
-#endif
-#if !_std_def_pvalloc
-extern void*           pvalloc(size_t);
-#endif
-#if !_std_def_realloc
-extern void*           realloc(void*, size_t);
-#endif
-#if !_std_def_valloc
-extern void*           valloc(size_t);
-#endif
-
-#if _std_string
-
-#include <string.h>
-
-#else
-
-/* <string.h> */
-
-extern void*           memccpy(void*, const void*, int, size_t);
-extern void*           memchr(const void*, int, size_t);
-extern int             memcmp(const void*, const void*, size_t);
-extern void*           memcpy(void*, const void*, size_t);
-extern void*           memmove(void*, const void*, size_t);
-extern void*           memset(void*, int, size_t);
-extern int             strcasecmp(const char*, const char*);
-extern char*           strcat(char*, const char*);
-extern char*           strchr(const char*, int);
-extern int             strcmp(const char*, const char*);
-extern int             strcoll(const char*, const char*);
-extern char*           strcpy(char*, const char*);
-extern size_t          strcspn(const char*, const char*);
-extern size_t          strlen(const char*);
-extern int             strncasecmp(const char*, const char*, size_t);
-extern char*           strncat(char*, const char*, size_t);
-extern int             strncmp(const char*, const char*, size_t);
-extern char*           strncpy(char*, const char*, size_t);
-extern size_t          strlcat(char*, const char*, size_t);
-extern size_t          strlcpy(char*, const char*, size_t);
-extern char*           strpbrk(const char*, const char*);
-extern char*           strrchr(const char*, int);
-extern size_t          strspn(const char*, const char*);
-extern char*           strstr(const char*, const char*);
-extern char*           strtok(char*, const char*);
-extern size_t          strxfrm(char*, const char*, size_t);
-
-#endif
-
-#if defined(__STDPP__directive) && defined(__STDPP__ignore)
-
-__STDPP__directive pragma pp:ignore "libc.h"
-__STDPP__directive pragma pp:ignore "memory.h"
-__STDPP__directive pragma pp:ignore "stdlib.h"
-__STDPP__directive pragma pp:ignore "string.h"
-__STDPP__directive pragma pp:ignore "strings.h"
-
-#else
-
-#ifndef _libc_h
-#define _libc_h
-#endif
-#ifndef _libc_h_
-#define _libc_h_
-#endif
-#ifndef __libc_h
-#define __libc_h
-#endif
-#ifndef __libc_h__
-#define __libc_h__
-#endif
-#ifndef _LIBC_H
-#define _LIBC_H
-#endif
-#ifndef _LIBC_H_
-#define _LIBC_H_
-#endif
-#ifndef __LIBC_H
-#define __LIBC_H
-#endif
-#ifndef __LIBC_H__
-#define __LIBC_H__
-#endif
-#ifndef _LIBC_INCLUDED
-#define _LIBC_INCLUDED
-#endif
-#ifndef __LIBC_INCLUDED
-#define __LIBC_INCLUDED
-#endif
-#ifndef _H_LIBC
-#define _H_LIBC
-#endif
-#ifndef __H_LIBC
-#define __H_LIBC
-#endif
-
-#ifndef _memory_h
-#define _memory_h
-#endif
-#ifndef _memory_h_
-#define _memory_h_
-#endif
-#ifndef __memory_h
-#define __memory_h
-#endif
-#ifndef __memory_h__
-#define __memory_h__
-#endif
-#ifndef _MEMORY_H
-#define _MEMORY_H
-#endif
-#ifndef _MEMORY_H_
-#define _MEMORY_H_
-#endif
-#ifndef __MEMORY_H
-#define __MEMORY_H
-#endif
-#ifndef __MEMORY_H__
-#define __MEMORY_H__
-#endif
-#ifndef _MEMORY_INCLUDED
-#define _MEMORY_INCLUDED
-#endif
-#ifndef __MEMORY_INCLUDED
-#define __MEMORY_INCLUDED
-#endif
-#ifndef _H_MEMORY
-#define _H_MEMORY
-#endif
-#ifndef __H_MEMORY
-#define __H_MEMORY
-#endif
-
-#ifndef _stdlib_h
-#define _stdlib_h
-#endif
-#ifndef _stdlib_h_
-#define _stdlib_h_
-#endif
-#ifndef __stdlib_h
-#define __stdlib_h
-#endif
-#ifndef __stdlib_h__
-#define __stdlib_h__
-#endif
-#ifndef _STDLIB_H
-#define _STDLIB_H
-#endif
-#ifndef _STDLIB_H_
-#define _STDLIB_H_
-#endif
-#ifndef __STDLIB_H
-#define __STDLIB_H
-#endif
-#ifndef __STDLIB_H__
-#define __STDLIB_H__
-#endif
-#ifndef _STDLIB_INCLUDED
-#define _STDLIB_INCLUDED
-#endif
-#ifndef __STDLIB_INCLUDED
-#define __STDLIB_INCLUDED
-#endif
-#ifndef _H_STDLIB
-#define _H_STDLIB
-#endif
-#ifndef __H_STDLIB
-#define __H_STDLIB
-#endif
-
-#ifndef _string_h
-#define _string_h
-#endif
-#ifndef _string_h_
-#define _string_h_
-#endif
-#ifndef __string_h
-#define __string_h
-#endif
-#ifndef __string_h__
-#define __string_h__
-#endif
-#ifndef _STRING_H
-#define _STRING_H
-#endif
-#ifndef _STRING_H_
-#define _STRING_H_
-#endif
-#ifndef __STRING_H
-#define __STRING_H
-#endif
-#ifndef __STRING_H__
-#define __STRING_H__
-#endif
-#ifndef _STRING_INCLUDED
-#define _STRING_INCLUDED
-#endif
-#ifndef __STRING_INCLUDED
-#define __STRING_INCLUDED
-#endif
-#ifndef _H_STRING
-#define _H_STRING
-#endif
-#ifndef __H_STRING
-#define __H_STRING
-#endif
-
-#ifndef _strings_h
-#define _strings_h
-#endif
-#ifndef _strings_h_
-#define _strings_h_
-#endif
-#ifndef __strings_h
-#define __strings_h
-#endif
-#ifndef __strings_h__
-#define __strings_h__
-#endif
-#ifndef _STRINGS_H
-#define _STRINGS_H
-#endif
-#ifndef _STRINGS_H_
-#define _STRINGS_H_
-#endif
-#ifndef __STRINGS_H
-#define __STRINGS_H
-#endif
-#ifndef __STRINGS_H__
-#define __STRINGS_H__
-#endif
-#ifndef _STRINGS_INCLUDED
-#define _STRINGS_INCLUDED
-#endif
-#ifndef __STRINGS_INCLUDED
-#define __STRINGS_INCLUDED
-#endif
-#ifndef _H_STRINGS
-#define _H_STRINGS
-#endif
-#ifndef __H_STRINGS
-#define __H_STRINGS
-#endif
-
-#endif
-
-#include <ast_fcntl.h>
-
-#if _typ_off64_t
-#undef off_t
-#ifdef __STDC__
-#define        off_t           off_t
-#endif
-#endif
-
-/* <unistd.h> */
-
-#if _UWIN
-
-#include <unistd.h>
-
-#else
-
-#include <ast_unistd.h>
-#include <ast_botch.h>
-
-#ifndef STDIN_FILENO
-#define        STDIN_FILENO    0
-#define        STDOUT_FILENO   1
-#define        STDERR_FILENO   2
-#endif
-
-#ifndef NULL
-#define        NULL            0
-#endif
-
-#ifndef SEEK_SET
-#define        SEEK_SET        0
-#define        SEEK_CUR        1
-#define        SEEK_END        2
-#endif
-
-#ifndef        F_OK
-#define        F_OK            0
-#define        X_OK            1
-#define        W_OK            2
-#define        R_OK            4
-#endif
-
-extern void            _exit(int);
-extern int             access(const char*, int);
-extern unsigned                alarm(unsigned);
-extern int             chdir(const char*);
-extern int             chown(const char*, uid_t, gid_t);
-extern int             close(int);
-extern size_t          confstr(int, char*, size_t);
-extern int             dup(int);
-extern int             dup2(int, int);
-extern int             eaccess(const char*, int);
-extern int             execl(const char*, const char*, ...);
-extern int             execle(const char*, const char*, ...);
-extern int             execlp(const char*, const char*, ...);
-extern int             execv(const char*, char* const[]);
-extern int             execve(const char*, char* const[], char* const[]);
-extern int             execvp(const char*, char* const[]);
-extern int             execvpe(const char*, char* const[], char* const[]);
-extern pid_t           fork(void);
-extern long            fpathconf(int, int);
-extern int             fsync(int);
-extern int             ftruncate(int, off_t);
-extern char*           getcwd(char*, size_t);
-extern gid_t           getegid(void);
-extern uid_t           geteuid(void);
-extern gid_t           getgid(void);
-extern int             getgroups(int, gid_t[]);
-extern char*           getlogin(void);
-extern pid_t           getpgrp(void);
-extern pid_t           getpid(void);
-extern pid_t           getppid(void);
-extern char*           gettxt(const char*, const char*);
-extern uid_t           getuid(void);
-extern int             isatty(int);
-extern int             link(const char*, const char*);
-extern off_t           lseek(int, off_t, int);
-extern long            pathconf(const char*, int);
-extern int             pause(void);
-extern int             pipe(int[]);
-extern ssize_t         read(int, void*, size_t);
-extern int             rmdir(const char*);
-extern int             setgid(gid_t);
-extern int             setpgid(pid_t, pid_t);
-extern pid_t           setsid(void);
-extern int             setuid(uid_t);
-extern unsigned                sleep(unsigned int);
-extern long            sysconf(int);
-extern pid_t           tcgetpgrp(int);
-extern int             tcsetpgrp(int, pid_t);
-extern int             truncate(const char*, off_t);
-extern char*           ttyname(int);
-extern int             unlink(const char*);
-extern ssize_t         write(int, const void*, size_t);
-
-#endif
-
-#if _BLD_ast && defined(__EXPORT__)
-#define extern         __EXPORT__
-#endif
-
-/*
- * yes, we don't trust anyone's interpretation but our own
- */
-
-#undef strerror
-#define strerror       _ast_strerror
-
-extern char*           strerror(int);
-
-#if !_UWIN
-
-#undef _confstr
-#define        _confstr        _ast_confstr
-#undef _fpathconf
-#define        _fpathconf      _ast_fpathconf
-#undef _pathconf
-#define        _pathconf       _ast_pathconf
-#undef _sysconf
-#define        _sysconf        _ast_sysconf
-
-#undef confstr
-#define confstr                _ast_confstr
-#undef fpathconf
-#define fpathconf      _ast_fpathconf
-#undef pathconf
-#define pathconf       _ast_pathconf
-#undef sysconf
-#define sysconf                _ast_sysconf
-
-extern size_t          confstr(int, char*, size_t);
-extern long            fpathconf(int, int);
-extern long            pathconf(const char*, int);
-extern long            sysconf(int);
-
-extern pid_t           spawnveg(const char*, char* const[], char* const[], 
pid_t);
-extern char*           strdup(const char*);
-
-#endif
-
-#undef extern
-
-/*
- * now activate the guards for headers already covered
- */
-
-#if defined(__STDPP__directive) && defined(__STDPP__ignore)
-
-__STDPP__directive pragma pp:ignore "fcntl.h"
-__STDPP__directive pragma pp:ignore "unistd.h"
-__STDPP__directive pragma pp:ignore "sys/unistd.h"
-
-#else
-
-#ifndef _fcntl_h
-#define _fcntl_h
-#endif
-#ifndef _fcntl_h_
-#define _fcntl_h_
-#endif
-#ifndef __fcntl_h
-#define __fcntl_h
-#endif
-#ifndef __fcntl_h__
-#define __fcntl_h__
-#endif
-#ifndef _FCNTL_H
-#define _FCNTL_H
-#endif
-#ifndef _FCNTL_H_
-#define _FCNTL_H_
-#endif
-#ifndef __FCNTL_H
-#define __FCNTL_H
-#endif
-#ifndef __FCNTL_H__
-#define __FCNTL_H__
-#endif
-#ifndef _FCNTL_INCLUDED
-#define _FCNTL_INCLUDED
-#endif
-#ifndef __FCNTL_INCLUDED
-#define __FCNTL_INCLUDED
-#endif
-#ifndef _H_FCNTL
-#define _H_FCNTL
-#endif
-#ifndef __H_FCNTL
-#define __H_FCNTL
-#endif
-
-#ifndef _unistd_h
-#define _unistd_h
-#endif
-#ifndef _unistd_h_
-#define _unistd_h_
-#endif
-#ifndef __unistd_h
-#define __unistd_h
-#endif
-#ifndef __unistd_h__
-#define __unistd_h__
-#endif
-#ifndef _UNISTD_H
-#define _UNISTD_H
-#endif
-#ifndef _UNISTD_H_
-#define _UNISTD_H_
-#endif
-#ifndef __UNISTD_H
-#define __UNISTD_H
-#endif
-#ifndef __UNISTD_H__
-#define __UNISTD_H__
-#endif
-#ifndef _UNISTD_INCLUDED
-#define _UNISTD_INCLUDED
-#endif
-#ifndef __UNISTD_INCLUDED
-#define __UNISTD_INCLUDED
-#endif
-#ifndef _H_UNISTD
-#define _H_UNISTD
-#endif
-#ifndef __H_UNISTD
-#define __H_UNISTD
-#endif
-#ifndef _SYS_UNISTD_H
-#define _SYS_UNISTD_H
-#endif
-
-#endif
-
-#if defined(__cplusplus)
-
-#if defined(__STDPP__directive) && defined(__STDPP__ignore)
-
-__STDPP__directive pragma pp:ignore "sysent.h"
-
-#else
-
-#ifndef _sysent_h
-#define _sysent_h
-#endif
-#ifndef _sysent_h_
-#define _sysent_h_
-#endif
-#ifndef __sysent_h
-#define __sysent_h
-#endif
-#ifndef __sysent_h__
-#define __sysent_h__
-#endif
-#ifndef _SYSENT_H
-#define _SYSENT_H
-#endif
-#ifndef _SYSENT_H_
-#define _SYSENT_H_
-#endif
-#ifndef __SYSENT_H
-#define __SYSENT_H
-#endif
-#ifndef __SYSENT_H__
-#define __SYSENT_H__
-#endif
-#ifndef _SYSENT_INCLUDED
-#define _SYSENT_INCLUDED
-#endif
-#ifndef __SYSENT_INCLUDED
-#define __SYSENT_INCLUDED
-#endif
-#ifndef _H_SYSENT
-#define _H_SYSENT
-#endif
-#ifndef __H_SYSENT
-#define __H_SYSENT
-#endif
-
-#endif
-
-#endif
-
 /* locale stuff */
 
-#if _hdr_locale
-
-#include <locale.h>
-
-#if _sys_localedef
-
-#include <sys/localedef.h>
-
-#endif
-
-#else
+#if !_hdr_locale
 
 struct lconv
 {
@@ -996,13 +111,17 @@
 #endif
 
 #undef localeconv
-#define localeconv             _ast_localeconv
+#define localeconv     _ast_localeconv
 
 #undef setlocale
-#define setlocale              _ast_setlocale
+#define setlocale      _ast_setlocale
+
+#undef strerror
+#define strerror       _ast_strerror
 
 extern struct lconv*   localeconv(void);
 extern char*           setlocale(int, const char*);
+extern char*           strerror(int);
 
 #define AST_MESSAGE_SET                3       /* see <mc.h> mcindex()         
*/
 
@@ -1129,12 +248,6 @@
 
 #undef extern
 
-/* stuff from std headers not used by ast, e.g., <stdio.h> */
-
-extern void*           memzero(void*, size_t);
-extern int             remove(const char*);
-extern int             rename(const char*, const char*);
-
 /* largefile hackery -- ast uses the large versions by default */
 
 #if _typ_off64_t
@@ -1172,18 +285,19 @@
 
 #endif
 
-#if !defined(remove) && !defined(_lib_remove)
-extern int             unlink(const char*);
-#define remove(p)      unlink(p)
+#if !defined(remove)
+extern int             remove(const char*);
+#endif
+
+#if !defined(rename)
+extern int             rename(const char*, const char*);
 #endif
 
 #if !defined(strchr) && !defined(_lib_strchr) && defined(_lib_index)
-extern char*           index(const char*, int);
 #define strchr(s,c)    index(s,c)
 #endif
 
 #if !defined(strrchr) && !defined(_lib_strrchr) && defined(_lib_rindex)
-extern char*           rindex(const char*, int);
 #define strrchr(s,c)   rindex(s,c)
 #endif
 
@@ -1199,6 +313,18 @@
 
 #undef extern
 
+/*
+ * and finally, standard interfaces hijacked by ast
+ * _ATS_STD_I delays headers that require <ast_map.h>
+ */
+
+#include <ast_map.h>
+
 #undef _AST_STD_I
 
+#if _REGEX_H < 0
+#undef _REGEX_H
+#include <regex.h>
+#endif
+
 #endif
diff -r -N -u ksh93_2006_09_12/src/lib/libast/include/ast_version.h 
ksh93_2006_10_31/src/lib/libast/include/ast_version.h
--- ksh93_2006_09_12/src/lib/libast/include/ast_version.h       2004-04-08 
06:27:06.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/include/ast_version.h       2006-10-06 
07:58:39.000000000 +0200
@@ -25,4 +25,4 @@
  * AT&T Research
  */
 
-#define _AST_VERSION   20040404L
+#define _AST_VERSION   20061004L
diff -r -N -u ksh93_2006_09_12/src/lib/libast/include/bytesex.h 
ksh93_2006_10_31/src/lib/libast/include/bytesex.h
--- ksh93_2006_09_12/src/lib/libast/include/bytesex.h   1999-12-16 
11:51:29.000000000 +0100
+++ ksh93_2006_10_31/src/lib/libast/include/bytesex.h   1970-01-01 
01:00:00.000000000 +0100
@@ -1,43 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*           Copyright (c) 1985-2006 AT&T Knowledge Ventures            *
-*                      and is licensed under the                       *
-*                  Common Public License, Version 1.0                  *
-*                      by AT&T Knowledge Ventures                      *
-*                                                                      *
-*                A copy of the License is available at                 *
-*            http://www.opensource.org/licenses/cpl1.0.txt             *
-*         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf at research.att.com>                  *
-*                  David Korn <dgk at research.att.com>                   *
-*                   Phong Vo <kpv at research.att.com>                    *
-*                                                                      *
-***********************************************************************/
-/*
- * linux/gnu compatibility
- */
-
-#ifndef _BYTESEX_H
-#define _BYTESEX_H
-
-#include <ast_common.h>
-
-#undef __BYTE_ORDER
-
-#if ( _ast_intswap & 3 ) == 3
-#define __BYTE_ORDER   __LITTLE_ENDIAN
-#else
-#if ( _ast_intswap & 3 ) == 1
-#define __BYTE_ORDER   __PDP_ENDIAN
-#else
-#define __BYTE_ORDER   __BIG_ENDIAN
-#endif
-#endif
-
-#endif
diff -r -N -u ksh93_2006_09_12/src/lib/libast/include/endian.h 
ksh93_2006_10_31/src/lib/libast/include/endian.h
--- ksh93_2006_09_12/src/lib/libast/include/endian.h    1996-12-10 
23:26:58.000000000 +0100
+++ ksh93_2006_10_31/src/lib/libast/include/endian.h    1970-01-01 
01:00:00.000000000 +0100
@@ -1,54 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*           Copyright (c) 1985-2006 AT&T Knowledge Ventures            *
-*                      and is licensed under the                       *
-*                  Common Public License, Version 1.0                  *
-*                      by AT&T Knowledge Ventures                      *
-*                                                                      *
-*                A copy of the License is available at                 *
-*            http://www.opensource.org/licenses/cpl1.0.txt             *
-*         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf at research.att.com>                  *
-*                  David Korn <dgk at research.att.com>                   *
-*                   Phong Vo <kpv at research.att.com>                    *
-*                                                                      *
-***********************************************************************/
-/*
- * linux/gnu compatibility
- */
-
-#ifndef _ENDIAN_H
-#define _ENDIAN_H
-
-#include <bytesex.h>
-
-#define        __LITTLE_ENDIAN 1234
-#define        __BIG_ENDIAN    4321
-#define        __PDP_ENDIAN    3412
-
-#if defined (__USE_BSD) && !defined(__STRICT_ANSI__)
-
-#ifndef LITTLE_ENDIAN
-#define        LITTLE_ENDIAN   __LITTLE_ENDIAN
-#endif
-
-#ifndef BIG_ENDIAN
-#define        BIG_ENDIAN      __BIG_ENDIAN
-#endif
-
-#ifndef PDP_ENDIAN
-#define        PDP_ENDIAN      __PDP_ENDIAN
-#endif
-
-#undef BYTE_ORDER
-#define        BYTE_ORDER      __BYTE_ORDER
-
-#endif
-
-#endif
diff -r -N -u ksh93_2006_09_12/src/lib/libast/include/ls.h 
ksh93_2006_10_31/src/lib/libast/include/ls.h
--- ksh93_2006_09_12/src/lib/libast/include/ls.h        2004-08-12 
15:14:25.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/include/ls.h        2006-10-14 
02:33:51.000000000 +0200
@@ -73,45 +73,6 @@
 #define LS_W_MARK      1               /* LS_MARK field width          */
 #define LS_W_NAME      9               /* group|user name field width  */
 
-#if defined(_AST_H) || defined(_POSIX_SOURCE) || defined(_XOPEN_SOURCE)
-#define _AST_mode_t    mode_t
-#else
-#define _AST_mode_t    int
-#endif
-
-#if _typ_off64_t
-#undef off_t
-#define off_t          off64_t
-#endif
-#if _lib_fstat64
-#define fstat          fstat64
-#endif
-#if _lib_lstat64
-#define lstat          lstat64
-#endif
-#if _lib_stat64
-#define stat           stat64
-#endif
-
-extern int             chmod(const char*, _AST_mode_t);
-#if !defined(_ver_fstat) && !defined(__USE_LARGEFILE64)
-extern int             fstat(int, struct stat*);
-#endif
-#if !defined(_ver_lstat) && !defined(__USE_LARGEFILE64)
-extern int             lstat(const char*, struct stat*);
-#endif
-extern int             mkdir(const char*, _AST_mode_t);
-extern int             mkfifo(const char*, _AST_mode_t);
-#if !defined(_lib__xmknod)
-extern int             mknod(const char*, _AST_mode_t, dev_t);
-#endif
-#if !defined(_ver_stat) && !defined(__USE_LARGEFILE64)
-extern int             stat(const char*, struct stat*);
-#endif
-extern _AST_mode_t     umask(_AST_mode_t);
-
-#undef _AST_mode_t
-
 #if _BLD_ast && defined(__EXPORT__)
 #define extern         __EXPORT__
 #endif
diff -r -N -u ksh93_2006_09_12/src/lib/libast/include/modecanon.h 
ksh93_2006_10_31/src/lib/libast/include/modecanon.h
--- ksh93_2006_09_12/src/lib/libast/include/modecanon.h 1996-09-24 
15:43:39.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/include/modecanon.h 2006-09-21 
04:58:30.000000000 +0200
@@ -33,6 +33,8 @@
 #define X_ITYPE(m)     ((m)&X_IFMT)
 
 #define        X_IFMT          0170000
+#define        X_IFWHT         0160000
+#define        X_IFDOOR        0150000
 #define        X_IFSOCK        0140000
 #define        X_IFLNK         0120000
 #define        X_IFCTG         0110000
diff -r -N -u ksh93_2006_09_12/src/lib/libast/include/regex.h 
ksh93_2006_10_31/src/lib/libast/include/regex.h
--- ksh93_2006_09_12/src/lib/libast/include/regex.h     2005-11-22 
17:01:01.000000000 +0100
+++ ksh93_2006_10_31/src/lib/libast/include/regex.h     2006-10-26 
15:45:12.000000000 +0200
@@ -25,8 +25,15 @@
  * regex library interface
  */
 
+#ifdef _AST_STD_I
+#define _REGEX_H       -1
+#define regex_t                int
+#define regmatch_t     int
+#endif
 #ifndef _REGEX_H
-#define _REGEX_H
+#define _REGEX_H       1
+#undef regex_t
+#undef regmatch_t
 
 #include <ast_common.h>
 
@@ -200,13 +207,14 @@
 extern int     regaddclass(const char*, regclass_t);
 extern int     regcollate(const char*, char**, char*, int);
 extern int     regcomb(regex_t*, regex_t*);
+extern size_t  regdecomp(regex_t*, regflags_t, char*, size_t);
 extern int     regdup(regex_t*, regex_t*);
 extern int     regncomp(regex_t*, const char*, size_t, regflags_t);
 extern int     regnexec(const regex_t*, const char*, size_t, size_t, 
regmatch_t*, regflags_t);
 extern void    regfatal(regex_t*, int, int);
 extern void    regfatalpat(regex_t*, int, int, const char*);
 extern int     regrecord(const regex_t*);
-extern int     regrexec(const regex_t*, const char*, size_t, size_t, 
regmatch_t*, regflags_t, regflags_t, void*, regrecord_t);
+extern int     regrexec(const regex_t*, const char*, size_t, size_t, 
regmatch_t*, regflags_t, int, void*, regrecord_t);
 extern regstat_t* regstat(const regex_t*);
 
 extern regex_t*        regcache(const char*, regflags_t, int*);
diff -r -N -u ksh93_2006_09_12/src/lib/libast/include/sfdisc.h 
ksh93_2006_10_31/src/lib/libast/include/sfdisc.h
--- ksh93_2006_09_12/src/lib/libast/include/sfdisc.h    2000-03-09 
02:49:10.000000000 +0100
+++ ksh93_2006_10_31/src/lib/libast/include/sfdisc.h    2006-11-02 
16:28:30.000000000 +0100
@@ -37,6 +37,8 @@
 #define extern         __EXPORT__
 #endif
 
+#define SFSK_DISCARD           SFDCEVENT('S','K',1)
+
 /*
  * %(...) printf support
  */
diff -r -N -u ksh93_2006_09_12/src/lib/libast/include/sfstr.h 
ksh93_2006_10_31/src/lib/libast/include/sfstr.h
--- ksh93_2006_09_12/src/lib/libast/include/sfstr.h     2003-09-03 
22:49:25.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/include/sfstr.h     1970-01-01 
01:00:00.000000000 +0100
@@ -1,64 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*           Copyright (c) 1985-2006 AT&T Knowledge Ventures            *
-*                      and is licensed under the                       *
-*                  Common Public License, Version 1.0                  *
-*                      by AT&T Knowledge Ventures                      *
-*                                                                      *
-*                A copy of the License is available at                 *
-*            http://www.opensource.org/licenses/cpl1.0.txt             *
-*         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf at research.att.com>                  *
-*                  David Korn <dgk at research.att.com>                   *
-*                   Phong Vo <kpv at research.att.com>                    *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-/*
- * macro interface for sfio write strings
- *
- * NOTE: see <stak.h> for an alternative interface
- *      read operations require sfseek()
- */
-
-#ifndef _SFSTR_H
-#define _SFSTR_H
-
-#include <sfio.h>
-
-#define sfstropen()    sfnew((Sfio_t*)0,(char*)0,-1,-1,SF_WRITE|SF_STRING)
-#define sfstrnew(m)    sfnew((Sfio_t*)0,(char*)0,-1,-1,(m)|SF_STRING)
-#define sfstrclose(f)  sfclose(f)
-
-#define sfstrtell(f)   ((f)->_next - (f)->_data)
-#define sfstrpend(f)   ((f)->_endb - (f)->_next)
-#define sfstrrel(f,p)  ((p) == (0) ? (char*)(f)->_next : \
-                        ((f)->_next += (p), \
-                         ((f)->_next >= (f)->_data && (f)->_next  <= 
(f)->_endb) ? \
-                               (char*)(f)->_next : ((f)->_next -= (p), 
(char*)0) ) )
-
-#define sfstrset(f,p)  (((p) >= 0 && (p) <= (f)->_size) ? \
-                               (char*)((f)->_next = (f)->_data+(p)) : (char*)0 
)
-
-#define sfstrbase(f)   ((char*)(f)->_data)
-#define sfstrsize(f)   ((f)->_size)
-
-#define sfstrrsrv(f,n) 
(sfreserve(f,(long)(n),1)?(sfwrite(f,(char*)(f)->_next,0),(char*)(f)->_next):(char*)0)
-
-#define sfstruse(f)    (sfputc(f,0), (char*)((f)->_next = (f)->_data) )
-
-#if _BLD_ast && defined(__EXPORT__)
-#define extern         __EXPORT__
-#endif
-
-extern int             sfstrtmp(Sfio_t*, int, void*, size_t);
-
-#undef extern
-
-#endif
diff -r -N -u ksh93_2006_09_12/src/lib/libast/Makefile 
ksh93_2006_10_31/src/lib/libast/Makefile
--- ksh93_2006_09_12/src/lib/libast/Makefile    2006-09-04 18:27:54.000000000 
+0200
+++ ksh93_2006_10_31/src/lib/libast/Makefile    2006-10-20 23:18:04.000000000 
+0200
@@ -12,7 +12,7 @@
 
 CCFLAGS = $(CC.OPTIMIZE) $(CC.DLL)
 
-IFFEFLAGS = -v -X std
+IFFEFLAGS = -v -X ast -X std
 
 .SOURCE : cdt comp dir disc hash man misc obsolete path port preroot \
                regex sfio stdio string tm uwin vec vmalloc
@@ -28,7 +28,7 @@
 __OBSOLETE__ == $("6 months ago":@F=%(%Y0101)T)
 
 HEADERSRC = ast.h ast_dir.h ast_getopt.h ast_std.h \
-       ast_version.h ast_windows.h $(ID)_common.h \
+       ast_version.h ast_windows.h \
        ccode.h cdt.h debug.h dt.h error.h find.h ftw.h ftwalk.h fts.h \
        fs3d.h getopt.h glob.h hash.h hashkey.h hashpart.h int.h lc.h ls.h \
        magic.h mc.h mime.h mnt.h modecanon.h modex.h namval.h option.h \
@@ -40,15 +40,17 @@
        $(HEADERSTD)
 
 HEADERGEN = align.h preroot.h sig.h tmx.h tv.h \
-       $(ID)_botch.h $(ID)_ccode.h $(ID)_fcntl.h \
-       $(ID)_float.h $(ID)_fs.h $(ID)_hdr.h $(ID)_lib.h $(ID)_map.h \
-       $(ID)_mmap.h $(ID)_mode.h $(ID)_param.h $(ID)_time.h $(ID)_tty.h \
-       $(ID)_types.h $(ID)_unistd.h $(ID)_vfork.h $(ID)_wait.h \
+       $(ID)_botch.h $(ID)_ccode.h $(ID)_fcntl.h $(ID)_float.h $(ID)_fs.h \
+       $(ID)_lib.h $(ID)_map.h $(ID)_mmap.h $(ID)_mode.h $(ID)_param.h \
+       $(ID)_sys.h $(ID)_time.h $(ID)_time.h $(ID)_tty.h $(ID)_types.h \
+       $(ID)_vfork.h $(ID)_wait.h $(ID)_limits.h $(ID)_standards.h \
        $(HEADERSTD:/^/$(ID)_/)
 
+HEADEREXP = $(ID)_common.h
+
 HEADEROPT = fmtmsg.h libgen.h syslog.h
 
-HEADERSTD = dirent.h iconv.h limits.h nl_types.h stdio.h wchar.h
+HEADERSTD = dirent.h iconv.h nl_types.h stdio.h wchar.h
 
 $(ID) 5.4 :LIBRARY: README RELEASE \
        LIBAST.3 ast.3 astsa.3 cdt.3 chr.3 compat.3 error.3 find.3 fmt.3 \
@@ -60,7 +62,7 @@
        strsort.3 strtape.3 strton.3 struid.3 swap.3 tab.3 tm.3 tmx.3  \
        tok.3 touch.3 tv.3 vecargs.3 vmalloc.3 \
        $(HEADERSRC) \
-       state.c \
+       state.c transition.c \
        dirlib.h opendir.c readdir.c rewinddir.c seekdir.c telldir.c \
        getcwd.c fastfind.c \
        hashlib.h hashalloc.c hashdump.c hashfree.c hashlast.c \
@@ -112,12 +114,11 @@
        execlp.c execve.c execvp.c execvpe.c spawnveg.c \
        vfork.c killpg.c \
        hsearch.c tsearch.c \
-       getlogin.c putenv.c \
+       getlogin.c putenv.c setenv.c unsetenv.c \
        lstat.c statvfs.c \
        eaccess.c gross.c gross_sgi.h omitted.c \
        fakelink.h readlink.c symlink.c \
        getpgrp.c setpgid.c setsid.c waitpid.c \
-       confmap.c conftab.c confstr.c pathconf.c sysconf.c \
        creat64.c fcntl.c open.c \
        atexit.c getdents.c getwd.c dup2.c errno.c \
        getpreroot.c ispreroot.c realopen.c setpreroot.c \
@@ -136,7 +137,7 @@
        wordexp.c mktime.c \
        /* regex */ \
        reglib.h regalloc.c regclass.c regcoll.c regcomp.c regcache.c \
-       regerror.c regexec.c regfatal.c reginit.c regnexec.c \
+       regdecomp.c regerror.c regexec.c regfatal.c reginit.c regnexec.c \
        regsubcomp.c regsubexec.c regsub.c regrecord.c regrexec.c regstat.c \
        /* cdt */ \
        dthdr.h dtclose.c dtdisc.c dtextract.c dtflatten.c dthash.c \
@@ -187,6 +188,7 @@
        frexp.c frexpl.c \
        /* ast */ \
        astcopy.c astconf.c astdynamic.c astlicense.c astquery.c astwinsize.c \
+       conftab.c \
        $(CC.LD.STATIC) aststatic.c getopt.c getoptl.c $(CC.LD.DYNAMIC) \
        /* vmalloc */ \
        vmalloc.h vmhdr.h vmbest.c vmclear.c vmclose.c vmdcheap.c vmdebug.c \
@@ -221,36 +223,29 @@
 "sol*.*"       :NOOPTIMIZE: sfrd.c sfvprintf.c
 "win32*"       :NOOPTIMIZE: fastfind.c mc.c
 
-:INSTALLDIR: conf
-
-conf :: conf.sh
-
-conflib.h conflim.h confmap.h conftab.h confuni.h \
-confmap.c conftab.c confstr.c pathconf.c sysconf.c :JOINT: \
-               conf conf.tab
-       $(*:O=1:P=A) $(IFFEFLAGS:V:N=-v) $(*:O>1) $(CC) $(CCFLAGS:N!=-[DIU]*)
-
-/* NOTE: sun4 runtime link botches ro data so advertized sig_info is rw */
+/*
+ * NOTE: sun4 runtime link botches ro data so advertized sig_info is rw
+ */
 
-:READONLY: confmap.c conftab.c modedata.c /*sftable.c*/ \
+:READONLY: conftab.c modedata.c /*sftable.c*/ \
        /*sigdata.c*/ tmdata.c univdata.c
 
 :: atmain.C \
        stdgets.c stdprintf.c stdscanf.c stdvbuf.c stdsprnt.c \
        stdvsprnt.c stdvsnprnt.c stdvsscn.c stdopen.c
 
-$(INCLUDEDIR) :INSTALLPROTO: $(HEADERSRC) $(HEADERGEN)
+if "$(PWD:B)" != "cc-*"
 
-$(HEADERGEN) :COPY: FEATURE/$$(<:B:/$(ID)_//)
+$(INCLUDEDIR) :INSTALLPROTO: $(HEADEREXP) $(HEADERSRC) $(HEADERGEN)
 
-/* FEATURE/common for iffe probes, <ast_common.h> for ast source */
+:INSTALLDIR: conf
 
-$(ID)_common.h : FEATURE/$$(<:B:/$(ID)_//)
-       $(SED) 's/if _def_map_ast/if !_def_map_ast/' < $(*) > 1.$(tmp).x
-       if      $(CMP) -s $(<) 1.$(tmp).x
-       then    $(RM) -f 1.$(tmp).x
-       else    $(MV) 1.$(tmp).x $(<)
-       fi
+conf :: conf.sh
+
+conflim.h conftab.h conftab.c :JOINT: conf conf.tab
+       $(*:O=1:P=A) $(IFFEFLAGS:V:N=-v) $(*:O>1) $(CC) $(CCFLAGS:N!=-[DIU]*)
+
+$(HEADERGEN) :COPY: FEATURE/$$(<:B:/$(ID)_//)
 
 lcgen : lcgen.c
        $(CC.NATIVE|CC) -o $(<) $(*)
@@ -258,14 +253,14 @@
 lc.h lctab.h :JOINT: lcgen lc.tab
        $(*:O=1:C,^[^/],./&,) $(tmp).1 $(tmp).2 < $(*:O=2) # :P=E: in 2006
        $(PROTO) -p $(PROTOFLAGS) $(tmp).1 > $(tmp).3
-       rm -f $(tmp).1
-       if      cmp -s $(tmp).3 $(<:O=1)
-       then    rm $(tmp).3
-       else    mv $(tmp).3 $(<:O=1)
+       $(RM) -f $(tmp).1
+       if      $(CMP) -s $(tmp).3 $(<:O=1)
+       then    $(RM) $(tmp).3
+       else    $(MV) $(tmp).3 $(<:O=1)
        fi
-       if      cmp -s $(tmp).2 $(<:O=2)
-       then    rm $(tmp).2
-       else    mv $(tmp).2 $(<:O=2)
+       if      $(CMP) -s $(tmp).2 $(<:O=2)
+       then    $(RM) $(tmp).2
+       else    $(MV) $(tmp).2 $(<:O=2)
        fi
 
 $(LIBDIR)/file/magic :INSTALL: magic.tab
@@ -299,23 +294,21 @@
        else    $(MV) 1.$(tmp).x $(<)
        fi
 
-ast.req : .check.hdr .check.lib
-
 /*
- * atmain.C is the only C++ and only for a few systems
+ * FEATURE/common for iffe probes, <ast_common.h> for ast source
+ * *but* <ast_common.h> may get pulled in by intercepted headers
+ * so both must be built very early
  */
 
-atmain.o : atmain.C
-       ignore $(CC) -c $(CCFLAGS) $(*)
-       if      test ! -f $(<)
-       then    $(CP) $(*) $(*:B:S=.cpp)
-               ignore $(CC) -c $(CCFLAGS) $(*:B:S=.cpp)
-               if      test ! -f $(<)
-               then    $(CP) $(*) $(*:B:S=.c)
-                       $(CC) -c $(CCFLAGS) $(*:B:S=.c)
-               fi
+$(ID)_common.h : .SCAN.IGNORE FEATURE/common
+       $(SED) '/define _def_map_ast/d' < $(*) > 1.$(tmp).x
+       if      $(CMP) -s $(<) 1.$(tmp).x
+       then    $(RM) -f 1.$(tmp).x
+       else    $(MV) 1.$(tmp).x $(<)
        fi
 
+FEATURE/common : .SCAN.IGNORE
+
 /*
  * more stdio.h complications ...
  * prepare for compilation by generating these headers first;
@@ -324,9 +317,20 @@
  */
 
 .check.hdr : .IGNORE .VIRTUAL \
-               FEATURE/standards - ast_common.h - ast_map.h - ast_limits.h - \
-               ast_stdio.h ast_nl_types.h - ast_wchar.h
-       rm -f $(HEADERSTD)      /* clean up pre-2002-03-17 headers */
+               FEATURE/standards - FEATURE/lib - FEATURE/common - \
+               ast_map.h - ast_limits.h - ast_stdio.h ast_nl_types.h - 
ast_wchar.h
+       : clean up obsolete headers :
+       $(RM) -rf $(HEADERSTD) ast_hdr.h ast_types.h ast_unistd.h iffeio.h \
+               $(INCLUDEDIR)/limits.h $(INCLUDEDIR)/unistd.h \
+               $(PACKAGEROOT)/src/lib/libast/std/limits.h
+
+ast.req : .check.hdr .check.lib
+
+else
+
+ast.req : .check.lib
+
+end
 
 /*
  * some systems move -lc routines to -lm
@@ -356,6 +360,21 @@
        esac
        $(RM) -f $(*:N=*.c:B:S=$(CC.SUFFIX.OBJECT))
 
+/*
+ * atmain.C is the only C++ and only for a few systems
+ */
+
+atmain.o : atmain.C
+       ignore $(CC) -c $(CCFLAGS) $(*)
+       if      test ! -f $(<)
+       then    $(CP) $(*) $(*:B:S=.cpp)
+               ignore $(CC) -c $(CCFLAGS) $(*:B:S=.cpp)
+               if      test ! -f $(<)
+               then    $(CP) $(*) $(*:B:S=.c)
+                       $(CC) -c $(CCFLAGS) $(*:B:S=.c)
+               fi
+       fi
+
 /* astsa is a subset of standalone functions that just needs sfio+cdt */
 
 PAXFILTER = ;*.[ch];$(PROTO) $(PROTOFLAGS) -c "" -p
@@ -389,7 +408,7 @@
 $(MINI) : $(MINI)$$(CC.SUFFIX.SHARED)
 
 $(MINI)$$(CC.SUFFIX.SHARED) : $(MINI).sym $(ID)
-       rm -rf $(MINI).tmp
+       $(RM) -rf $(MINI).tmp
        mkdir $(MINI).tmp
        {
        echo LIBRARY $(DLL:F=%(upper)s)
@@ -403,8 +422,8 @@
        cd $(MINI).tmp
        $(LD) $(CCFLAGS:N=-[gG]*) $(CC.SHARED) -o $(DLL) 
$(DLL)$(CC.SUFFIX.LD:O=1) $(*$(ID).so/$(DLL)$(CC.SUFFIX.DYNAMIC):C,^[^-],../&,)
        cd ..
-       mv $(MINI).tmp/$(DLL)$(CC.SUFFIX.SHARED) $(<)
-       rm -rf $(MINI).tmp
+       $(MV) $(MINI).tmp/$(DLL)$(CC.SUFFIX.SHARED) $(<)
+       $(RM) -rf $(MINI).tmp
 
 end
 
diff -r -N -u ksh93_2006_09_12/src/lib/libast/Mamfile 
ksh93_2006_10_31/src/lib/libast/Mamfile
--- ksh93_2006_09_12/src/lib/libast/Mamfile     2006-09-13 06:38:55.000000000 
+0200
+++ ksh93_2006_10_31/src/lib/libast/Mamfile     2006-11-03 03:05:32.000000000 
+0100
@@ -44,15 +44,21 @@
 meta FEATURE/standards features/%>FEATURE/% features/standards standards
 make features/standards
 done features/standards
-exec - iffe -v -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '   
run features/standards
+exec - iffe -v -X ast -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} 
'   run features/standards
 done FEATURE/standards generated
-make ast_common.h
+make FEATURE/lib
+meta FEATURE/lib features/%>FEATURE/% features/lib lib
+make features/lib
+done features/lib
+exec - iffe -v -X ast -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} 
'   run features/lib
+done FEATURE/lib generated
 make FEATURE/common
 meta FEATURE/common features/%>FEATURE/% features/common common
 make features/common
 done features/common
-exec - iffe -v -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '   
run features/common
-make ast_map.h implicit
+exec - iffe -v -X ast -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} 
'   run features/common
+done FEATURE/common generated
+make ast_map.h
 make FEATURE/map
 meta FEATURE/map features/%.c>FEATURE/% features/map.c map
 make features/map.c
@@ -60,55 +66,26 @@
 meta FEATURE/vmalloc features/%>FEATURE/% features/vmalloc vmalloc
 make features/vmalloc
 done features/vmalloc
-exec - iffe -v -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '   
run features/vmalloc
+exec - iffe -v -X ast -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} 
'   run features/vmalloc
 make FEATURE/mmap implicit
 meta FEATURE/mmap features/%>FEATURE/% features/mmap mmap
 make features/mmap
 done features/mmap
-exec - iffe -v -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '   
run features/mmap
+exec - iffe -v -X ast -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} 
'   run features/mmap
 done FEATURE/mmap dontcare generated
 done FEATURE/vmalloc generated
 prev FEATURE/mmap implicit
-make FEATURE/lib implicit
-meta FEATURE/lib features/%>FEATURE/% features/lib lib
-make features/lib
-done features/lib
-exec - iffe -v -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '   
run features/lib
-done FEATURE/lib generated
-make std/stdio.h implicit
-make ast_stdio.h implicit
-make FEATURE/stdio
-meta FEATURE/stdio features/%>FEATURE/% features/stdio stdio
-make features/stdio
-done features/stdio
-exec - iffe -v -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '   
run features/stdio
-make include/sfio_s.h implicit
-done include/sfio_s.h dontcare
-prev ast_common.h implicit
-done FEATURE/stdio generated
-exec - cmp 2>/dev/null -s FEATURE/stdio ast_stdio.h || { rm -f ast_stdio.h; 
silent test -d . || mkdir .; ${STDCP} FEATURE/stdio ast_stdio.h; }
-prev include/sfio_s.h implicit
-prev ast_common.h implicit
-done ast_stdio.h generated
-done std/stdio.h
+prev FEATURE/lib implicit
 done features/map.c
-exec - iffe -v -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -Iinclude -Istd 
 ${LDFLAGS} '   run features/map.c
+exec - iffe -v -X ast -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I.  
${LDFLAGS} '   run features/map.c
 done FEATURE/map generated
 exec - cmp 2>/dev/null -s FEATURE/map ast_map.h || { rm -f ast_map.h; silent 
test -d . || mkdir .; ${STDCP} FEATURE/map ast_map.h; }
-done ast_map.h dontcare generated
-done FEATURE/common generated
-exec - sed 's/if _def_map_ast/if !_def_map_ast/' < FEATURE/common > 
1.${COTEMP}.x
-exec - if      cmp 2>/dev/null -s ast_common.h 1.${COTEMP}.x
-exec - then    rm -f 1.${COTEMP}.x
-exec - else    mv 1.${COTEMP}.x ast_common.h
-exec - fi
-prev ast_map.h implicit
-done ast_common.h dontcare generated
-prev ast_map.h
+done ast_map.h generated
 make ast_limits.h
 make FEATURE/limits
 meta FEATURE/limits features/%.c>FEATURE/% features/limits.c limits
 make features/limits.c
+make joint.conflim.h implicit joint
 make conflim.h implicit
 make conf
 make comp/conf.sh
@@ -151,85 +128,136 @@
 done comp/conf.tab
 exec - ${INSTALLROOT}/src/lib/libast/conf -v comp/conf.tab ${CC} 
${mam_cc_FLAGS} ${CCFLAGS}
 done conflim.h generated
-make joint.conflib.h implicit joint
-make conflib.h implicit
-make FEATURE/wait implicit
-meta FEATURE/wait features/%>FEATURE/% features/wait wait
-make features/wait
-done features/wait
-exec - iffe -v -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '   
run features/wait
-done FEATURE/wait generated
-done conflib.h
-prev conflim.h
-make confmap.h
-done confmap.h generated
 make conftab.h
 done conftab.h generated
-make confuni.h
-done confuni.h generated
-make confmap.c
-done confmap.c generated
 make conftab.c
 done conftab.c generated
-make confstr.c
-done confstr.c generated
-make pathconf.c
-done pathconf.c generated
-make sysconf.c
-done sysconf.c generated
-done joint.conflib.h virtual
+done joint.conflim.h virtual
 make FEATURE/param implicit
 meta FEATURE/param features/%.sh>FEATURE/% features/param.sh param
 make features/param.sh
 done features/param.sh
-exec - iffe -v -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '   
run features/param.sh
+exec - iffe -v -X ast -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} 
'   run features/param.sh
 make error?--?old?ethernet?address?at?wrong?offset implicit
 done error?--?old?ethernet?address?at?wrong?offset dontcare virtual
 done FEATURE/param generated
-make FEATURE/unistd.lcl implicit
-meta FEATURE/unistd.lcl >FEATURE/%  unistd.lcl
-exec - iffe -v -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '   
def unistd.lcl
 make comp/re_comp.h implicit
 done comp/re_comp.h dontcare
 make comp/getopt.h implicit
 make include/ast_getopt.h implicit
 done include/ast_getopt.h dontcare
 done comp/getopt.h dontcare
-done FEATURE/unistd.lcl generated
 prev FEATURE/common implicit
 prev FEATURE/lib implicit
-make FEATURE/limits.lcl implicit
-meta FEATURE/limits.lcl >FEATURE/%  limits.lcl
-exec - iffe -v -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '   
def limits.lcl
-done FEATURE/limits.lcl generated
-prev std/stdio.h implicit
 prev FEATURE/standards implicit
 done features/limits.c
-exec - iffe -v -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -Icomp 
-Iinclude -Istd  ${LDFLAGS} '   run features/limits.c
+exec - iffe -v -X ast -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -Icomp 
-Iinclude  ${LDFLAGS} '   run features/limits.c
 done FEATURE/limits generated
 exec - cmp 2>/dev/null -s FEATURE/limits ast_limits.h || { rm -f ast_limits.h; 
silent test -d . || mkdir .; ${STDCP} FEATURE/limits ast_limits.h; }
 done ast_limits.h generated
-prev ast_stdio.h
+make ast_stdio.h
+make FEATURE/stdio
+meta FEATURE/stdio features/%>FEATURE/% features/stdio stdio
+make features/stdio
+done features/stdio
+exec - iffe -v -X ast -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} 
'   run features/stdio
+make include/sfio_s.h implicit
+done include/sfio_s.h dontcare
+make include/ast_std.h implicit
+make include/regex.h implicit
+make ast_common.h implicit
+prev FEATURE/common
+exec - sed '/define _def_map_ast/d' < FEATURE/common > 1.${COTEMP}.x
+exec - if      cmp 2>/dev/null -s ast_common.h 1.${COTEMP}.x
+exec - then    rm -f 1.${COTEMP}.x
+exec - else    mv 1.${COTEMP}.x ast_common.h
+exec - fi
+prev ast_map.h implicit
+done ast_common.h dontcare generated
+done include/regex.h dontcare
+prev ast_map.h implicit
+make ast_botch.h implicit
+make FEATURE/botch
+meta FEATURE/botch features/%.c>FEATURE/% features/botch.c botch
+make features/botch.c
+make FEATURE/types implicit
+meta FEATURE/types >FEATURE/%  types
+exec - iffe -v -X ast -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} 
'   def types
+done FEATURE/types generated
+prev FEATURE/lib implicit
+done features/botch.c
+exec - iffe -v -X ast -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I.  
${LDFLAGS} '   run features/botch.c
+done FEATURE/botch generated
+exec - cmp 2>/dev/null -s FEATURE/botch ast_botch.h || { rm -f ast_botch.h; 
silent test -d . || mkdir .; ${STDCP} FEATURE/botch ast_botch.h; }
+done ast_botch.h dontcare generated
+prev ast_limits.h implicit
+make ast_fcntl.h implicit
+make FEATURE/fcntl
+meta FEATURE/fcntl features/%.c>FEATURE/% features/fcntl.c fcntl
+make features/fcntl.c
+make FEATURE/tty implicit
+meta FEATURE/tty features/%>FEATURE/% features/tty tty
+make features/tty
+done features/tty
+exec - iffe -v -X ast -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} 
'   run features/tty
+done FEATURE/tty generated
+make FEATURE/fs implicit
+meta FEATURE/fs features/%>FEATURE/% features/fs fs
+make features/fs
+done features/fs
+exec - iffe -v -X ast -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} 
'   run features/fs
+done FEATURE/fs generated
+prev FEATURE/lib implicit
+done features/fcntl.c
+exec - iffe -v -X ast -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -Icomp 
-Iinclude  ${LDFLAGS} '   run features/fcntl.c
+make ast_fs.h implicit
+prev FEATURE/fs
+exec - cmp 2>/dev/null -s FEATURE/fs ast_fs.h || { rm -f ast_fs.h; silent test 
-d . || mkdir .; ${STDCP} FEATURE/fs ast_fs.h; }
+done ast_fs.h dontcare generated
+done FEATURE/fcntl generated
+exec - cmp 2>/dev/null -s FEATURE/fcntl ast_fcntl.h || { rm -f ast_fcntl.h; 
silent test -d . || mkdir .; ${STDCP} FEATURE/fcntl ast_fcntl.h; }
+prev ast_fs.h implicit
+done ast_fcntl.h dontcare generated
+prev include/ast_getopt.h implicit
+make ast_sys.h implicit
+make FEATURE/sys
+meta FEATURE/sys features/%>FEATURE/% features/sys sys
+make features/sys
+done features/sys
+exec - iffe -v -X ast -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} 
'   run features/sys
+make std/stdio.h implicit
+prev ast_stdio.h implicit
+done std/stdio.h dontcare
+prev comp/getopt.h implicit
+done FEATURE/sys generated
+exec - cmp 2>/dev/null -s FEATURE/sys ast_sys.h || { rm -f ast_sys.h; silent 
test -d . || mkdir .; ${STDCP} FEATURE/sys ast_sys.h; }
+done ast_sys.h dontcare generated
+make ast_lib.h implicit
+prev FEATURE/lib
+exec - cmp 2>/dev/null -s FEATURE/lib ast_lib.h || { rm -f ast_lib.h; silent 
test -d . || mkdir .; ${STDCP} FEATURE/lib ast_lib.h; }
+done ast_lib.h dontcare generated
+prev ast_common.h implicit
+done include/ast_std.h dontcare
+done FEATURE/stdio generated
+exec - cmp 2>/dev/null -s FEATURE/stdio ast_stdio.h || { rm -f ast_stdio.h; 
silent test -d . || mkdir .; ${STDCP} FEATURE/stdio ast_stdio.h; }
+prev include/sfio_s.h implicit
+prev include/ast_std.h implicit
+done ast_stdio.h dontcare generated
 make ast_nl_types.h
 make FEATURE/nl_types
 meta FEATURE/nl_types features/%>FEATURE/% features/nl_types nl_types
 make features/nl_types
 done features/nl_types
-exec - iffe -v -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '   
run features/nl_types
-make std/limits.h implicit
-prev ast_limits.h implicit
-done std/limits.h dontcare
+exec - iffe -v -X ast -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} 
'   run features/nl_types
 done FEATURE/nl_types generated
 exec - cmp 2>/dev/null -s FEATURE/nl_types ast_nl_types.h || { rm -f 
ast_nl_types.h; silent test -d . || mkdir .; ${STDCP} FEATURE/nl_types 
ast_nl_types.h; }
-prev std/limits.h implicit
 done ast_nl_types.h generated
 make ast_wchar.h
 make FEATURE/wchar
 meta FEATURE/wchar features/%>FEATURE/% features/wchar wchar
 make features/wchar
 done features/wchar
-exec - iffe -v -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '   
run features/wchar
-prev std/stdio.h implicit
+exec - iffe -v -X ast -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} 
'   run features/wchar
 prev std/stdio.h implicit
 prev std/stdio.h implicit
 prev ast_common.h implicit
@@ -238,7 +266,10 @@
 prev std/stdio.h implicit
 prev ast_common.h implicit
 done ast_wchar.h generated
-exec - rm -f dirent.h iconv.h limits.h nl_types.h stdio.h wchar.h
+exec - : clean up obsolete headers :
+exec - rm -rf dirent.h iconv.h nl_types.h stdio.h wchar.h ast_hdr.h 
ast_types.h ast_unistd.h iffeio.h \
+exec -         ${INSTALLROOT}/include/ast/limits.h 
${INSTALLROOT}/include/ast/unistd.h \
+exec -         ${PACKAGEROOT}/src/lib/libast/std/limits.h
 exec - set -
 exec - echo 'int main(){return 0;}' > 1.${COTEMP}.c
 exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS}   -c 1.${COTEMP}.c &&
@@ -294,124 +325,7 @@
 make include/ast.h implicit
 make include/vmalloc.h implicit
 prev ast_common.h implicit
-make include/ast_std.h implicit
-make ast_botch.h implicit
-make FEATURE/botch
-meta FEATURE/botch features/%.c>FEATURE/% features/botch.c botch
-make features/botch.c
-make FEATURE/types implicit
-meta FEATURE/types features/%>FEATURE/% features/types types
-make features/types
-done features/types
-prev ast.req
-exec - iffe -v -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '   
run features/types
-done FEATURE/types generated
-prev FEATURE/lib implicit
-done features/botch.c
-prev ast.req
-exec - iffe -v -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I.  ${LDFLAGS} '   
run features/botch.c
-done FEATURE/botch generated
-exec - cmp 2>/dev/null -s FEATURE/botch ast_botch.h || { rm -f ast_botch.h; 
silent test -d . || mkdir .; ${STDCP} FEATURE/botch ast_botch.h; }
-done ast_botch.h dontcare generated
-make ast_unistd.h implicit
-make FEATURE/unistd
-meta FEATURE/unistd features/%.c>FEATURE/% features/unistd.c unistd
-make features/unistd.c
-make confuni.h implicit
-done confuni.h
-prev conflib.h implicit
-prev FEATURE/unistd.lcl implicit
-prev FEATURE/limits implicit
-prev FEATURE/lib implicit
-prev std/stdio.h implicit
-prev FEATURE/standards implicit
-done features/unistd.c
-prev ast.req
-exec - iffe -v -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -Icomp 
-Iinclude -Istd  ${LDFLAGS} '   run features/unistd.c
-done FEATURE/unistd generated
-exec - cmp 2>/dev/null -s FEATURE/unistd ast_unistd.h || { rm -f ast_unistd.h; 
silent test -d . || mkdir .; ${STDCP} FEATURE/unistd ast_unistd.h; }
-done ast_unistd.h dontcare generated
-make ast_fcntl.h implicit
-make FEATURE/fcntl
-meta FEATURE/fcntl features/%.c>FEATURE/% features/fcntl.c fcntl
-make features/fcntl.c
-make FEATURE/tty implicit
-meta FEATURE/tty features/%>FEATURE/% features/tty tty
-make features/tty
-done features/tty
-prev ast.req
-exec - iffe -v -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '   
run features/tty
-done FEATURE/tty generated
-make FEATURE/fs implicit
-meta FEATURE/fs features/%>FEATURE/% features/fs fs
-make features/fs
-done features/fs
-prev ast.req
-exec - iffe -v -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '   
run features/fs
-done FEATURE/fs generated
-prev FEATURE/unistd.lcl implicit
-make FEATURE/fcntl.lcl implicit
-meta FEATURE/fcntl.lcl >FEATURE/%  fcntl.lcl
-prev ast.req
-exec - iffe -v -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '   
def fcntl.lcl
-done FEATURE/fcntl.lcl generated
-prev FEATURE/lib implicit
-prev std/stdio.h implicit
-done features/fcntl.c
-prev ast.req
-exec - iffe -v -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -Icomp 
-Iinclude -Istd  ${LDFLAGS} '   run features/fcntl.c
-make include/ls.h implicit
-make ast_mode.h implicit
-make FEATURE/mode
-meta FEATURE/mode features/%.c>FEATURE/% features/mode.c mode
-make features/mode.c
-make include/modecanon.h implicit
-done include/modecanon.h
-prev FEATURE/param implicit
-prev std/limits.h implicit
-prev std/stdio.h implicit
-done features/mode.c
-prev ast.req
-exec - iffe -v -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -Iinclude -Istd 
 ${LDFLAGS} '   run features/mode.c
-done FEATURE/mode generated
-exec - cmp 2>/dev/null -s FEATURE/mode ast_mode.h || { rm -f ast_mode.h; 
silent test -d . || mkdir .; ${STDCP} FEATURE/mode ast_mode.h; }
-done ast_mode.h dontcare generated
-make ast_fs.h implicit
-prev FEATURE/fs
-exec - cmp 2>/dev/null -s FEATURE/fs ast_fs.h || { rm -f ast_fs.h; silent test 
-d . || mkdir .; ${STDCP} FEATURE/fs ast_fs.h; }
-done ast_fs.h dontcare generated
 prev include/ast_std.h implicit
-done include/ls.h dontcare
-prev ast_fs.h implicit
-done FEATURE/fcntl generated
-exec - cmp 2>/dev/null -s FEATURE/fcntl ast_fcntl.h || { rm -f ast_fcntl.h; 
silent test -d . || mkdir .; ${STDCP} FEATURE/fcntl ast_fcntl.h; }
-prev include/ls.h implicit
-prev ast_fs.h implicit
-done ast_fcntl.h dontcare generated
-make ast_types.h implicit
-prev FEATURE/types
-exec - cmp 2>/dev/null -s FEATURE/types ast_types.h || { rm -f ast_types.h; 
silent test -d . || mkdir .; ${STDCP} FEATURE/types ast_types.h; }
-done ast_types.h dontcare generated
-prev ast_map.h implicit
-prev comp/getopt.h implicit
-prev std/limits.h implicit
-make ast_hdr.h implicit
-make FEATURE/hdr
-meta FEATURE/hdr features/%>FEATURE/% features/hdr hdr
-make features/hdr
-done features/hdr
-prev ast.req
-exec - iffe -v -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '   
run features/hdr
-done FEATURE/hdr generated
-exec - cmp 2>/dev/null -s FEATURE/hdr ast_hdr.h || { rm -f ast_hdr.h; silent 
test -d . || mkdir .; ${STDCP} FEATURE/hdr ast_hdr.h; }
-done ast_hdr.h dontcare generated
-prev include/ast_getopt.h implicit
-make ast_lib.h implicit
-prev FEATURE/lib
-exec - cmp 2>/dev/null -s FEATURE/lib ast_lib.h || { rm -f ast_lib.h; silent 
test -d . || mkdir .; ${STDCP} FEATURE/lib ast_lib.h; }
-done ast_lib.h dontcare generated
-prev ast_common.h implicit
-done include/ast_std.h dontcare
 done include/vmalloc.h dontcare
 make include/sfio.h implicit
 prev include/sfio_s.h implicit
@@ -426,6 +340,14 @@
 prev misc/state.c
 exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -Icomp -Iinclude -Istd 
-D_PACKAGE_ast -c misc/state.c
 done state.o generated
+make transition.o
+make comp/transition.c
+prev include/ast.h implicit
+done comp/transition.c
+meta transition.o %.c>%.o comp/transition.c transition
+prev comp/transition.c
+exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -Icomp -Iinclude -Istd 
-D_PACKAGE_ast -c comp/transition.c
+done transition.o generated
 make opendir.o
 make dir/opendir.c
 make dir/dirlib.h implicit
@@ -433,7 +355,6 @@
 done dir/dirstd.h dontcare
 make direntry.h implicit
 done direntry.h dontcare virtual
-prev std/limits.h implicit
 make ast_param.h implicit
 prev FEATURE/param
 exec - cmp 2>/dev/null -s FEATURE/param ast_param.h || { rm -f ast_param.h; 
silent test -d . || mkdir .; ${STDCP} FEATURE/param ast_param.h; }
@@ -447,14 +368,30 @@
 make features/dirent
 done features/dirent
 prev ast.req
-exec - iffe -v -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '   
run features/dirent
+exec - iffe -v -X ast -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} 
'   run features/dirent
 prev include/ast_std.h implicit
 done FEATURE/dirent generated
 exec - cmp 2>/dev/null -s FEATURE/dirent ast_dirent.h || { rm -f ast_dirent.h; 
silent test -d . || mkdir .; ${STDCP} FEATURE/dirent ast_dirent.h; }
 prev include/ast_std.h implicit
 done ast_dirent.h dontcare generated
 done std/dirent.h dontcare
-prev include/ls.h implicit
+make include/ls.h implicit
+make ast_mode.h implicit
+make FEATURE/mode
+meta FEATURE/mode features/%.c>FEATURE/% features/mode.c mode
+make features/mode.c
+make include/modecanon.h implicit
+done include/modecanon.h
+prev FEATURE/param implicit
+done features/mode.c
+prev ast.req
+exec - iffe -v -X ast -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. 
-Iinclude  ${LDFLAGS} '   run features/mode.c
+done FEATURE/mode generated
+exec - cmp 2>/dev/null -s FEATURE/mode ast_mode.h || { rm -f ast_mode.h; 
silent test -d . || mkdir .; ${STDCP} FEATURE/mode ast_mode.h; }
+done ast_mode.h dontcare generated
+prev ast_fs.h implicit
+prev include/ast_std.h implicit
+done include/ls.h dontcare
 prev include/ast.h implicit
 done dir/dirlib.h
 done dir/opendir.c
@@ -522,9 +459,7 @@
 make include/find.h implicit
 done include/find.h dontcare
 prev include/vmalloc.h implicit
-make include/regex.h implicit
-prev ast_common.h implicit
-done include/regex.h dontcare
+prev include/regex.h implicit
 prev include/ls.h implicit
 prev include/error.h implicit
 make include/cdt.h implicit
@@ -667,7 +602,7 @@
 make features/ccode
 done features/ccode
 prev ast.req
-exec - iffe -v -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '   
run features/ccode
+exec - iffe -v -X ast -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} 
'   run features/ccode
 done FEATURE/ccode generated
 exec - cmp 2>/dev/null -s FEATURE/ccode ast_ccode.h || { rm -f ast_ccode.h; 
silent test -d . || mkdir .; ${STDCP} FEATURE/ccode ast_ccode.h; }
 done ast_ccode.h dontcare generated
@@ -799,6 +734,7 @@
 done strmode.o generated
 make strlcat.o
 make string/strlcat.c
+prev ast_map.h implicit
 prev include/ast.h implicit
 done string/strlcat.c
 meta strlcat.o %.c>%.o string/strlcat.c strlcat
@@ -807,8 +743,8 @@
 done strlcat.o generated
 make strlcpy.o
 make string/strlcpy.c
-prev include/ast.h implicit
 prev ast_map.h implicit
+prev include/ast.h implicit
 done string/strlcpy.c
 meta strlcpy.o %.c>%.o string/strlcpy.c strlcpy
 prev string/strlcpy.c
@@ -937,7 +873,7 @@
 make features/time
 done features/time
 prev ast.req
-exec - iffe -v -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '   
run features/time
+exec - iffe -v -X ast -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} 
'   run features/time
 done FEATURE/time generated
 exec - cmp 2>/dev/null -s FEATURE/time ast_time.h || { rm -f ast_time.h; 
silent test -d . || mkdir .; ${STDCP} FEATURE/time ast_time.h; }
 done ast_time.h dontcare generated
@@ -977,11 +913,11 @@
 exec - ./lcgen ${COTEMP}.1 ${COTEMP}.2 < port/lc.tab
 exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv' ${COTEMP}.1 > ${COTEMP}.3
 exec - rm -f ${COTEMP}.1
-exec - if      cmp -s ${COTEMP}.3 lc.h
+exec - if      cmp 2>/dev/null -s ${COTEMP}.3 lc.h
 exec - then    rm ${COTEMP}.3
 exec - else    mv ${COTEMP}.3 lc.h
 exec - fi
-exec - if      cmp -s ${COTEMP}.2 lctab.h
+exec - if      cmp 2>/dev/null -s ${COTEMP}.2 lctab.h
 exec - then    rm ${COTEMP}.2
 exec - else    mv ${COTEMP}.2 lctab.h
 exec - fi
@@ -1018,7 +954,7 @@
 make features/preroot.sh
 done features/preroot.sh
 prev ast.req
-exec - iffe -v -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '   
run features/preroot.sh
+exec - iffe -v -X ast -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} 
'   run features/preroot.sh
 done FEATURE/preroot generated
 exec - cmp 2>/dev/null -s FEATURE/preroot preroot.h || { rm -f preroot.h; 
silent test -d . || mkdir .; ${STDCP} FEATURE/preroot preroot.h; }
 done preroot.h generated
@@ -1060,6 +996,8 @@
 done pathnative.o generated
 make pathposix.o
 make path/pathposix.c
+make uwin.h implicit
+done uwin.h dontcare virtual
 prev include/ast.h implicit
 done path/pathposix.c
 meta pathposix.o %.c>%.o path/pathposix.c pathposix
@@ -1298,13 +1236,14 @@
 done mimetype.o generated
 make signal.o
 make misc/signal.c
+prev ast_map.h implicit
 make sig.h implicit
 make FEATURE/sig
 meta FEATURE/sig features/%.sh>FEATURE/% features/sig.sh sig
 make features/sig.sh
 done features/sig.sh
 prev ast.req
-exec - iffe -v -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '   
run features/sig.sh
+exec - iffe -v -X ast -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} 
'   run features/sig.sh
 done FEATURE/sig generated
 exec - cmp 2>/dev/null -s FEATURE/sig sig.h || { rm -f sig.h; silent test -d . 
|| mkdir .; ${STDCP} FEATURE/sig sig.h; }
 done sig.h generated
@@ -1411,7 +1350,7 @@
 make features/iconv
 done features/iconv
 prev ast.req
-exec - iffe -v -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '   
run features/iconv
+exec - iffe -v -X ast -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} 
'   run features/iconv
 prev include/ccode.h implicit
 prev ast_common.h implicit
 done FEATURE/iconv generated
@@ -1474,7 +1413,7 @@
 make features/float
 done features/float
 prev ast.req
-exec - iffe -v -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '   
run features/float
+exec - iffe -v -X ast -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} 
'   run features/float
 prev ast_common.h implicit
 done FEATURE/float dontcare generated
 make mman.h implicit
@@ -1504,7 +1443,7 @@
 make features/sfio
 done features/sfio
 prev ast.req
-exec - iffe -v -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '   
run features/sfio
+exec - iffe -v -X ast -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} 
'   run features/sfio
 done FEATURE/sfio dontcare generated
 done sfio/sfhdr.h
 done port/mc.c
@@ -1756,11 +1695,12 @@
 done fmtsignal.o generated
 make fmtscale.o
 make string/fmtscale.c
+prev port/lclib.h implicit
 prev include/ast.h implicit
 done string/fmtscale.c
 meta fmtscale.o %.c>%.o string/fmtscale.c fmtscale
 prev string/fmtscale.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -Icomp -Iinclude -Istd 
-D_PACKAGE_ast -c string/fmtscale.c
+exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -Icomp -Iport -Iinclude -Istd 
-I${INSTALLROOT}/include -D_PACKAGE_ast -c string/fmtscale.c
 done fmtscale.o generated
 make fmttmx.o
 make string/fmttmx.c
@@ -1770,7 +1710,7 @@
 make features/tv
 done features/tv
 prev ast.req
-exec - iffe -v -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '   
run features/tv
+exec - iffe -v -X ast -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} 
'   run features/tv
 prev include/ast.h implicit
 done FEATURE/tv generated
 exec - cmp 2>/dev/null -s FEATURE/tv tv.h || { rm -f tv.h; silent test -d . || 
mkdir .; ${STDCP} FEATURE/tv tv.h; }
@@ -1783,7 +1723,7 @@
 prev FEATURE/common implicit
 done features/tmx
 prev ast.req
-exec - iffe -v -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '   
run features/tmx
+exec - iffe -v -X ast -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} 
'   run features/tmx
 prev tv.h implicit
 prev include/tm.h implicit
 done FEATURE/tmx generated
@@ -1877,7 +1817,7 @@
 prev FEATURE/common implicit
 done features/align.c
 prev ast.req
-exec - iffe -v -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I.  ${LDFLAGS} '   
run features/align.c
+exec - iffe -v -X ast -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I.  
${LDFLAGS} '   run features/align.c
 done FEATURE/align generated
 exec - cmp 2>/dev/null -s FEATURE/align align.h || { rm -f align.h; silent 
test -d . || mkdir .; ${STDCP} FEATURE/align align.h; }
 done align.h generated
@@ -1929,10 +1869,9 @@
 make FEATURE/signal implicit
 meta FEATURE/signal features/%.c>FEATURE/% features/signal.c signal
 make features/signal.c
-prev std/stdio.h implicit
 done features/signal.c
 prev ast.req
-exec - iffe -v -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -Iinclude -Istd 
 ${LDFLAGS} '   run features/signal.c
+exec - iffe -v -X ast -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} 
'   run features/signal.c
 done FEATURE/signal generated
 prev sig.h implicit
 prev include/ast.h implicit
@@ -1977,7 +1916,13 @@
 make misc/procclose.c
 make include/wait.h implicit
 make ast_wait.h implicit
-prev FEATURE/wait
+make FEATURE/wait
+meta FEATURE/wait features/%>FEATURE/% features/wait wait
+make features/wait
+done features/wait
+prev ast.req
+exec - iffe -v -X ast -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} 
'   run features/wait
+done FEATURE/wait generated
 exec - cmp 2>/dev/null -s FEATURE/wait ast_wait.h || { rm -f ast_wait.h; 
silent test -d . || mkdir .; ${STDCP} FEATURE/wait ast_wait.h; }
 done ast_wait.h dontcare generated
 prev include/ast.h implicit
@@ -2062,7 +2007,7 @@
 make features/tmlib
 done features/tmlib
 prev ast.req
-exec - iffe -v -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '   
run features/tmlib
+exec - iffe -v -X ast -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} 
'   run features/tmlib
 done FEATURE/tmlib generated
 prev include/namval.h implicit
 prev include/tm.h implicit
@@ -2283,7 +2228,7 @@
 make features/tvlib
 done features/tvlib
 prev ast.req
-exec - iffe -v -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '   
run features/tvlib
+exec - iffe -v -X ast -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} 
'   run features/tvlib
 done FEATURE/tvlib generated
 prev include/tm.h implicit
 prev tv.h implicit
@@ -2504,6 +2449,7 @@
 done rmdir.o generated
 make remove.o
 make comp/remove.c
+prev ast_map.h implicit
 prev include/ast.h implicit
 done comp/remove.c
 meta remove.o %.c>%.o comp/remove.c remove
@@ -2584,6 +2530,9 @@
 make strtold.o
 make comp/strtold.c
 prev sfio/sfstrtof.h implicit
+prev ast_sys.h implicit
+prev ast_lib.h implicit
+prev ast_common.h implicit
 done comp/strtold.c
 meta strtold.o %.c>%.o comp/strtold.c strtold
 prev comp/strtold.c
@@ -2603,6 +2552,8 @@
 make strtoll.o
 make comp/strtoll.c
 prev string/strtoi.h implicit
+prev ast_map.h implicit
+prev include/ast.h implicit
 done comp/strtoll.c
 meta strtoll.o %.c>%.o comp/strtoll.c strtoll
 prev comp/strtoll.c
@@ -2619,6 +2570,8 @@
 make strtoull.o
 make comp/strtoull.c
 prev string/strtoi.h implicit
+prev ast_map.h implicit
+prev include/ast.h implicit
 done comp/strtoull.c
 meta strtoull.o %.c>%.o comp/strtoull.c strtoull
 prev comp/strtoull.c
@@ -2713,7 +2666,7 @@
 make features/errno
 done features/errno
 prev ast.req
-exec - iffe -v -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '   
run features/errno
+exec - iffe -v -X ast -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} 
'   run features/errno
 done FEATURE/errno generated
 prev include/error.h implicit
 prev include/ast.h implicit
@@ -2797,13 +2750,14 @@
 make features/vfork
 done features/vfork
 prev ast.req
-exec - iffe -v -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '   
run features/vfork
+exec - iffe -v -X ast -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} 
'   run features/vfork
 done FEATURE/vfork generated
 exec - cmp 2>/dev/null -s FEATURE/vfork ast_vfork.h || { rm -f ast_vfork.h; 
silent test -d . || mkdir .; ${STDCP} FEATURE/vfork ast_vfork.h; }
 done ast_vfork.h dontcare generated
 prev sig.h implicit
 make process.h implicit
 done process.h dontcare virtual
+prev include/wait.h implicit
 prev include/error.h implicit
 make spawn.h implicit
 done spawn.h dontcare virtual
@@ -2862,12 +2816,31 @@
 done getlogin.o generated
 make putenv.o
 make comp/putenv.c
+prev ast_map.h implicit
 prev include/ast.h implicit
 done comp/putenv.c
 meta putenv.o %.c>%.o comp/putenv.c putenv
 prev comp/putenv.c
 exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -Icomp -Iinclude -Istd 
-D_PACKAGE_ast -c comp/putenv.c
 done putenv.o generated
+make setenv.o
+make comp/setenv.c
+prev ast_map.h implicit
+prev include/ast.h implicit
+done comp/setenv.c
+meta setenv.o %.c>%.o comp/setenv.c setenv
+prev comp/setenv.c
+exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -Icomp -Iinclude -Istd 
-D_PACKAGE_ast -c comp/setenv.c
+done setenv.o generated
+make unsetenv.o
+make comp/unsetenv.c
+prev ast_map.h implicit
+prev include/ast.h implicit
+done comp/unsetenv.c
+meta unsetenv.o %.c>%.o comp/unsetenv.c unsetenv
+prev comp/unsetenv.c
+exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -Icomp -Iinclude -Istd 
-D_PACKAGE_ast -c comp/unsetenv.c
+done unsetenv.o generated
 make lstat.o
 make comp/lstat.c
 prev include/ls.h implicit
@@ -2894,7 +2867,7 @@
 make features/eaccess
 done features/eaccess
 prev ast.req
-exec - iffe -v -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '   
run features/eaccess
+exec - iffe -v -X ast -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} 
'   run features/eaccess
 done FEATURE/eaccess generated
 prev include/ls.h implicit
 prev include/ast.h implicit
@@ -2912,7 +2885,7 @@
 make features/hack
 done features/hack
 prev ast.req
-exec - iffe -v -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '   
run features/hack
+exec - iffe -v -X ast -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} 
'   run features/hack
 done FEATURE/hack generated
 prev include/ls.h implicit
 prev include/ast.h implicit
@@ -2931,7 +2904,7 @@
 make features/omitted
 done features/omitted
 prev ast.req
-exec - iffe -v -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '   
run features/omitted
+exec - iffe -v -X ast -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} 
'   run features/omitted
 done FEATURE/omitted generated
 prev include/tm.h implicit
 prev include/error.h implicit
@@ -3000,61 +2973,6 @@
 prev comp/waitpid.c
 exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -Icomp -Iinclude -Istd 
-D_PACKAGE_ast -c comp/waitpid.c
 done waitpid.o generated
-make confmap.o
-make confmap.c
-make confmap.h implicit
-done confmap.h
-prev FEATURE/unistd.lcl implicit
-prev FEATURE/limits.lcl implicit
-done confmap.c
-meta confmap.o %.c>%.o confmap.c confmap
-prev confmap.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -Icomp -Iinclude  -c confmap.c
-done confmap.o generated
-make conftab.o
-make conftab.c
-make conftab.h implicit
-done conftab.h
-prev include/ast.h implicit
-done conftab.c
-meta conftab.o %.c>%.o conftab.c conftab
-prev conftab.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -Icomp -Iinclude -Istd 
-D_PACKAGE_ast  -c conftab.c
-done conftab.o generated
-make confstr.o
-make confstr.c
-prev conflib.h implicit
-prev confmap.h implicit
-prev include/error.h implicit
-prev include/ast.h implicit
-done confstr.c
-meta confstr.o %.c>%.o confstr.c confstr
-prev confstr.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -Icomp -Iinclude -Istd 
-D_PACKAGE_ast -c confstr.c
-done confstr.o generated
-make pathconf.o
-make pathconf.c
-prev conflib.h implicit
-prev confmap.h implicit
-prev include/ls.h implicit
-prev include/error.h implicit
-prev include/ast.h implicit
-done pathconf.c
-meta pathconf.o %.c>%.o pathconf.c pathconf
-prev pathconf.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -Icomp -Iinclude -Istd 
-D_PACKAGE_ast -c pathconf.c
-done pathconf.o generated
-make sysconf.o
-make sysconf.c
-prev conflib.h implicit
-prev confmap.h implicit
-prev include/error.h implicit
-prev include/ast.h implicit
-done sysconf.c
-meta sysconf.o %.c>%.o sysconf.c sysconf
-prev sysconf.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -Icomp -Iinclude -Istd 
-D_PACKAGE_ast -c sysconf.c
-done sysconf.o generated
 make creat64.o
 make comp/creat64.c
 prev include/ast.h implicit
@@ -3342,13 +3260,11 @@
 done wc.o generated
 make basename.o
 make comp/basename.c
-make comp/libgen.h implicit
-done comp/libgen.h
-prev ast_map.h implicit
+prev ast_common.h implicit
 done comp/basename.c
 meta basename.o %.c>%.o comp/basename.c basename
 prev comp/basename.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -Icomp  -c comp/basename.c
+exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I.  -c comp/basename.c
 done basename.o generated
 make closelog.o
 make comp/closelog.c
@@ -3365,12 +3281,11 @@
 done closelog.o generated
 make dirname.o
 make comp/dirname.c
-prev comp/libgen.h implicit
-prev ast_map.h implicit
+prev ast_common.h implicit
 done comp/dirname.c
 meta dirname.o %.c>%.o comp/dirname.c dirname
 prev comp/dirname.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -Icomp  -c comp/dirname.c
+exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I.  -c comp/dirname.c
 done dirname.o generated
 make fmtmsglib.o
 make comp/fmtmsglib.c
@@ -3473,6 +3388,7 @@
 done re_comp.o generated
 make resolvepath.o
 make comp/resolvepath.c
+prev ast_map.h implicit
 prev include/error.h implicit
 prev include/ast.h implicit
 done comp/resolvepath.c
@@ -3482,6 +3398,7 @@
 done resolvepath.o generated
 make realpath.o
 make comp/realpath.c
+prev ast_map.h implicit
 prev include/ast.h implicit
 done comp/realpath.c
 meta realpath.o %.c>%.o comp/realpath.c realpath
@@ -3492,7 +3409,8 @@
 make comp/regcmp.c
 prev align.h implicit
 prev include/regex.h implicit
-prev comp/libgen.h implicit
+make comp/libgen.h implicit
+done comp/libgen.h
 prev include/ast.h implicit
 done comp/regcmp.c
 meta regcmp.o %.c>%.o comp/regcmp.c regcmp
@@ -3647,6 +3565,14 @@
 prev regex/regcache.c
 exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -Icomp -Iinclude -Istd 
-D_PACKAGE_ast -c regex/regcache.c
 done regcache.o generated
+make regdecomp.o
+make regex/regdecomp.c
+prev regex/reglib.h implicit
+done regex/regdecomp.c
+meta regdecomp.o %.c>%.o regex/regdecomp.c regdecomp
+prev regex/regdecomp.c
+exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -Icomp -Iregex -Iinclude -Istd 
-D_PACKAGE_ast -c regex/regdecomp.c
+done regdecomp.o generated
 make regerror.o
 make regex/regerror.c
 prev regex/reglib.h implicit
@@ -4275,10 +4201,9 @@
 make features/sfinit.c
 prev FEATURE/float implicit
 prev FEATURE/common implicit
-prev std/stdio.h implicit
 done features/sfinit.c
 prev ast.req
-exec - iffe -v -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -Iinclude -Istd 
 ${LDFLAGS} '   run features/sfinit.c
+exec - iffe -v -X ast -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I.  
${LDFLAGS} '   run features/sfinit.c
 done FEATURE/sfinit generated
 prev FEATURE/float implicit
 prev sfio/sfhdr.h implicit
@@ -5031,8 +4956,14 @@
 make _stdfun.o
 make stdio/_stdfun.c
 prev stdio/stdhdr.h implicit
-make uwin.h implicit
-done uwin.h dontcare virtual
+make FEATURE/uwin implicit
+meta FEATURE/uwin features/%>FEATURE/% features/uwin uwin
+make features/uwin
+done features/uwin
+prev ast.req
+exec - iffe -v -X ast -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} 
'   run features/uwin
+done FEATURE/uwin dontcare generated
+prev uwin.h implicit
 prev include/ast_windows.h implicit
 prev include/ast.h implicit
 done stdio/_stdfun.c
@@ -5329,15 +5260,18 @@
 done astcopy.o generated
 make astconf.o
 make port/astconf.c
+make sys.s implicit
+done sys.s dontcare virtual
 make FEATURE/libpath implicit
 meta FEATURE/libpath features/%.sh>FEATURE/% features/libpath.sh libpath
 make features/libpath.sh
 done features/libpath.sh
 prev ast.req
-exec - iffe -v -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '   
run features/libpath.sh
+exec - iffe -v -X ast -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} 
'   run features/libpath.sh
 done FEATURE/libpath generated
-prev conftab.h implicit
-prev confmap.h implicit
+make conftab.h implicit
+done conftab.h
+prev include/proc.h implicit
 prev include/regex.h implicit
 prev include/fs3d.h implicit
 prev include/error.h implicit
@@ -5346,7 +5280,7 @@
 done port/astconf.c
 meta astconf.o %.c>%.o port/astconf.c astconf
 prev port/astconf.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -Icomp -Imisc -Iinclude -Istd 
-DCONF_LIBSUFFIX=\""${mam_cc_SUFFIX_DYNAMIC-${mam_cc_SUFFIX_SHARED}}"\" 
-DCONF_LIBPREFIX=\""${mam_cc_PREFIX_DYNAMIC-${mam_cc_PREFIX_SHARED}}"\" 
-DHOSTTYPE=\""${mam_cc_HOSTTYPE}"\" -D_PACKAGE_ast -c port/astconf.c
+exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -Icomp -Imisc -Iinclude -Istd 
-D__OBSOLETE__=20060101 
-DCONF_LIBSUFFIX=\""${mam_cc_SUFFIX_DYNAMIC-${mam_cc_SUFFIX_SHARED}}"\" 
-DCONF_LIBPREFIX=\""${mam_cc_PREFIX_DYNAMIC-${mam_cc_PREFIX_SHARED}}"\" 
-DHOSTTYPE=\""${mam_cc_HOSTTYPE}"\" -D_PACKAGE_ast -c port/astconf.c
 done astconf.o generated
 make astdynamic.o
 make port/astdynamic.c
@@ -5387,6 +5321,17 @@
 prev port/astwinsize.c
 exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -Icomp -Iinclude -Istd 
-D_PACKAGE_ast -c port/astwinsize.c
 done astwinsize.o generated
+make conftab.o
+make conftab.c
+prev conftab.h implicit
+prev FEATURE/param implicit
+prev FEATURE/common implicit
+prev FEATURE/standards implicit
+done conftab.c
+meta conftab.o %.c>%.o conftab.c conftab
+prev conftab.c
+exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -Icomp -Iinclude  -c conftab.c
+done conftab.o generated
 make aststatic.o
 make port/aststatic.c
 prev include/ast.h implicit
@@ -5587,7 +5532,6 @@
 make malloc.o
 make vmalloc/malloc.c
 prev include/ast_windows.h implicit
-prev std/limits.h implicit
 prev std/stdio.h implicit
 prev vmalloc/vmhdr.h implicit
 done vmalloc/malloc.c
@@ -5605,13 +5549,7 @@
 done vmgetmem.o generated
 make a64l.o
 make uwin/a64l.c
-make FEATURE/uwin implicit
-meta FEATURE/uwin features/%>FEATURE/% features/uwin uwin
-make features/uwin
-done features/uwin
-prev ast.req
-exec - iffe -v -X std -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '   
run features/uwin
-done FEATURE/uwin generated
+prev FEATURE/uwin implicit
 done uwin/a64l.c
 meta a64l.o %.c>%.o uwin/a64l.c a64l
 prev uwin/a64l.c
@@ -5656,12 +5594,12 @@
 done cbrt.o generated
 make crypt.o
 make uwin/crypt.c
-prev std/limits.h implicit
 prev std/stdio.h implicit
+prev FEATURE/uwin implicit
 done uwin/crypt.c
 meta crypt.o %.c>%.o uwin/crypt.c crypt
 prev uwin/crypt.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -Iinclude -Istd  -c uwin/crypt.c
+exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -Icomp -Iinclude -Istd  -c 
uwin/crypt.c
 done crypt.o generated
 make erf.o
 make uwin/erf.c
@@ -5776,7 +5714,6 @@
 done rand48.o generated
 make random.o
 make uwin/random.c
-prev std/limits.h implicit
 prev FEATURE/uwin implicit
 done uwin/random.c
 meta random.o %.c>%.o uwin/random.c random
@@ -5788,11 +5725,11 @@
 prev std/nl_types.h implicit
 make uwin/rlib.h implicit
 prev std/stdio.h implicit
-make include/endian.h implicit
-make include/bytesex.h implicit
+make std/endian.h implicit
+make std/bytesex.h implicit
 prev ast_common.h implicit
-done include/bytesex.h dontcare
-done include/endian.h dontcare
+done std/bytesex.h dontcare
+done std/endian.h dontcare
 prev std/stdio.h implicit
 prev include/ast_std.h implicit
 done uwin/rlib.h dontcare
@@ -5832,17 +5769,18 @@
 make obsolete/spawn.c
 prev include/error.h implicit
 prev include/ast.h implicit
+prev ast_lib.h implicit
 done obsolete/spawn.c
 meta spawn.o %.c>%.o obsolete/spawn.c spawn
 prev obsolete/spawn.c
 exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -Icomp -Iinclude -Istd 
-D_PACKAGE_ast -c obsolete/spawn.c
 done spawn.o generated
-exec - ${AR} cr libast.a state.o opendir.o readdir.o rewinddir.o seekdir.o 
telldir.o getcwd.o fastfind.o hashalloc.o hashdump.o hashfree.o hashlast.o 
hashlook.o hashscan.o hashsize.o hashview.o hashwalk.o memhash.o memsum.o 
strhash.o strkey.o strsum.o stracmp.o strnacmp.o ccmap.o ccmapid.o ccnative.o 
chresc.o chrtoi.o streval.o
-exec - ${AR} cr libast.a strexpr.o strmatch.o strcopy.o modei.o modex.o 
strmode.o strlcat.o strlcpy.o strlook.o strncopy.o strsearch.o strpsearch.o 
stresc.o stropt.o strtape.o tok.o tokline.o tokscan.o pathaccess.o pathcat.o 
pathcanon.o pathcheck.o pathpath.o pathexists.o pathfind.o pathkey.o 
pathprobe.o pathrepl.o pathnative.o pathposix.o pathtemp.o pathtmp.o pathstat.o 
pathgetlink.o pathsetlink.o pathbin.o pathshell.o pathcd.o fs3d.o ftwalk.o 
ftwflags.o fts.o setenviron.o optget.o optjoin.o optesc.o strsort.o struniq.o 
magic.o mime.o mimetype.o signal.o systrace.o error.o errorf.o errormsg.o 
errorx.o localeconv.o setlocale.o translate.o catopen.o iconv.o lc.o mc.o 
liberror.o libevent.o base64.o recfmt.o recstr.o reclen.o fmtrec.o fmtbase.o 
fmtbuf.o fmtclock.o fmtdev.o fmtelapsed.o fmterror.o fmtesc.o fmtfmt.o fmtfs.o 
fmtident.o fmtip4.o fmtls.o fmtmatch.o fmtmode.o fmtnum.o fmtperm.o fmtre.o 
fmttime.o fmtuid.o fmtgid.o fmtsignal.o fmtscale.o fmttmx.o fmttv.o 
fmtversion.o strelapsed.o strperm.o struid.o strgid.o strtoip4.o
-exec - ${AR} cr libast.a stack.o stk.o swapget.o swapmem.o swapop.o swapput.o 
sigdata.o sigcrit.o sigunblock.o procopen.o procclose.o procrun.o procfree.o 
tmdate.o tmequiv.o tmfix.o tmfmt.o tmform.o tmgoff.o tminit.o tmleap.o tmlex.o 
tmlocale.o tmmake.o tmpoff.o tmscan.o tmsleep.o tmtime.o tmtype.o tmweek.o 
tmword.o tmzone.o tmxdate.o tmxfmt.o tmxgettime.o tmxleap.o tmxmake.o tmxscan.o 
tmxsettime.o tmxsleep.o tmxtime.o tmxtouch.o tvcmp.o tvgettime.o tvsettime.o 
tvsleep.o tvtouch.o vecargs.o vecfile.o vecfree.o vecload.o vecstring.o 
univdata.o touch.o mnt.o memccpy.o memchr.o memcmp.o memcpy.o memdup.o 
memmove.o memset.o mkdir.o mkfifo.o mknod.o rmdir.o remove.o rename.o link.o 
unlink.o strdup.o strchr.o strrchr.o strstr.o strtod.o strtold.o strtol.o 
strtoll.o strtoul.o strtoull.o strton.o strtonll.o strntod.o strntold.o 
strntol.o strntoll.o strntoul.o strntoull.o strcasecmp.o strncasecmp.o 
strerror.o mktemp.o tmpnam.o fsync.o execlp.o execve.o execvp.o execvpe.o 
spawnveg.o vfork.o killpg.o
-exec - ${AR} cr libast.a hsearch.o tsearch.o getlogin.o putenv.o lstat.o 
statvfs.o eaccess.o gross.o omitted.o readlink.o symlink.o getpgrp.o setpgid.o 
setsid.o waitpid.o confmap.o conftab.o confstr.o pathconf.o sysconf.o creat64.o 
fcntl.o open.o atexit.o getdents.o getwd.o dup2.o errno.o getpreroot.o 
ispreroot.o realopen.o setpreroot.o getgroups.o mount.o system.o iblocks.o 
modedata.o tmdata.o memfatal.o sfkeyprintf.o sfdcdio.o sfdcdos.o sfdcfilter.o 
sfdcseekable.o sfdcslow.o sfdcsubstr.o sfdctee.o sfdcunion.o sfdcmore.o 
sfdcprefix.o wc.o basename.o closelog.o dirname.o fmtmsglib.o fnmatch.o ftw.o 
getdate.o getsubopt.o glob.o nftw.o openlog.o re_comp.o resolvepath.o 
realpath.o regcmp.o regexp.o setlogmask.o strftime.o strptime.o swab.o syslog.o 
tempnam.o wordexp.o mktime.o regalloc.o regclass.o regcoll.o regcomp.o 
regcache.o regerror.o regexec.o regfatal.o reginit.o regnexec.o regsubcomp.o 
regsubexec.o regsub.o regrecord.o regrexec.o regstat.o dtclose.o dtdisc.o 
dtextract.o dtflatten.o dthash.o dtlist.o dtmethod.o dtnew.o dtopen.o dtrenew.o
-exec - ${AR} cr libast.a dtrestore.o dtsize.o dtstat.o dtstrhash.o dttree.o 
dttreeset.o dtview.o dtwalk.o sfclose.o sfclrlock.o sfdisc.o sfdlen.o 
sfexcept.o sfgetl.o sfgetu.o sfcvt.o sfecvt.o sffcvt.o sfextern.o sffilbuf.o 
sfflsbuf.o sfprints.o sfgetd.o sfgetr.o sfieee.o sfllen.o sfmode.o sfmove.o 
sfnew.o sfpkrd.o sfnotify.o sfnputc.o sfopen.o sfpeek.o sfpoll.o sfpool.o 
sfpopen.o sfprintf.o sfputd.o sfputl.o sfputr.o sfputu.o sfrd.o sfread.o 
sfreserve.o sfscanf.o sfseek.o sfset.o sfsetbuf.o sfsetfd.o sfsize.o sfsk.o 
sfstack.o sfstrtod.o sfsync.o sfswap.o sftable.o sftell.o sftmp.o sfungetc.o 
sfvprintf.o sfvscanf.o sfwr.o sfwrite.o sfpurge.o sfraise.o sfgetm.o sfmutex.o 
sfputm.o sfresize.o _sfclrerr.o _sfeof.o _sferror.o _sffileno.o _sfopen.o 
_sfstacked.o _sfvalue.o _sfgetc.o _sfgetl.o _sfgetl2.o _sfgetu.o _sfgetu2.o 
_sfdlen.o _sfllen.o _sfslen.o _sfulen.o _sfputc.o _sfputd.o _sfputl.o _sfputm.o 
_sfputu.o clearerr.o fclose.o fdopen.o feof.o ferror.o fflush.o fgetc.o 
fgetpos.o fgets.o fileno.o
-exec - ${AR} cr libast.a fopen.o fprintf.o fpurge.o fputc.o fputs.o fread.o 
freopen.o fscanf.o fseek.o fseeko.o fsetpos.o ftell.o ftello.o fwrite.o getc.o 
getchar.o getw.o pclose.o popen.o printf.o putc.o putchar.o puts.o putw.o 
rewind.o scanf.o setbuf.o setbuffer.o setlinebuf.o setvbuf.o snprintf.o 
sprintf.o sscanf.o asprintf.o vasprintf.o tmpfile.o ungetc.o vfprintf.o 
vfscanf.o vprintf.o vscanf.o vsnprintf.o vsprintf.o vsscanf.o _doprnt.o 
_doscan.o _filbuf.o _flsbuf.o _stdfun.o _stdopen.o _stdprintf.o _stdscanf.o 
_stdsprnt.o _stdvbuf.o _stdvsnprnt.o _stdvsprnt.o _stdvsscn.o fgetwc.o 
fwprintf.o putwchar.o vfwscanf.o wprintf.o fgetws.o fwscanf.o swprintf.o 
vswprintf.o wscanf.o fputwc.o getwc.o swscanf.o vswscanf.o fputws.o getwchar.o 
ungetwc.o vwprintf.o fwide.o putwc.o vfwprintf.o vwscanf.o stdio_c99.o 
stdio_gnu.o frexp.o frexpl.o astcopy.o astconf.o astdynamic.o astlicense.o 
astquery.o astwinsize.o aststatic.o getopt.o getoptl.o vmbest.o vmclear.o 
vmclose.o vmdcheap.o vmdebug.o vmdisc.o vmexit.o vmlast.o vmopen.o
+exec - ${AR} cr libast.a state.o transition.o opendir.o readdir.o rewinddir.o 
seekdir.o telldir.o getcwd.o fastfind.o hashalloc.o hashdump.o hashfree.o 
hashlast.o hashlook.o hashscan.o hashsize.o hashview.o hashwalk.o memhash.o 
memsum.o strhash.o strkey.o strsum.o stracmp.o strnacmp.o ccmap.o ccmapid.o 
ccnative.o chresc.o chrtoi.o
+exec - ${AR} cr libast.a streval.o strexpr.o strmatch.o strcopy.o modei.o 
modex.o strmode.o strlcat.o strlcpy.o strlook.o strncopy.o strsearch.o 
strpsearch.o stresc.o stropt.o strtape.o tok.o tokline.o tokscan.o pathaccess.o 
pathcat.o pathcanon.o pathcheck.o pathpath.o pathexists.o pathfind.o pathkey.o 
pathprobe.o pathrepl.o pathnative.o pathposix.o pathtemp.o pathtmp.o pathstat.o 
pathgetlink.o pathsetlink.o pathbin.o pathshell.o pathcd.o fs3d.o ftwalk.o 
ftwflags.o fts.o setenviron.o optget.o optjoin.o optesc.o strsort.o struniq.o 
magic.o mime.o mimetype.o signal.o systrace.o error.o errorf.o errormsg.o 
errorx.o localeconv.o setlocale.o translate.o catopen.o iconv.o lc.o mc.o 
liberror.o libevent.o base64.o recfmt.o recstr.o reclen.o fmtrec.o fmtbase.o 
fmtbuf.o fmtclock.o fmtdev.o fmtelapsed.o fmterror.o fmtesc.o fmtfmt.o fmtfs.o 
fmtident.o fmtip4.o fmtls.o fmtmatch.o fmtmode.o fmtnum.o fmtperm.o fmtre.o 
fmttime.o fmtuid.o fmtgid.o fmtsignal.o fmtscale.o fmttmx.o fmttv.o 
fmtversion.o strelapsed.o strperm.o struid.o strgid.o
+exec - ${AR} cr libast.a strtoip4.o stack.o stk.o swapget.o swapmem.o swapop.o 
swapput.o sigdata.o sigcrit.o sigunblock.o procopen.o procclose.o procrun.o 
procfree.o tmdate.o tmequiv.o tmfix.o tmfmt.o tmform.o tmgoff.o tminit.o 
tmleap.o tmlex.o tmlocale.o tmmake.o tmpoff.o tmscan.o tmsleep.o tmtime.o 
tmtype.o tmweek.o tmword.o tmzone.o tmxdate.o tmxfmt.o tmxgettime.o tmxleap.o 
tmxmake.o tmxscan.o tmxsettime.o tmxsleep.o tmxtime.o tmxtouch.o tvcmp.o 
tvgettime.o tvsettime.o tvsleep.o tvtouch.o vecargs.o vecfile.o vecfree.o 
vecload.o vecstring.o univdata.o touch.o mnt.o memccpy.o memchr.o memcmp.o 
memcpy.o memdup.o memmove.o memset.o mkdir.o mkfifo.o mknod.o rmdir.o remove.o 
rename.o link.o unlink.o strdup.o strchr.o strrchr.o strstr.o strtod.o 
strtold.o strtol.o strtoll.o strtoul.o strtoull.o strton.o strtonll.o strntod.o 
strntold.o strntol.o strntoll.o strntoul.o strntoull.o strcasecmp.o 
strncasecmp.o strerror.o mktemp.o tmpnam.o fsync.o execlp.o execve.o execvp.o 
execvpe.o spawnveg.o vfork.o
+exec - ${AR} cr libast.a killpg.o hsearch.o tsearch.o getlogin.o putenv.o 
setenv.o unsetenv.o lstat.o statvfs.o eaccess.o gross.o omitted.o readlink.o 
symlink.o getpgrp.o setpgid.o setsid.o waitpid.o creat64.o fcntl.o open.o 
atexit.o getdents.o getwd.o dup2.o errno.o getpreroot.o ispreroot.o realopen.o 
setpreroot.o getgroups.o mount.o system.o iblocks.o modedata.o tmdata.o 
memfatal.o sfkeyprintf.o sfdcdio.o sfdcdos.o sfdcfilter.o sfdcseekable.o 
sfdcslow.o sfdcsubstr.o sfdctee.o sfdcunion.o sfdcmore.o sfdcprefix.o wc.o 
basename.o closelog.o dirname.o fmtmsglib.o fnmatch.o ftw.o getdate.o 
getsubopt.o glob.o nftw.o openlog.o re_comp.o resolvepath.o realpath.o regcmp.o 
regexp.o setlogmask.o strftime.o strptime.o swab.o syslog.o tempnam.o wordexp.o 
mktime.o regalloc.o regclass.o regcoll.o regcomp.o regcache.o regdecomp.o 
regerror.o regexec.o regfatal.o reginit.o regnexec.o regsubcomp.o regsubexec.o 
regsub.o regrecord.o regrexec.o regstat.o dtclose.o dtdisc.o dtextract.o 
dtflatten.o dthash.o dtlist.o dtmethod.o dtnew.o dtopen.o dtrenew.o dtrestore.o
+exec - ${AR} cr libast.a dtsize.o dtstat.o dtstrhash.o dttree.o dttreeset.o 
dtview.o dtwalk.o sfclose.o sfclrlock.o sfdisc.o sfdlen.o sfexcept.o sfgetl.o 
sfgetu.o sfcvt.o sfecvt.o sffcvt.o sfextern.o sffilbuf.o sfflsbuf.o sfprints.o 
sfgetd.o sfgetr.o sfieee.o sfllen.o sfmode.o sfmove.o sfnew.o sfpkrd.o 
sfnotify.o sfnputc.o sfopen.o sfpeek.o sfpoll.o sfpool.o sfpopen.o sfprintf.o 
sfputd.o sfputl.o sfputr.o sfputu.o sfrd.o sfread.o sfreserve.o sfscanf.o 
sfseek.o sfset.o sfsetbuf.o sfsetfd.o sfsize.o sfsk.o sfstack.o sfstrtod.o 
sfsync.o sfswap.o sftable.o sftell.o sftmp.o sfungetc.o sfvprintf.o sfvscanf.o 
sfwr.o sfwrite.o sfpurge.o sfraise.o sfgetm.o sfmutex.o sfputm.o sfresize.o 
_sfclrerr.o _sfeof.o _sferror.o _sffileno.o _sfopen.o _sfstacked.o _sfvalue.o 
_sfgetc.o _sfgetl.o _sfgetl2.o _sfgetu.o _sfgetu2.o _sfdlen.o _sfllen.o 
_sfslen.o _sfulen.o _sfputc.o _sfputd.o _sfputl.o _sfputm.o _sfputu.o 
clearerr.o fclose.o fdopen.o feof.o ferror.o fflush.o fgetc.o fgetpos.o fgets.o 
fileno.o fopen.o
+exec - ${AR} cr libast.a fprintf.o fpurge.o fputc.o fputs.o fread.o freopen.o 
fscanf.o fseek.o fseeko.o fsetpos.o ftell.o ftello.o fwrite.o getc.o getchar.o 
getw.o pclose.o popen.o printf.o putc.o putchar.o puts.o putw.o rewind.o 
scanf.o setbuf.o setbuffer.o setlinebuf.o setvbuf.o snprintf.o sprintf.o 
sscanf.o asprintf.o vasprintf.o tmpfile.o ungetc.o vfprintf.o vfscanf.o 
vprintf.o vscanf.o vsnprintf.o vsprintf.o vsscanf.o _doprnt.o _doscan.o 
_filbuf.o _flsbuf.o _stdfun.o _stdopen.o _stdprintf.o _stdscanf.o _stdsprnt.o 
_stdvbuf.o _stdvsnprnt.o _stdvsprnt.o _stdvsscn.o fgetwc.o fwprintf.o 
putwchar.o vfwscanf.o wprintf.o fgetws.o fwscanf.o swprintf.o vswprintf.o 
wscanf.o fputwc.o getwc.o swscanf.o vswscanf.o fputws.o getwchar.o ungetwc.o 
vwprintf.o fwide.o putwc.o vfwprintf.o vwscanf.o stdio_c99.o stdio_gnu.o 
frexp.o frexpl.o astcopy.o astconf.o astdynamic.o astlicense.o astquery.o 
astwinsize.o conftab.o aststatic.o getopt.o getoptl.o vmbest.o vmclear.o 
vmclose.o vmdcheap.o vmdebug.o vmdisc.o vmexit.o vmlast.o vmopen.o
 exec - ${AR} cr libast.a vmpool.o vmprivate.o vmprofile.o vmregion.o 
vmsegment.o vmset.o vmstat.o vmstrdup.o vmtrace.o vmwalk.o vmmopen.o malloc.o 
vmgetmem.o a64l.o acosh.o asinh.o atanh.o cbrt.o crypt.o erf.o err.o exp.o 
exp__E.o expm1.o gamma.o getpass.o lgamma.o log.o log1p.o log__L.o rand48.o 
random.o rcmd.o rint.o support.o sfstrtmp.o spawn.o
 exec - (ranlib libast.a) >/dev/null 2>&1 || true
 done libast.a generated
@@ -6160,10 +6098,18 @@
 exec - then    mkdir -p ${INSTALLROOT}/include/ast
 exec - fi
 done ${INSTALLROOT}/include/ast generated
-make ${INSTALLROOT}/include/ast/ast.h
+make ${INSTALLROOT}/include/ast/ast_common.h
 prev ${INSTALLROOT}/include/ast
+prev ast_common.h
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  ast_common.h  > 1.${COTEMP}.x
+exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/ast_common.h 
1.${COTEMP}.x
+exec - then    rm -f 1.${COTEMP}.x
+exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/ast_common.h
+exec - fi
+done ${INSTALLROOT}/include/ast/ast_common.h generated
+make ${INSTALLROOT}/include/ast/ast.h
 prev include/ast.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/ast.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/ast.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/ast.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/ast.h
@@ -6171,7 +6117,7 @@
 done ${INSTALLROOT}/include/ast/ast.h generated
 make ${INSTALLROOT}/include/ast/ast_dir.h
 prev include/ast_dir.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/ast_dir.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/ast_dir.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/ast_dir.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/ast_dir.h
@@ -6179,7 +6125,7 @@
 done ${INSTALLROOT}/include/ast/ast_dir.h generated
 make ${INSTALLROOT}/include/ast/ast_getopt.h
 prev include/ast_getopt.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/ast_getopt.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/ast_getopt.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/ast_getopt.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/ast_getopt.h
@@ -6187,7 +6133,7 @@
 done ${INSTALLROOT}/include/ast/ast_getopt.h generated
 make ${INSTALLROOT}/include/ast/ast_std.h
 prev include/ast_std.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/ast_std.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/ast_std.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/ast_std.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/ast_std.h
@@ -6195,7 +6141,7 @@
 done ${INSTALLROOT}/include/ast/ast_std.h generated
 make ${INSTALLROOT}/include/ast/ast_version.h
 prev include/ast_version.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/ast_version.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/ast_version.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/ast_version.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/ast_version.h
@@ -6203,23 +6149,15 @@
 done ${INSTALLROOT}/include/ast/ast_version.h generated
 make ${INSTALLROOT}/include/ast/ast_windows.h
 prev include/ast_windows.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/ast_windows.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/ast_windows.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/ast_windows.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/ast_windows.h
 exec - fi
 done ${INSTALLROOT}/include/ast/ast_windows.h generated
-make ${INSTALLROOT}/include/ast/ast_common.h
-prev ast_common.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  ast_common.h > 1.${COTEMP}.x
-exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/ast_common.h 
1.${COTEMP}.x
-exec - then    rm -f 1.${COTEMP}.x
-exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/ast_common.h
-exec - fi
-done ${INSTALLROOT}/include/ast/ast_common.h generated
 make ${INSTALLROOT}/include/ast/ccode.h
 prev include/ccode.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/ccode.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/ccode.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/ccode.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/ccode.h
@@ -6227,7 +6165,7 @@
 done ${INSTALLROOT}/include/ast/ccode.h generated
 make ${INSTALLROOT}/include/ast/cdt.h
 prev include/cdt.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/cdt.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/cdt.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/cdt.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/cdt.h
@@ -6235,7 +6173,7 @@
 done ${INSTALLROOT}/include/ast/cdt.h generated
 make ${INSTALLROOT}/include/ast/debug.h
 prev include/debug.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/debug.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/debug.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/debug.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/debug.h
@@ -6243,7 +6181,7 @@
 done ${INSTALLROOT}/include/ast/debug.h generated
 make ${INSTALLROOT}/include/ast/dt.h
 prev include/dt.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/dt.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/dt.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/dt.h 1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/dt.h
@@ -6251,7 +6189,7 @@
 done ${INSTALLROOT}/include/ast/dt.h generated
 make ${INSTALLROOT}/include/ast/error.h
 prev include/error.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/error.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/error.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/error.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/error.h
@@ -6259,7 +6197,7 @@
 done ${INSTALLROOT}/include/ast/error.h generated
 make ${INSTALLROOT}/include/ast/find.h
 prev include/find.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/find.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/find.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/find.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/find.h
@@ -6267,7 +6205,7 @@
 done ${INSTALLROOT}/include/ast/find.h generated
 make ${INSTALLROOT}/include/ast/ftw.h
 prev comp/ftw.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  comp/ftw.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  comp/ftw.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/ftw.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/ftw.h
@@ -6275,7 +6213,7 @@
 done ${INSTALLROOT}/include/ast/ftw.h generated
 make ${INSTALLROOT}/include/ast/ftwalk.h
 prev include/ftwalk.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/ftwalk.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/ftwalk.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/ftwalk.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/ftwalk.h
@@ -6283,7 +6221,7 @@
 done ${INSTALLROOT}/include/ast/ftwalk.h generated
 make ${INSTALLROOT}/include/ast/fts.h
 prev include/fts.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/fts.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/fts.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/fts.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/fts.h
@@ -6291,7 +6229,7 @@
 done ${INSTALLROOT}/include/ast/fts.h generated
 make ${INSTALLROOT}/include/ast/fs3d.h
 prev include/fs3d.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/fs3d.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/fs3d.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/fs3d.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/fs3d.h
@@ -6299,7 +6237,7 @@
 done ${INSTALLROOT}/include/ast/fs3d.h generated
 make ${INSTALLROOT}/include/ast/getopt.h
 prev comp/getopt.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  comp/getopt.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  comp/getopt.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/getopt.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/getopt.h
@@ -6307,7 +6245,7 @@
 done ${INSTALLROOT}/include/ast/getopt.h generated
 make ${INSTALLROOT}/include/ast/glob.h
 prev include/glob.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/glob.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/glob.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/glob.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/glob.h
@@ -6315,7 +6253,7 @@
 done ${INSTALLROOT}/include/ast/glob.h generated
 make ${INSTALLROOT}/include/ast/hash.h
 prev include/hash.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/hash.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/hash.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/hash.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/hash.h
@@ -6323,7 +6261,7 @@
 done ${INSTALLROOT}/include/ast/hash.h generated
 make ${INSTALLROOT}/include/ast/hashkey.h
 prev include/hashkey.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/hashkey.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/hashkey.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/hashkey.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/hashkey.h
@@ -6331,7 +6269,7 @@
 done ${INSTALLROOT}/include/ast/hashkey.h generated
 make ${INSTALLROOT}/include/ast/hashpart.h
 prev include/hashpart.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/hashpart.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/hashpart.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/hashpart.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/hashpart.h
@@ -6339,7 +6277,7 @@
 done ${INSTALLROOT}/include/ast/hashpart.h generated
 make ${INSTALLROOT}/include/ast/int.h
 prev include/int.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/int.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/int.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/int.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/int.h
@@ -6347,7 +6285,7 @@
 done ${INSTALLROOT}/include/ast/int.h generated
 make ${INSTALLROOT}/include/ast/lc.h
 prev lc.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  lc.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  lc.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/lc.h 1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/lc.h
@@ -6355,7 +6293,7 @@
 done ${INSTALLROOT}/include/ast/lc.h generated
 make ${INSTALLROOT}/include/ast/ls.h
 prev include/ls.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/ls.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/ls.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/ls.h 1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/ls.h
@@ -6363,7 +6301,7 @@
 done ${INSTALLROOT}/include/ast/ls.h generated
 make ${INSTALLROOT}/include/ast/magic.h
 prev include/magic.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/magic.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/magic.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/magic.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/magic.h
@@ -6371,7 +6309,7 @@
 done ${INSTALLROOT}/include/ast/magic.h generated
 make ${INSTALLROOT}/include/ast/mc.h
 prev include/mc.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/mc.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/mc.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/mc.h 1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/mc.h
@@ -6379,7 +6317,7 @@
 done ${INSTALLROOT}/include/ast/mc.h generated
 make ${INSTALLROOT}/include/ast/mime.h
 prev include/mime.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/mime.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/mime.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/mime.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/mime.h
@@ -6387,7 +6325,7 @@
 done ${INSTALLROOT}/include/ast/mime.h generated
 make ${INSTALLROOT}/include/ast/mnt.h
 prev include/mnt.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/mnt.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/mnt.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/mnt.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/mnt.h
@@ -6395,7 +6333,7 @@
 done ${INSTALLROOT}/include/ast/mnt.h generated
 make ${INSTALLROOT}/include/ast/modecanon.h
 prev include/modecanon.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/modecanon.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/modecanon.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/modecanon.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/modecanon.h
@@ -6403,7 +6341,7 @@
 done ${INSTALLROOT}/include/ast/modecanon.h generated
 make ${INSTALLROOT}/include/ast/modex.h
 prev include/modex.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/modex.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/modex.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/modex.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/modex.h
@@ -6411,7 +6349,7 @@
 done ${INSTALLROOT}/include/ast/modex.h generated
 make ${INSTALLROOT}/include/ast/namval.h
 prev include/namval.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/namval.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/namval.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/namval.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/namval.h
@@ -6419,7 +6357,7 @@
 done ${INSTALLROOT}/include/ast/namval.h generated
 make ${INSTALLROOT}/include/ast/option.h
 prev include/option.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/option.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/option.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/option.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/option.h
@@ -6427,7 +6365,7 @@
 done ${INSTALLROOT}/include/ast/option.h generated
 make ${INSTALLROOT}/include/ast/proc.h
 prev include/proc.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/proc.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/proc.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/proc.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/proc.h
@@ -6435,7 +6373,7 @@
 done ${INSTALLROOT}/include/ast/proc.h generated
 make ${INSTALLROOT}/include/ast/re_comp.h
 prev comp/re_comp.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  comp/re_comp.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  comp/re_comp.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/re_comp.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/re_comp.h
@@ -6443,7 +6381,7 @@
 done ${INSTALLROOT}/include/ast/re_comp.h generated
 make ${INSTALLROOT}/include/ast/recfmt.h
 prev include/recfmt.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/recfmt.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/recfmt.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/recfmt.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/recfmt.h
@@ -6451,7 +6389,7 @@
 done ${INSTALLROOT}/include/ast/recfmt.h generated
 make ${INSTALLROOT}/include/ast/regex.h
 prev include/regex.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/regex.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/regex.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/regex.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/regex.h
@@ -6459,7 +6397,7 @@
 done ${INSTALLROOT}/include/ast/regex.h generated
 make ${INSTALLROOT}/include/ast/regexp.h
 prev comp/regexp.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  comp/regexp.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  comp/regexp.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/regexp.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/regexp.h
@@ -6467,7 +6405,7 @@
 done ${INSTALLROOT}/include/ast/regexp.h generated
 make ${INSTALLROOT}/include/ast/sfio.h
 prev include/sfio.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/sfio.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/sfio.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/sfio.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/sfio.h
@@ -6475,7 +6413,7 @@
 done ${INSTALLROOT}/include/ast/sfio.h generated
 make ${INSTALLROOT}/include/ast/sfio_s.h
 prev include/sfio_s.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/sfio_s.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/sfio_s.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/sfio_s.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/sfio_s.h
@@ -6483,7 +6421,7 @@
 done ${INSTALLROOT}/include/ast/sfio_s.h generated
 make ${INSTALLROOT}/include/ast/sfio_t.h
 prev include/sfio_t.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/sfio_t.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/sfio_t.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/sfio_t.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/sfio_t.h
@@ -6491,7 +6429,7 @@
 done ${INSTALLROOT}/include/ast/sfio_t.h generated
 make ${INSTALLROOT}/include/ast/sfdisc.h
 prev include/sfdisc.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/sfdisc.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/sfdisc.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/sfdisc.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/sfdisc.h
@@ -6499,7 +6437,7 @@
 done ${INSTALLROOT}/include/ast/sfdisc.h generated
 make ${INSTALLROOT}/include/ast/stack.h
 prev include/stack.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/stack.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/stack.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/stack.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/stack.h
@@ -6507,7 +6445,7 @@
 done ${INSTALLROOT}/include/ast/stack.h generated
 make ${INSTALLROOT}/include/ast/stak.h
 prev include/stak.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/stak.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/stak.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/stak.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/stak.h
@@ -6515,7 +6453,7 @@
 done ${INSTALLROOT}/include/ast/stak.h generated
 make ${INSTALLROOT}/include/ast/stk.h
 prev include/stk.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/stk.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/stk.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/stk.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/stk.h
@@ -6523,7 +6461,7 @@
 done ${INSTALLROOT}/include/ast/stk.h generated
 make ${INSTALLROOT}/include/ast/swap.h
 prev include/swap.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/swap.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/swap.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/swap.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/swap.h
@@ -6532,7 +6470,7 @@
 make ${INSTALLROOT}/include/ast/tar.h
 make include/tar.h
 done include/tar.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/tar.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/tar.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/tar.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/tar.h
@@ -6540,7 +6478,7 @@
 done ${INSTALLROOT}/include/ast/tar.h generated
 make ${INSTALLROOT}/include/ast/times.h
 prev include/times.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/times.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/times.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/times.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/times.h
@@ -6548,7 +6486,7 @@
 done ${INSTALLROOT}/include/ast/times.h generated
 make ${INSTALLROOT}/include/ast/tm.h
 prev include/tm.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/tm.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/tm.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/tm.h 1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/tm.h
@@ -6556,7 +6494,7 @@
 done ${INSTALLROOT}/include/ast/tm.h generated
 make ${INSTALLROOT}/include/ast/tok.h
 prev include/tok.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/tok.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/tok.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/tok.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/tok.h
@@ -6565,7 +6503,7 @@
 make ${INSTALLROOT}/include/ast/usage.h
 make include/usage.h
 done include/usage.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/usage.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/usage.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/usage.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/usage.h
@@ -6574,7 +6512,7 @@
 make ${INSTALLROOT}/include/ast/vdb.h
 make include/vdb.h
 done include/vdb.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/vdb.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/vdb.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/vdb.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/vdb.h
@@ -6582,7 +6520,7 @@
 done ${INSTALLROOT}/include/ast/vdb.h generated
 make ${INSTALLROOT}/include/ast/vecargs.h
 prev include/vecargs.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/vecargs.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/vecargs.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/vecargs.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/vecargs.h
@@ -6590,7 +6528,7 @@
 done ${INSTALLROOT}/include/ast/vecargs.h generated
 make ${INSTALLROOT}/include/ast/vmalloc.h
 prev include/vmalloc.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/vmalloc.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/vmalloc.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/vmalloc.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/vmalloc.h
@@ -6598,7 +6536,7 @@
 done ${INSTALLROOT}/include/ast/vmalloc.h generated
 make ${INSTALLROOT}/include/ast/wait.h
 prev include/wait.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/wait.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/wait.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/wait.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/wait.h
@@ -6606,23 +6544,23 @@
 done ${INSTALLROOT}/include/ast/wait.h generated
 make ${INSTALLROOT}/include/ast/wordexp.h
 prev comp/wordexp.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  comp/wordexp.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  comp/wordexp.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/wordexp.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/wordexp.h
 exec - fi
 done ${INSTALLROOT}/include/ast/wordexp.h generated
 make ${INSTALLROOT}/include/ast/bytesex.h
-prev include/bytesex.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/bytesex.h > 1.${COTEMP}.x
+prev std/bytesex.h
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  std/bytesex.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/bytesex.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/bytesex.h
 exec - fi
 done ${INSTALLROOT}/include/ast/bytesex.h generated
 make ${INSTALLROOT}/include/ast/endian.h
-prev include/endian.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/endian.h > 1.${COTEMP}.x
+prev std/endian.h
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  std/endian.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/endian.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/endian.h
@@ -6630,7 +6568,7 @@
 done ${INSTALLROOT}/include/ast/endian.h generated
 make ${INSTALLROOT}/include/ast/fnmatch.h
 prev comp/fnmatch.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  comp/fnmatch.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  comp/fnmatch.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/fnmatch.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/fnmatch.h
@@ -6640,7 +6578,7 @@
 make include/magicid.h
 prev ast_common.h implicit
 done include/magicid.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/magicid.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/magicid.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/magicid.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/magicid.h
@@ -6650,7 +6588,7 @@
 make include/fnv.h
 prev ast_common.h implicit
 done include/fnv.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/fnv.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  include/fnv.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/fnv.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/fnv.h
@@ -6658,7 +6596,7 @@
 done ${INSTALLROOT}/include/ast/fnv.h generated
 make ${INSTALLROOT}/include/ast/dirent.h
 prev std/dirent.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  std/dirent.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  std/dirent.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/dirent.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/dirent.h
@@ -6666,23 +6604,15 @@
 done ${INSTALLROOT}/include/ast/dirent.h generated
 make ${INSTALLROOT}/include/ast/iconv.h
 prev std/iconv.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  std/iconv.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  std/iconv.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/iconv.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/iconv.h
 exec - fi
 done ${INSTALLROOT}/include/ast/iconv.h generated
-make ${INSTALLROOT}/include/ast/limits.h
-prev std/limits.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  std/limits.h > 1.${COTEMP}.x
-exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/limits.h 
1.${COTEMP}.x
-exec - then    rm -f 1.${COTEMP}.x
-exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/limits.h
-exec - fi
-done ${INSTALLROOT}/include/ast/limits.h generated
 make ${INSTALLROOT}/include/ast/nl_types.h
 prev std/nl_types.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  std/nl_types.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  std/nl_types.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/nl_types.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/nl_types.h
@@ -6690,7 +6620,7 @@
 done ${INSTALLROOT}/include/ast/nl_types.h generated
 make ${INSTALLROOT}/include/ast/stdio.h
 prev std/stdio.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  std/stdio.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  std/stdio.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/stdio.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/stdio.h
@@ -6698,7 +6628,7 @@
 done ${INSTALLROOT}/include/ast/stdio.h generated
 make ${INSTALLROOT}/include/ast/wchar.h
 prev std/wchar.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  std/wchar.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  std/wchar.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/wchar.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/wchar.h
@@ -6706,7 +6636,7 @@
 done ${INSTALLROOT}/include/ast/wchar.h generated
 make ${INSTALLROOT}/include/ast/align.h
 prev align.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  align.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  align.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/align.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/align.h
@@ -6714,7 +6644,7 @@
 done ${INSTALLROOT}/include/ast/align.h generated
 make ${INSTALLROOT}/include/ast/preroot.h
 prev preroot.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  preroot.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  preroot.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/preroot.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/preroot.h
@@ -6722,7 +6652,7 @@
 done ${INSTALLROOT}/include/ast/preroot.h generated
 make ${INSTALLROOT}/include/ast/sig.h
 prev sig.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  sig.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  sig.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/sig.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/sig.h
@@ -6730,7 +6660,7 @@
 done ${INSTALLROOT}/include/ast/sig.h generated
 make ${INSTALLROOT}/include/ast/tmx.h
 prev tmx.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  tmx.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  tmx.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/tmx.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/tmx.h
@@ -6738,7 +6668,7 @@
 done ${INSTALLROOT}/include/ast/tmx.h generated
 make ${INSTALLROOT}/include/ast/tv.h
 prev tv.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  tv.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  tv.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/tv.h 1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/tv.h
@@ -6746,7 +6676,7 @@
 done ${INSTALLROOT}/include/ast/tv.h generated
 make ${INSTALLROOT}/include/ast/ast_botch.h
 prev ast_botch.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  ast_botch.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  ast_botch.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/ast_botch.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/ast_botch.h
@@ -6754,7 +6684,7 @@
 done ${INSTALLROOT}/include/ast/ast_botch.h generated
 make ${INSTALLROOT}/include/ast/ast_ccode.h
 prev ast_ccode.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  ast_ccode.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  ast_ccode.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/ast_ccode.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/ast_ccode.h
@@ -6762,7 +6692,7 @@
 done ${INSTALLROOT}/include/ast/ast_ccode.h generated
 make ${INSTALLROOT}/include/ast/ast_fcntl.h
 prev ast_fcntl.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  ast_fcntl.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  ast_fcntl.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/ast_fcntl.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/ast_fcntl.h
@@ -6774,7 +6704,7 @@
 exec - cmp 2>/dev/null -s FEATURE/float ast_float.h || { rm -f ast_float.h; 
silent test -d . || mkdir .; ${STDCP} FEATURE/float ast_float.h; }
 prev ast_common.h implicit
 done ast_float.h generated
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  ast_float.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  ast_float.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/ast_float.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/ast_float.h
@@ -6782,23 +6712,15 @@
 done ${INSTALLROOT}/include/ast/ast_float.h generated
 make ${INSTALLROOT}/include/ast/ast_fs.h
 prev ast_fs.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  ast_fs.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  ast_fs.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/ast_fs.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/ast_fs.h
 exec - fi
 done ${INSTALLROOT}/include/ast/ast_fs.h generated
-make ${INSTALLROOT}/include/ast/ast_hdr.h
-prev ast_hdr.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  ast_hdr.h > 1.${COTEMP}.x
-exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/ast_hdr.h 
1.${COTEMP}.x
-exec - then    rm -f 1.${COTEMP}.x
-exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/ast_hdr.h
-exec - fi
-done ${INSTALLROOT}/include/ast/ast_hdr.h generated
 make ${INSTALLROOT}/include/ast/ast_lib.h
 prev ast_lib.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  ast_lib.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  ast_lib.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/ast_lib.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/ast_lib.h
@@ -6806,7 +6728,7 @@
 done ${INSTALLROOT}/include/ast/ast_lib.h generated
 make ${INSTALLROOT}/include/ast/ast_map.h
 prev ast_map.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  ast_map.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  ast_map.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/ast_map.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/ast_map.h
@@ -6814,7 +6736,7 @@
 done ${INSTALLROOT}/include/ast/ast_map.h generated
 make ${INSTALLROOT}/include/ast/ast_mmap.h
 prev ast_mmap.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  ast_mmap.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  ast_mmap.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/ast_mmap.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/ast_mmap.h
@@ -6822,7 +6744,7 @@
 done ${INSTALLROOT}/include/ast/ast_mmap.h generated
 make ${INSTALLROOT}/include/ast/ast_mode.h
 prev ast_mode.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  ast_mode.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  ast_mode.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/ast_mode.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/ast_mode.h
@@ -6830,15 +6752,23 @@
 done ${INSTALLROOT}/include/ast/ast_mode.h generated
 make ${INSTALLROOT}/include/ast/ast_param.h
 prev ast_param.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  ast_param.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  ast_param.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/ast_param.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/ast_param.h
 exec - fi
 done ${INSTALLROOT}/include/ast/ast_param.h generated
+make ${INSTALLROOT}/include/ast/ast_sys.h
+prev ast_sys.h
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  ast_sys.h  > 1.${COTEMP}.x
+exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/ast_sys.h 
1.${COTEMP}.x
+exec - then    rm -f 1.${COTEMP}.x
+exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/ast_sys.h
+exec - fi
+done ${INSTALLROOT}/include/ast/ast_sys.h generated
 make ${INSTALLROOT}/include/ast/ast_time.h
 prev ast_time.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  ast_time.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  ast_time.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/ast_time.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/ast_time.h
@@ -6846,31 +6776,26 @@
 done ${INSTALLROOT}/include/ast/ast_time.h generated
 make ${INSTALLROOT}/include/ast/ast_tty.h
 prev ast_tty.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  ast_tty.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  ast_tty.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/ast_tty.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/ast_tty.h
 exec - fi
 done ${INSTALLROOT}/include/ast/ast_tty.h generated
 make ${INSTALLROOT}/include/ast/ast_types.h
-prev ast_types.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  ast_types.h > 1.${COTEMP}.x
+make ast_types.h
+prev FEATURE/types
+exec - cmp 2>/dev/null -s FEATURE/types ast_types.h || { rm -f ast_types.h; 
silent test -d . || mkdir .; ${STDCP} FEATURE/types ast_types.h; }
+done ast_types.h generated
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  ast_types.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/ast_types.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/ast_types.h
 exec - fi
 done ${INSTALLROOT}/include/ast/ast_types.h generated
-make ${INSTALLROOT}/include/ast/ast_unistd.h
-prev ast_unistd.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  ast_unistd.h > 1.${COTEMP}.x
-exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/ast_unistd.h 
1.${COTEMP}.x
-exec - then    rm -f 1.${COTEMP}.x
-exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/ast_unistd.h
-exec - fi
-done ${INSTALLROOT}/include/ast/ast_unistd.h generated
 make ${INSTALLROOT}/include/ast/ast_vfork.h
 prev ast_vfork.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  ast_vfork.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  ast_vfork.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/ast_vfork.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/ast_vfork.h
@@ -6878,15 +6803,34 @@
 done ${INSTALLROOT}/include/ast/ast_vfork.h generated
 make ${INSTALLROOT}/include/ast/ast_wait.h
 prev ast_wait.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  ast_wait.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  ast_wait.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/ast_wait.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/ast_wait.h
 exec - fi
 done ${INSTALLROOT}/include/ast/ast_wait.h generated
+make ${INSTALLROOT}/include/ast/ast_limits.h
+prev ast_limits.h
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  ast_limits.h  > 1.${COTEMP}.x
+exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/ast_limits.h 
1.${COTEMP}.x
+exec - then    rm -f 1.${COTEMP}.x
+exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/ast_limits.h
+exec - fi
+done ${INSTALLROOT}/include/ast/ast_limits.h generated
+make ${INSTALLROOT}/include/ast/ast_standards.h
+make ast_standards.h
+prev FEATURE/standards
+exec - cmp 2>/dev/null -s FEATURE/standards ast_standards.h || { rm -f 
ast_standards.h; silent test -d . || mkdir .; ${STDCP} FEATURE/standards 
ast_standards.h; }
+done ast_standards.h generated
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  ast_standards.h  > 1.${COTEMP}.x
+exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/ast_standards.h 
1.${COTEMP}.x
+exec - then    rm -f 1.${COTEMP}.x
+exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/ast_standards.h
+exec - fi
+done ${INSTALLROOT}/include/ast/ast_standards.h generated
 make ${INSTALLROOT}/include/ast/ast_dirent.h
 prev ast_dirent.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  ast_dirent.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  ast_dirent.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/ast_dirent.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/ast_dirent.h
@@ -6894,23 +6838,15 @@
 done ${INSTALLROOT}/include/ast/ast_dirent.h generated
 make ${INSTALLROOT}/include/ast/ast_iconv.h
 prev ast_iconv.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  ast_iconv.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  ast_iconv.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/ast_iconv.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/ast_iconv.h
 exec - fi
 done ${INSTALLROOT}/include/ast/ast_iconv.h generated
-make ${INSTALLROOT}/include/ast/ast_limits.h
-prev ast_limits.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  ast_limits.h > 1.${COTEMP}.x
-exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/ast_limits.h 
1.${COTEMP}.x
-exec - then    rm -f 1.${COTEMP}.x
-exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/ast_limits.h
-exec - fi
-done ${INSTALLROOT}/include/ast/ast_limits.h generated
 make ${INSTALLROOT}/include/ast/ast_nl_types.h
 prev ast_nl_types.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  ast_nl_types.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  ast_nl_types.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/ast_nl_types.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/ast_nl_types.h
@@ -6918,7 +6854,7 @@
 done ${INSTALLROOT}/include/ast/ast_nl_types.h generated
 make ${INSTALLROOT}/include/ast/ast_stdio.h
 prev ast_stdio.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  ast_stdio.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  ast_stdio.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/ast_stdio.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/ast_stdio.h
@@ -6926,7 +6862,7 @@
 done ${INSTALLROOT}/include/ast/ast_stdio.h generated
 make ${INSTALLROOT}/include/ast/ast_wchar.h
 prev ast_wchar.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  ast_wchar.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1985,author=gsf+dgk+kpv'  ast_wchar.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${INSTALLROOT}/include/ast/ast_wchar.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${INSTALLROOT}/include/ast/ast_wchar.h
diff -r -N -u ksh93_2006_09_12/src/lib/libast/man/sfio.3 
ksh93_2006_10_31/src/lib/libast/man/sfio.3
--- ksh93_2006_09_12/src/lib/libast/man/sfio.3  2005-08-03 18:13:41.000000000 
+0200
+++ ksh93_2006_10_31/src/lib/libast/man/sfio.3  2006-11-01 08:24:00.000000000 
+0100
@@ -2044,23 +2044,21 @@
 .Tp
 \f5rsc\fP:
 If \f5>=0\fP, this defines a record separator.
-See \f5action\fP for detail.
+If the last returned byte is not the record separator, then
+the read data did not contain a complete record. Otherwise,
+it contains one or more records.
+See also \f5action\fP below.
 .Tp
 \f5tm\fP:
 If \f5>=0\fP, this defines a time interval in milliseconds to wait for 
incoming data.
 .Tp
 \f5action\fP:
-When \f5rsc >= 0\fP, the absolute value of \f5action\fP, \fIr\fP, determines
-the number of records to be read.
 If \f5action > 0\fP, \f5sfpkrd()\fP will peek on incoming data but
 will not read past it. Therefore, a future \f5sfpkrd()\fP or \f5read(2)\fP 
will see
 the same data again.
-If \f5action == 0\fP, \f5sfpkrd()\fP will not peek.
-If \f5action < 0\fP, there are two cases:
-if \f5rsc < 0\fP, \f5sfpkrd()\fP reads \f5n\fP bytes; otherwise,
-exactly \fIr\fP records will be read.
-Note that, in the last case, reading records from an unseekable device
-may be slow if the underlying platform does not allow peeking on such a device.
+If \f5action <= 0\fP, \f5sfpkrd()\fP will not peek and there are two cases.
+If \f5rsc < 0\fP, an attempt is made to read \f5n\fP bytes.
+If \f5rsc >= 0\fP, an attempt is made to read one record.
 
 .PP
 .Ss "FULL STRUCTURE SFIO_T"
diff -r -N -u ksh93_2006_09_12/src/lib/libast/misc/magic.c 
ksh93_2006_10_31/src/lib/libast/misc/magic.c
--- ksh93_2006_09_12/src/lib/libast/misc/magic.c        2005-09-26 
15:42:55.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/misc/magic.c        2006-10-12 
20:37:29.000000000 +0200
@@ -794,8 +794,7 @@
                        if (!(t = strrchr(file, '.')))
                                goto next;
                        sfprintf(mp->tmp, "/reg/classes_root/%s", t);
-                       t = sfstruse(mp->tmp);
-                       if (!(rp = sfopen(NiL, t, "r")))
+                       if (!(t = sfstruse(mp->tmp)) || !(rp = sfopen(NiL, t, 
"r")))
                                goto next;
                        *ep->desc = 0;
                        *ep->mime = 0;
@@ -812,8 +811,7 @@
                                else
                                {
                                        sfprintf(mp->tmp, 
"/reg/classes_root/%s", t);
-                                       e = sfstruse(mp->tmp);
-                                       if (gp = sfopen(NiL, e, "r"))
+                                       if ((e = sfstruse(mp->tmp)) && (gp = 
sfopen(NiL, e, "r")))
                                        {
                                                ep->desc = vmnewof(mp->vm, 
ep->desc, char, strlen(t), 1);
                                                strcpy(ep->desc, t);
@@ -2141,7 +2139,8 @@
                                s += n - 1;
                        }
                        sfwrite(mp->tmp, s, e - s);
-                       s = sfstruse(mp->tmp);
+                       if (!(s = sfstruse(mp->tmp)))
+                               goto nospace;
                }
                if (!*s || streq(s, "-"))
                        s = MAGIC_FILE;
@@ -2153,7 +2152,8 @@
                                {
                                        strcpy(mp->fbuf, s);
                                        sfprintf(mp->tmp, "%s/%s", MAGIC_DIR, 
mp->fbuf);
-                                       s = sfstruse(mp->tmp);
+                                       if (!(s = sfstruse(mp->tmp)))
+                                               goto nospace;
                                        if (!(t = pathpath(mp->fbuf, s, "", 
PATH_REGULAR|PATH_READ)))
                                                goto next;
                                }
@@ -2187,6 +2187,10 @@
                return -1;
        }
        return 0;
+ nospace:
+       if (mp->disc->errorf)
+               (*mp->disc->errorf)(mp, mp->disc, 3, "out of space");
+       return -1;
 }
 
 /*
@@ -2296,7 +2300,8 @@
                                sfprintf(mp->tmp, ", setgid=%s", 
fmtgid(st->st_gid));
                        if (st->st_mode & S_ISVTX)
                                sfprintf(mp->tmp, ", sticky");
-                       s = sfstruse(mp->tmp);
+                       if (!(s = sfstruse(mp->tmp)))
+                               s = T("out of space");
                }
        }
        if (mp->flags & MAGIC_MIME)
diff -r -N -u ksh93_2006_09_12/src/lib/libast/misc/mime.c 
ksh93_2006_10_31/src/lib/libast/misc/mime.c
--- ksh93_2006_09_12/src/lib/libast/misc/mime.c 2002-10-29 20:21:28.000000000 
+0100
+++ ksh93_2006_10_31/src/lib/libast/misc/mime.c 2006-10-13 06:39:48.000000000 
+0200
@@ -314,7 +314,8 @@
                                s += n - 1;
                        }
                        sfwrite(mp->buf, s, e - s);
-                       s = sfstruse(mp->buf);
+                       if (!(s = sfstruse(mp->buf)))
+                               return -1;
                }
                if (fp = tokline(s, SF_READ, NiL))
                {
@@ -382,6 +383,7 @@
        register char*  rv;
        register int    rc;
        register int    i;
+       char*           s;
        Ent_t*          ent;
        char            buf[256];
 
@@ -410,13 +412,17 @@
                        for (i = 0; i < elementsof(prefix) - 1; i++)
                        {
                                sfprintf(mp->buf, "%s%s/%s%s", prefix[i], lp, 
prefix[i + 1], rp);
-                               if (ent = (Ent_t*)dtmatch(mp->cap, 
sfstruse(mp->buf)))
+                               if (!(s = sfstruse(mp->buf)))
+                                       return 0;
+                               if (ent = (Ent_t*)dtmatch(mp->cap, s))
                                        return ent;
                                if (rc)
                                {
                                        *rv = 0;
                                        sfprintf(mp->buf, "%s%s/%s%s", 
prefix[i], lp, prefix[i + 1], rp);
-                                       if (ent = (Ent_t*)dtmatch(mp->cap, 
sfstruse(mp->buf)))
+                                       if (!(s = sfstruse(mp->buf)))
+                                               return 0;
+                                       if (ent = (Ent_t*)dtmatch(mp->cap, s))
                                                return ent;
                                        *rv = rc;
                                }
diff -r -N -u ksh93_2006_09_12/src/lib/libast/misc/optget.c 
ksh93_2006_10_31/src/lib/libast/misc/optget.c
--- ksh93_2006_09_12/src/lib/libast/misc/optget.c       2006-09-12 
07:38:58.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/misc/optget.c       2006-10-13 
06:41:13.000000000 +0200
@@ -682,7 +682,7 @@
  * initialize the attributes for pass p from opt string s
  */
 
-static void
+static int
 init(register char* s, Optpass_t* p)
 {
        register char*  t;
@@ -857,10 +857,12 @@
                        if (!c)
                                break;
                }
-               p->oopts = s = sfstruse(opt_info.state->cp);
+               if (!(p->oopts = s = sfstruse(opt_info.state->cp)))
+                       return -1;
                s += n;
        }
        p->opts = s;
+       return 0;
 }
 
 /*
@@ -928,7 +930,11 @@
        else if (!opt_info.disc || !opt_info.disc->infof || 
(*opt_info.disc->infof)(&opt_info, ip, b, opt_info.disc) < 0)
                n = 0;
        *p = s;
-       return sfstruse(ip) + n;
+       if (s = sfstruse(ip))
+               s += n;
+       else
+               s = "error";
+       return s;
 }
 
 /*
@@ -991,8 +997,7 @@
                }
                sfputc(ip, c);
        }
-       s = sfstruse(ip);
-       if ((u = T(error_info.id, catalog, s)) == s)
+       if (!(s = sfstruse(ip)) || (u = T(error_info.id, catalog, s)) == s)
                return 0;
        n = strlen(u);
        if (tsp = newof(0, Push_t, 1, n + 1))
@@ -1354,7 +1359,10 @@
                                if (X(catalog))
                                {
                                        sfwrite(ip, p, i);
-                                       sfputr(sp, T(error_info.id, catalog, 
sfstruse(ip)), -1);
+                                       if (b = sfstruse(ip))
+                                               sfputr(sp, T(error_info.id, 
catalog, b), -1);
+                                       else
+                                               sfwrite(sp, p, i);
                                }
                                else
                                        sfwrite(sp, p, i);
@@ -1431,7 +1439,7 @@
                        sfputr(sp, "<A name=\"", -1);
                        if (s[-1] == '-' && s[0] == 'l' && s[1] == 'i' && s[2] 
== 'c' && s[3] == 'e' && s[4] == 'n' && s[5] == 's' && s[6] == 'e' && s[7] == 
'?')
                                for (t = s + 8; *t && *t != ']'; t++)
-                                       if (t[0] == 'p' && strmatch(t, 
"(proprietary|private)*"))
+                                       if (t[0] == 'p' && (!strncmp(t, 
"proprietary", 11) || !strncmp(t, "private", 7)) || t[0] == 'n' && !strncmp(t, 
"noncommercial", 13))
                                        {
                                                opt_info.state->flags |= 
OPT_proprietary;
                                                break;
@@ -1575,8 +1583,8 @@
                                else
                                {
                                        sfprintf(ip, "%s", t);
-                                       t = sfstruse(ip);
-                                       *(t + 1) = '|';
+                                       if (e = sfstruse(ip))
+                                               *((t = e) + 1) = '|';
                                }
                        }
                        par = item(sp, t, level, style, ip, version, catalog);
@@ -2038,7 +2046,8 @@
                        sfprintf(sp_help, "[:%s?%s]", styles[i].match, 
styles[i].text);
                for (i = 0; i < elementsof(help_tail); i++)
                        list(sp_help, &help_tail[i]);
-               opts = sfstruse(sp_help);
+               if (!(opts = sfstruse(sp_help)))
+                       goto nospace;
        }
        message((-20, "AHA#%d style=%d", __LINE__, style));
  again:
@@ -2053,7 +2062,8 @@
                if (i >= opt_info.state->npass)
                {
                        o = &one;
-                       init((char*)opts, o);
+                       if (init((char*)opts, o))
+                               goto nospace;
                }
                e = o + 1;
        }
@@ -2951,7 +2961,9 @@
                                                                
sfprintf(sp_info, " %s; -\b%c\b %s --\bno%-.*s\b.", T(NiL, ID, "On by 
default"), f, T(NiL, ID, "means"), u - w, w);
                                                        else
                                                                
sfprintf(sp_info, " %s %s\bno%-.*s\b %s.", T(NiL, ID, "On by default; use"), 
"--"+2-prefix, u - w, w, T(NiL, ID, "to turn off"));
-                                                       textout(sp_body, 
sfstruse(sp_info), style, 0, 0, sp_info, version, NiL);
+                                                       if (!(t = 
sfstruse(sp_info)))
+                                                               goto nospace;
+                                                       textout(sp_body, t, 
style, 0, 0, sp_info, version, NiL);
                                                }
                                                if (*p == GO)
                                                {
@@ -2976,7 +2988,9 @@
                                                        }
                                                        else
                                                                
sfprintf(sp_info, "%s%s", y, T(NiL, ID, "The option value may be omitted."));
-                                                       textout(sp_body, 
sfstruse(sp_info), style, 4, 0, sp_info, version, NiL);
+                                                       if (!(t = 
sfstruse(sp_info)))
+                                                               goto nospace;
+                                                       textout(sp_body, t, 
style, 4, 0, sp_info, version, NiL);
                                                        y = " ";
                                                }
                                                if (v)
@@ -2991,7 +3005,9 @@
                                                        }
                                                        sfputc(sp_info, '\b');
                                                        sfputc(sp_info, '.');
-                                                       textout(sp_body, 
sfstruse(sp_info), style, 4, 0, sp_info, version, NiL);
+                                                       if (!(t = 
sfstruse(sp_info)))
+                                                               goto nospace;
+                                                       textout(sp_body, t, 
style, 4, 0, sp_info, version, NiL);
                                                }
                                        }
                                        else if (!mutex)
@@ -3011,7 +3027,8 @@
                psp = pop(psp);
                if (sp_misc)
                {
-                       p = sfstruse(sp_misc);
+                       if (!(p = sfstruse(sp_misc)))
+                               goto nospace;
                        for (t = p; *t == '\t' || *t == '\n'; t++);
                        if (*t)
                        {
@@ -3028,7 +3045,9 @@
                        sfclose(sp_info);
                if (style == STYLE_keys && sfstrtell(mp) > 1)
                        sfstrseek(mp, -1, SEEK_CUR);
-               return opt_info.msg = sfstruse(mp);
+               if (!(p = sfstruse(mp)))
+                       goto nospace;
+               return opt_info.msg = p;
        }
        sp = sp_text;
        if (sfstrtell(sp))
@@ -3112,7 +3131,8 @@
                                if (!sp_help && !(sp_help = sfstropen()))
                                        goto nospace;
                                sfprintf(sp_help, "[-][:%s?%s]", hp->match, 
hp->text);
-                               opts = sfstruse(sp_help);
+                               if (!(opts = sfstruse(sp_help)))
+                                       goto nospace;
                                goto again;
                        }
                        s = (char*)unknown;
@@ -3127,7 +3147,9 @@
                {
                        if (sfstrtell(sp))
                                sfputc(sp, ' ');
-                       sfputr(sp, sfstruse(sp_plus), ']');
+                       if (!(t = sfstruse(sp_plus)))
+                               goto nospace;
+                       sfputr(sp, t, ']');
                }
                sfclose(sp_plus);
        }
@@ -3135,7 +3157,9 @@
        {
                if (sp_head)
                {
-                       for (t = sfstruse(sp_head); *t == '\n'; t++);
+                       if (!(t = sfstruse(sp_head)))
+                               goto nospace;
+                       for (; *t == '\n'; t++);
                        sfputr(sp, t, '\n');
                        sfclose(sp_head);
                        sp_head = 0;
@@ -3158,9 +3182,12 @@
                {
                        if (style < STYLE_match && sfstrtell(sp))
                                sfputc(sp, ' ');
-                       sfputr(sp, sfstruse(sp_body), -1);
+                       if (!(t = sfstruse(sp_body)))
+                               goto nospace;
+                       sfputr(sp, t, -1);
                }
                sfclose(sp_body);
+               sp_body = 0;
        }
        if (x)
                args(sp, x, xl, flags, style, sp_info, version, catalog);
@@ -3174,7 +3201,8 @@
                sfclose(sp_misc);
                sp_misc = 0;
        }
-       p = sfstruse(sp);
+       if (!(p = sfstruse(sp)))
+               goto nospace;
        name = error_info.id ? error_info.id : "command";
        m = strlen(name) + 1;
        if (!opt_info.state->width)
@@ -3454,9 +3482,11 @@
        }
        else
                sfputr(mp, p, 0);
+       if (!(p = sfstruse(mp)))
+               goto nospace;
        if (sp)
                sfclose(sp);
-       return opt_info.msg = sfstruse(mp);
+       return opt_info.msg = p;
  nospace:
        s = T(NiL, ID, "[* out of space *]");
  nope:
@@ -3531,67 +3561,69 @@
        if (opt_info.num != LONG_MIN)
                opt_info.num = opt_info.number = 0;
        if (!p || !(mp = opt_info.state->mp) && !(mp = opt_info.state->mp = 
sfstropen()))
-               opt_info.arg = T(NiL, ID, "[* out of space *]");
-       else
+               goto nospace;
+       s = *p == '-' ? p : opt_info.name;
+       if (*p == '!')
        {
-               s = *p == '-' ? p : opt_info.name;
-               if (*p == '!')
+               while (*s == '-')
+                       sfputc(mp, *s++);
+               sfputc(mp, 'n');
+               sfputc(mp, 'o');
+       }
+       sfputr(mp, s, ':');
+       sfputc(mp, ' ');
+       if (*p == '#' || *p == ':')
+       {
+               if (*p == '#')
                {
-                       while (*s == '-')
-                               sfputc(mp, *s++);
-                       sfputc(mp, 'n');
-                       sfputc(mp, 'o');
+                       s = T(NiL, ID, "numeric");
+                       sfputr(mp, s, ' ');
                }
-               sfputr(mp, s, ':');
-               sfputc(mp, ' ');
-               if (*p == '#' || *p == ':')
+               if (*(p = next(p + 1, version)) == '[')
                {
-                       if (*p == '#')
-                       {
-                               s = T(NiL, ID, "numeric");
-                               sfputr(mp, s, ' ');
-                       }
-                       if (*(p = next(p + 1, version)) == '[')
+                       p = skip(s = p + 1, ':', '?', 0, 1, 0, 0, version);
+                       tp = X(catalog) ? opt_info.state->xp : mp;
+                       while (s < p)
                        {
-                               p = skip(s = p + 1, ':', '?', 0, 1, 0, 0, 
version);
-                               tp = X(catalog) ? opt_info.state->xp : mp;
-                               while (s < p)
-                               {
-                                       if ((c = *s++) == '?' || c == ']')
-                                               s++;
-                                       sfputc(tp, c);
-                               }
-                               if (X(catalog))
-                                       sfputr(mp, T(error_info.id, catalog, 
sfstruse(tp)), ' ');
-                               else
-                                       sfputc(mp, ' ');
+                               if ((c = *s++) == '?' || c == ']')
+                                       s++;
+                               sfputc(tp, c);
                        }
-                       p = opt_info.name[2] ? C("value expected") : 
C("argument expected");
+                       if (!X(catalog))
+                               sfputc(mp, ' ');
+                       else if (p = sfstruse(tp))
+                               sfputr(mp, T(error_info.id, catalog, p), ' ');
+                       else
+                               goto nospace;
                }
-               else if (*p == '*' || *p == '&')
-               {
-                       sfputr(mp, opt_info.arg, ':');
-                       sfputc(mp, ' ');
-                       p = *p == '&' ? C("ambiguous option argument value") : 
C("unknown option argument value");
-               }
-               else if (*p == '=' || *p == '!')
-                       p = C("value not expected");
-               else if (*p == '?')
-                       p = *(p + 1) == '?' ? C("optget: option not supported") 
: C("ambiguous option");
-               else if (*p == '+')
-                       p = C("section not found");
-               else
-               {
-                       if (opt_info.option[0] != '?' && opt_info.option[0] != 
'-' || opt_info.option[1] != '?' && opt_info.option[1] != '-')
-                               opt_info.option[0] = 0;
-                       p = C("unknown option");
-               }
-               p = T(NiL, ID, p);
-               sfputr(mp, p, -1);
-               if (err)
-                       sfputr(mp, " -- out of range", -1);
-               opt_info.arg = sfstruse(mp);
+               p = opt_info.name[2] ? C("value expected") : C("argument 
expected");
+       }
+       else if (*p == '*' || *p == '&')
+       {
+               sfputr(mp, opt_info.arg, ':');
+               sfputc(mp, ' ');
+               p = *p == '&' ? C("ambiguous option argument value") : 
C("unknown option argument value");
        }
+       else if (*p == '=' || *p == '!')
+               p = C("value not expected");
+       else if (*p == '?')
+               p = *(p + 1) == '?' ? C("optget: option not supported") : 
C("ambiguous option");
+       else if (*p == '+')
+               p = C("section not found");
+       else
+       {
+               if (opt_info.option[0] != '?' && opt_info.option[0] != '-' || 
opt_info.option[1] != '?' && opt_info.option[1] != '-')
+                       opt_info.option[0] = 0;
+               p = C("unknown option");
+       }
+       p = T(NiL, ID, p);
+       sfputr(mp, p, -1);
+       if (err)
+               sfputr(mp, " -- out of range", -1);
+       if (opt_info.arg = sfstruse(mp))
+               return ':';
+ nospace:
+       opt_info.arg = T(NiL, ID, "[* out of space *]");
        return ':';
 }
 
@@ -4126,7 +4158,8 @@
                                                        else
                                                        {
                                                                sfprintf(xp, 
":%s|%s?", g, e);
-                                                               s = 
sfstruse(xp);
+                                                               if (!(s = 
sfstruse(xp)))
+                                                                       goto 
nospace;
                                                        }
                                                }
                                                else
@@ -4705,7 +4738,8 @@
                                                                else
                                                                {
                                                                        
sfprintf(xp, ":%s|%s?", b, e);
-                                                                       s = 
sfstruse(xp);
+                                                                       if (!(s 
= sfstruse(xp)))
+                                                                               
goto nospace;
                                                                }
                                                        }
                                                        else
@@ -4879,6 +4913,9 @@
        }
        pop(psp);
        return '?';
+ nospace:
+       pop(psp);
+       return opterror(NiL, 0, NiL, 0);
 }
 
 /*
@@ -4959,7 +4996,9 @@
                        {
                                opt_info.index = 1;
                                opt_info.offset = ++s - (char*)str;
-                               s = sfstruse(mp) + 2;
+                               if (!(s = sfstruse(mp)))
+                                       goto nospace;
+                               s += 2;
                                e = opt_info.name;
                                while (e < 
&opt_info.name[sizeof(opt_info.name)-1] && (*e++ = *s++));
                                opt_info.arg = 0;
@@ -5021,7 +5060,8 @@
                }
                opt_info.argv = opt_info.state->strv;
                opt_info.state->strv[0] = T(NiL, ID, "option");
-               opt_info.state->strv[1] = sfstruse(mp);
+               if (!(opt_info.state->strv[1] = sfstruse(mp)))
+                       goto nospace;
                opt_info.state->strv[2] = 0;
                opt_info.offset = s - (char*)str;
        }
@@ -5055,4 +5095,6 @@
        else
                c = '-';
        return c;
+ nospace:
+       return opterror(NiL, 0, NiL, 0);
 }
diff -r -N -u ksh93_2006_09_12/src/lib/libast/misc/procclose.c 
ksh93_2006_10_31/src/lib/libast/misc/procclose.c
--- ksh93_2006_09_12/src/lib/libast/misc/procclose.c    2002-01-24 
08:06:33.000000000 +0100
+++ ksh93_2006_10_31/src/lib/libast/misc/procclose.c    2006-10-10 
08:42:49.000000000 +0200
@@ -25,7 +25,6 @@
  * AT&T Research
  *
  * close a proc opened by procopen()
- * -1 returned if procopen() had a problem
  * otherwise exit() status of process is returned
  */
 
@@ -79,11 +78,14 @@
                        signal(SIGCHLD, p->sigchld);
 #endif
                }
-               if (status != -1 && !(p->flags & PROC_FOREGROUND))
-                       status = WIFSIGNALED(status) ?
-                               EXIT_TERM(WTERMSIG(status)) :
-                               EXIT_CODE(WEXITSTATUS(status));
+               status = status == -1 ?
+                        EXIT_QUIT :
+                        WIFSIGNALED(status) ?
+                        EXIT_TERM(WTERMSIG(status)) :
+                        EXIT_CODE(WEXITSTATUS(status));
                procfree(p);
        }
+       else
+               status = errno == ENOENT ? EXIT_NOTFOUND : EXIT_NOEXEC;
        return status;
 }
diff -r -N -u ksh93_2006_09_12/src/lib/libast/misc/procopen.c 
ksh93_2006_10_31/src/lib/libast/misc/procopen.c
--- ksh93_2006_09_12/src/lib/libast/misc/procopen.c     2003-03-26 
06:07:53.000000000 +0100
+++ ksh93_2006_10_31/src/lib/libast/misc/procopen.c     2006-10-25 
17:20:39.000000000 +0200
@@ -425,7 +425,7 @@
        proc->wfd = -1;
        proc->flags = flags;
        sfsync(NiL);
-       if (environ && (envv || (flags & PROC_PARANOID) || argv && 
(environ[0][0] != '_' || environ[0][1] != '=')))
+       if (environ && envv != (char**)environ && (envv || (flags & 
PROC_PARANOID) || argv && (environ[0][0] != '_' || environ[0][1] != '=')))
        {
                if (!setenviron(NiL))
                        goto bad;
@@ -509,6 +509,7 @@
 #endif
        if (!proc->pid)
        {
+               char*           s;
 #if _use_spawnveg
                char**          oenviron = 0;
                char*           oenviron0 = 0;
@@ -622,7 +623,7 @@
                                goto cleanup;
                }
 #endif
-               if (argv)
+               if (argv && envv != (char**)environ)
                {
 #if _use_spawnveg
                        if (!newenv && environ[0][0] == '_' && environ[0][1] == 
'=')
@@ -634,9 +635,9 @@
                        if (!setenviron(env))
                                goto cleanup;
                }
-               if ((flags & PROC_PARANOID) && 
!setenviron("PATH=:/bin:/usr/bin"))
+               if ((flags & PROC_PARANOID) && setenv("PATH", astconf("PATH", 
NiL, NiL), 1))
                        goto cleanup;
-               if (p = envv)
+               if ((p = envv) && p != (char**)environ)
                        while (*p)
                                if (!setenviron(*p++))
                                        goto cleanup;
@@ -692,17 +693,7 @@
                        *p = path;
                        *--p = "sh";
                }
-               if (!(flags & PROC_PARANOID))
-               {
-                       strcpy(env + 2, pathshell());
-                       if (forked || (flags & PROC_OVERLAY))
-                               execve(env + 2, p, environ);
-#if _use_spawnveg
-                       else if ((proc->pid = spawnveg(env + 2, p, environ, 
proc->pgrp)) != -1)
-                               goto cleanup;
-#endif
-               }
-               strcpy(env + 2, "/bin/sh");
+               strcpy(env + 2, (flags & PROC_PARANOID) ? astconf("SH", NiL, 
NiL) : pathshell());
                if (forked || (flags & PROC_OVERLAY))
                        execve(env + 2, p, environ);
 #if _use_spawnveg
diff -r -N -u ksh93_2006_09_12/src/lib/libast/misc/signal.c 
ksh93_2006_10_31/src/lib/libast/misc/signal.c
--- ksh93_2006_09_12/src/lib/libast/misc/signal.c       2005-02-05 
09:38:32.000000000 +0100
+++ ksh93_2006_10_31/src/lib/libast/misc/signal.c       2006-09-22 
17:33:51.000000000 +0200
@@ -27,23 +27,26 @@
  */
 
 #if !_UWIN
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-__STDPP__directive pragma pp:hide signal
-#else
+
 #undef signal
 #define signal         ______signal
-#endif
+
 #endif
 
 #include <ast.h>
 #include <sig.h>
 
 #if !_UWIN
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-__STDPP__directive pragma pp:nohide signal
-#else
+
 #undef signal
+
+#undef _def_map_ast
+#include <ast_map.h>
+
+#if defined(__EXPORT__)
+#define extern __EXPORT__
 #endif
+
 #endif
 
 #if defined(SV_ABORT)                                         
@@ -68,7 +71,7 @@
 #define        sa_mask         sv_mask
 #endif
 
-Sig_handler_t
+extern Sig_handler_t
 signal(int sig, Sig_handler_t fun)
 {
        struct sigaction        na;
diff -r -N -u ksh93_2006_09_12/src/lib/libast/misc/translate.c 
ksh93_2006_10_31/src/lib/libast/misc/translate.c
--- ksh93_2006_09_12/src/lib/libast/misc/translate.c    2004-10-27 
21:44:57.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/misc/translate.c    2006-10-17 
09:32:43.000000000 +0200
@@ -185,19 +185,22 @@
                 * see <mc.h> mcindex()
                 *
                 * this method requires a scan of each catalog, and the
-                * catalog do not advertize the max message number, so
+                * catalogs do not advertize the max message number, so
                 * we assume there are no messages after a gap of GAP
                 * missing messages
                 */
 
                if (cp->messages = dtopen(&state.message_disc, Dtset))
                {
-                       m = 0;
-                       for (n = 1; n < NL_MSGMAX; n++) 
+                       n = m = 0;
+                       for (;;)
+                       {
+                               n++;
                                if ((s = catgets(d, AST_MESSAGE_SET, n, 
state.null)) != state.null && entry(cp->messages, AST_MESSAGE_SET, n, s))
                                        m = n;
                                else if ((n - m) > GAP)
                                        break;
+                       }
                        if (!m)
                        {
                                dtclose(cp->messages);
diff -r -N -u ksh93_2006_09_12/src/lib/libast/obsolete/ccmapc.c 
ksh93_2006_10_31/src/lib/libast/obsolete/ccmapc.c
--- ksh93_2006_09_12/src/lib/libast/obsolete/ccmapc.c   1996-10-09 
16:10:25.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/obsolete/ccmapc.c   1970-01-01 
01:00:00.000000000 +0100
@@ -1,40 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*           Copyright (c) 1985-2006 AT&T Knowledge Ventures            *
-*                      and is licensed under the                       *
-*                  Common Public License, Version 1.0                  *
-*                      by AT&T Knowledge Ventures                      *
-*                                                                      *
-*                A copy of the License is available at                 *
-*            http://www.opensource.org/licenses/cpl1.0.txt             *
-*         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf at research.att.com>                  *
-*                  David Korn <dgk at research.att.com>                   *
-*                   Phong Vo <kpv at research.att.com>                    *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-/*
- * Glenn Fowler
- * AT&T Research
- *
- * character code map
- */
-
-#include <ast.h>
-#include <ccode.h>
-
-#undef ccmapc
-
-int
-ccmapc(int c, int in, int out)
-{
-       return CCMAPC(c, in, out);
-}
diff -r -N -u ksh93_2006_09_12/src/lib/libast/obsolete/ccmapcpy.c 
ksh93_2006_10_31/src/lib/libast/obsolete/ccmapcpy.c
--- ksh93_2006_09_12/src/lib/libast/obsolete/ccmapcpy.c 1997-10-07 
22:18:42.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/obsolete/ccmapcpy.c 1970-01-01 
01:00:00.000000000 +0100
@@ -1,47 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*           Copyright (c) 1985-2006 AT&T Knowledge Ventures            *
-*                      and is licensed under the                       *
-*                  Common Public License, Version 1.0                  *
-*                      by AT&T Knowledge Ventures                      *
-*                                                                      *
-*                A copy of the License is available at                 *
-*            http://www.opensource.org/licenses/cpl1.0.txt             *
-*         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf at research.att.com>                  *
-*                  David Korn <dgk at research.att.com>                   *
-*                   Phong Vo <kpv at research.att.com>                    *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-/*
- * Glenn Fowler
- * AT&T Research
- *
- * character code string map
- */
-
-#include <ast.h>
-#include <ccode.h>
-
-#undef ccmaps
-
-void*
-ccmapcpy(void* b, const void* a, size_t n, int in, int out)
-{
-       register unsigned char*         ub = (unsigned char*)b;
-       register unsigned char*         ue = ub + n;
-       register const unsigned char*   ua = (const unsigned char*)a;
-       register const unsigned char*   m = CCMAP(in, out);
-
-       while (ub < ue)
-               *ub++ = m[*ua++];
-       return b;
-}
diff -r -N -u ksh93_2006_09_12/src/lib/libast/obsolete/_ccmaps.c 
ksh93_2006_10_31/src/lib/libast/obsolete/_ccmaps.c
--- ksh93_2006_09_12/src/lib/libast/obsolete/_ccmaps.c  2000-12-19 
07:03:46.000000000 +0100
+++ ksh93_2006_10_31/src/lib/libast/obsolete/_ccmaps.c  1970-01-01 
01:00:00.000000000 +0100
@@ -1,613 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*           Copyright (c) 1985-2006 AT&T Knowledge Ventures            *
-*                      and is licensed under the                       *
-*                  Common Public License, Version 1.0                  *
-*                      by AT&T Knowledge Ventures                      *
-*                                                                      *
-*                A copy of the License is available at                 *
-*            http://www.opensource.org/licenses/cpl1.0.txt             *
-*         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf at research.att.com>                  *
-*                  David Korn <dgk at research.att.com>                   *
-*                   Phong Vo <kpv at research.att.com>                    *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-/*
- * Glenn Fowler
- * AT&T Research
- *
- * in-place character code map
- */
-
-#ifdef GENERATE
-#undef const
-#define const
-#endif
-
-#include <ast.h>
-#include <ccode.h>
-
-/*
- * the identity table
- */
-
-static const unsigned char a2a[] =
-{
-       0000,0001,0002,0003,0004,0005,0006,0007,
-       0010,0011,0012,0013,0014,0015,0016,0017,
-       0020,0021,0022,0023,0024,0025,0026,0027,
-       0030,0031,0032,0033,0034,0035,0036,0037,
-       0040,0041,0042,0043,0044,0045,0046,0047,
-       0050,0051,0052,0053,0054,0055,0056,0057,
-       0060,0061,0062,0063,0064,0065,0066,0067,
-       0070,0071,0072,0073,0074,0075,0076,0077,
-       0100,0101,0102,0103,0104,0105,0106,0107,
-       0110,0111,0112,0113,0114,0115,0116,0117,
-       0120,0121,0122,0123,0124,0125,0126,0127,
-       0130,0131,0132,0133,0134,0135,0136,0137,
-       0140,0141,0142,0143,0144,0145,0146,0147,
-       0150,0151,0152,0153,0154,0155,0156,0157,
-       0160,0161,0162,0163,0164,0165,0166,0167,
-       0170,0171,0172,0173,0174,0175,0176,0177,
-       0200,0201,0202,0203,0204,0205,0206,0207,
-       0210,0211,0212,0213,0214,0215,0216,0217,
-       0220,0221,0222,0223,0224,0225,0226,0227,
-       0230,0231,0232,0233,0234,0235,0236,0237,
-       0240,0241,0242,0243,0244,0245,0246,0247,
-       0250,0251,0252,0253,0254,0255,0256,0257,
-       0260,0261,0262,0263,0264,0265,0266,0267,
-       0270,0271,0272,0273,0274,0275,0276,0277,
-       0300,0301,0302,0303,0304,0305,0306,0307,
-       0310,0311,0312,0313,0314,0315,0316,0317,
-       0320,0321,0322,0323,0324,0325,0326,0327,
-       0330,0331,0332,0333,0334,0335,0336,0337,
-       0340,0341,0342,0343,0344,0345,0346,0347,
-       0350,0351,0352,0353,0354,0355,0356,0357,
-       0360,0361,0362,0363,0364,0365,0366,0367,
-       0370,0371,0372,0373,0374,0375,0376,0377,
-};
-
-/*
- * the X/Open dd EBCDIC table
- */
-
-static const unsigned char a2e[] =
-{
-       0000,0001,0002,0003,0067,0055,0056,0057,
-       0026,0005,0045,0013,0014,0015,0016,0017,
-       0020,0021,0022,0023,0074,0075,0062,0046,
-       0030,0031,0077,0047,0034,0035,0036,0037,
-       0100,0132,0177,0173,0133,0154,0120,0175,
-       0115,0135,0134,0116,0153,0140,0113,0141,
-       0360,0361,0362,0363,0364,0365,0366,0367,
-       0370,0371,0172,0136,0114,0176,0156,0157,
-       0174,0301,0302,0303,0304,0305,0306,0307,
-       0310,0311,0321,0322,0323,0324,0325,0326,
-       0327,0330,0331,0342,0343,0344,0345,0346,
-       0347,0350,0351,0255,0340,0275,0232,0155,
-       0171,0201,0202,0203,0204,0205,0206,0207,
-       0210,0211,0221,0222,0223,0224,0225,0226,
-       0227,0230,0231,0242,0243,0244,0245,0246,
-       0247,0250,0251,0300,0117,0320,0137,0007,
-       0040,0041,0042,0043,0044,0025,0006,0027,
-       0050,0051,0052,0053,0054,0011,0012,0033,
-       0060,0061,0032,0063,0064,0065,0066,0010,
-       0070,0071,0072,0073,0004,0024,0076,0341,
-       0101,0102,0103,0104,0105,0106,0107,0110,
-       0111,0121,0122,0123,0124,0125,0126,0127,
-       0130,0131,0142,0143,0144,0145,0146,0147,
-       0150,0151,0160,0161,0162,0163,0164,0165,
-       0166,0167,0170,0200,0212,0213,0214,0215,
-       0216,0217,0220,0152,0233,0234,0235,0236,
-       0237,0240,0252,0253,0254,0112,0256,0257,
-       0260,0261,0262,0263,0264,0265,0266,0267,
-       0270,0271,0272,0273,0274,0241,0276,0277,
-       0312,0313,0314,0315,0316,0317,0332,0333,
-       0334,0335,0336,0337,0352,0353,0354,0355,
-       0356,0357,0372,0373,0374,0375,0376,0377,
-};
-
-/*
- * the X/Open dd IBM table
- */
-
-static const unsigned char a2i[] =
-{
-       0000,0001,0002,0003,0067,0055,0056,0057,
-       0026,0005,0045,0013,0014,0015,0016,0017,
-       0020,0021,0022,0023,0074,0075,0062,0046,
-       0030,0031,0077,0047,0034,0035,0036,0037,
-       0100,0132,0177,0173,0133,0154,0120,0175,
-       0115,0135,0134,0116,0153,0140,0113,0141,
-       0360,0361,0362,0363,0364,0365,0366,0367,
-       0370,0371,0172,0136,0114,0176,0156,0157,
-       0174,0301,0302,0303,0304,0305,0306,0307,
-       0310,0311,0321,0322,0323,0324,0325,0326,
-       0327,0330,0331,0342,0343,0344,0345,0346,
-       0347,0350,0351,0255,0340,0275,0137,0155,
-       0171,0201,0202,0203,0204,0205,0206,0207,
-       0210,0211,0221,0222,0223,0224,0225,0226,
-       0227,0230,0231,0242,0243,0244,0245,0246,
-       0247,0250,0251,0300,0117,0320,0241,0007,
-       0040,0041,0042,0043,0044,0025,0006,0027,
-       0050,0051,0052,0053,0054,0011,0012,0033,
-       0060,0061,0032,0063,0064,0065,0066,0010,
-       0070,0071,0072,0073,0004,0024,0076,0341,
-       0101,0102,0103,0104,0105,0106,0107,0110,
-       0111,0121,0122,0123,0124,0125,0126,0127,
-       0130,0131,0142,0143,0144,0145,0146,0147,
-       0150,0151,0160,0161,0162,0163,0164,0165,
-       0166,0167,0170,0200,0212,0213,0214,0215,
-       0216,0217,0220,0232,0233,0234,0235,0236,
-       0237,0240,0252,0253,0254,0255,0256,0257,
-       0260,0261,0262,0263,0264,0265,0266,0267,
-       0270,0271,0272,0273,0274,0275,0276,0277,
-       0312,0313,0314,0315,0316,0317,0332,0333,
-       0334,0335,0336,0337,0352,0353,0354,0355,
-       0356,0357,0372,0373,0374,0375,0376,0377,
-};
-
-/*
- * the mvs OpenEdition EBCDIC table
- */
-
-static const unsigned char a2o[] =
-{
-       0000,0001,0002,0003,0067,0055,0056,0057,
-       0026,0005,0025,0013,0014,0015,0016,0017,
-       0020,0021,0022,0023,0074,0075,0062,0046,
-       0030,0031,0077,0047,0034,0035,0036,0037,
-       0100,0132,0177,0173,0133,0154,0120,0175,
-       0115,0135,0134,0116,0153,0140,0113,0141,
-       0360,0361,0362,0363,0364,0365,0366,0367,
-       0370,0371,0172,0136,0114,0176,0156,0157,
-       0174,0301,0302,0303,0304,0305,0306,0307,
-       0310,0311,0321,0322,0323,0324,0325,0326,
-       0327,0330,0331,0342,0343,0344,0345,0346,
-       0347,0350,0351,0255,0340,0275,0137,0155,
-       0171,0201,0202,0203,0204,0205,0206,0207,
-       0210,0211,0221,0222,0223,0224,0225,0226,
-       0227,0230,0231,0242,0243,0244,0245,0246,
-       0247,0250,0251,0300,0117,0320,0241,0007,
-       0040,0041,0042,0043,0044,0045,0006,0027,
-       0050,0051,0052,0053,0054,0011,0012,0033,
-       0060,0061,0032,0063,0064,0065,0066,0010,
-       0070,0071,0072,0073,0004,0024,0076,0377,
-       0101,0252,0112,0261,0237,0262,0152,0265,
-       0273,0264,0232,0212,0260,0312,0257,0274,
-       0220,0217,0352,0372,0276,0240,0266,0263,
-       0235,0332,0233,0213,0267,0270,0271,0253,
-       0144,0145,0142,0146,0143,0147,0236,0150,
-       0164,0161,0162,0163,0170,0165,0166,0167,
-       0254,0151,0355,0356,0353,0357,0354,0277,
-       0200,0375,0376,0373,0374,0272,0256,0131,
-       0104,0105,0102,0106,0103,0107,0234,0110,
-       0124,0121,0122,0123,0130,0125,0126,0127,
-       0214,0111,0315,0316,0313,0317,0314,0341,
-       0160,0335,0336,0333,0334,0215,0216,0337,
-};
-
-/* the rest are generated from the above */
-
-static const unsigned char e2a[] =
-{
-       0000,0001,0002,0003,0234,0011,0206,0177,
-       0227,0215,0216,0013,0014,0015,0016,0017,
-       0020,0021,0022,0023,0235,0205,0010,0207,
-       0030,0031,0222,0217,0034,0035,0036,0037,
-       0200,0201,0202,0203,0204,0012,0027,0033,
-       0210,0211,0212,0213,0214,0005,0006,0007,
-       0220,0221,0026,0223,0224,0225,0226,0004,
-       0230,0231,0232,0233,0024,0025,0236,0032,
-       0040,0240,0241,0242,0243,0244,0245,0246,
-       0247,0250,0325,0056,0074,0050,0053,0174,
-       0046,0251,0252,0253,0254,0255,0256,0257,
-       0260,0261,0041,0044,0052,0051,0073,0176,
-       0055,0057,0262,0263,0264,0265,0266,0267,
-       0270,0271,0313,0054,0045,0137,0076,0077,
-       0272,0273,0274,0275,0276,0277,0300,0301,
-       0302,0140,0072,0043,0100,0047,0075,0042,
-       0303,0141,0142,0143,0144,0145,0146,0147,
-       0150,0151,0304,0305,0306,0307,0310,0311,
-       0312,0152,0153,0154,0155,0156,0157,0160,
-       0161,0162,0136,0314,0315,0316,0317,0320,
-       0321,0345,0163,0164,0165,0166,0167,0170,
-       0171,0172,0322,0323,0324,0133,0326,0327,
-       0330,0331,0332,0333,0334,0335,0336,0337,
-       0340,0341,0342,0343,0344,0135,0346,0347,
-       0173,0101,0102,0103,0104,0105,0106,0107,
-       0110,0111,0350,0351,0352,0353,0354,0355,
-       0175,0112,0113,0114,0115,0116,0117,0120,
-       0121,0122,0356,0357,0360,0361,0362,0363,
-       0134,0237,0123,0124,0125,0126,0127,0130,
-       0131,0132,0364,0365,0366,0367,0370,0371,
-       0060,0061,0062,0063,0064,0065,0066,0067,
-       0070,0071,0372,0373,0374,0375,0376,0377,
-};
-
-static const unsigned char e2i[] =
-{
-       0000,0001,0002,0003,0004,0005,0006,0007,
-       0010,0011,0012,0013,0014,0015,0016,0017,
-       0020,0021,0022,0023,0024,0025,0026,0027,
-       0030,0031,0032,0033,0034,0035,0036,0037,
-       0040,0041,0042,0043,0044,0045,0046,0047,
-       0050,0051,0052,0053,0054,0055,0056,0057,
-       0060,0061,0062,0063,0064,0065,0066,0067,
-       0070,0071,0072,0073,0074,0075,0076,0077,
-       0100,0101,0102,0103,0104,0105,0106,0107,
-       0110,0111,0255,0113,0114,0115,0116,0117,
-       0120,0121,0122,0123,0124,0125,0126,0127,
-       0130,0131,0132,0133,0134,0135,0136,0241,
-       0140,0141,0142,0143,0144,0145,0146,0147,
-       0150,0151,0232,0153,0154,0155,0156,0157,
-       0160,0161,0162,0163,0164,0165,0166,0167,
-       0170,0171,0172,0173,0174,0175,0176,0177,
-       0200,0201,0202,0203,0204,0205,0206,0207,
-       0210,0211,0212,0213,0214,0215,0216,0217,
-       0220,0221,0222,0223,0224,0225,0226,0227,
-       0230,0231,0137,0233,0234,0235,0236,0237,
-       0240,0275,0242,0243,0244,0245,0246,0247,
-       0250,0251,0252,0253,0254,0255,0256,0257,
-       0260,0261,0262,0263,0264,0265,0266,0267,
-       0270,0271,0272,0273,0274,0275,0276,0277,
-       0300,0301,0302,0303,0304,0305,0306,0307,
-       0310,0311,0312,0313,0314,0315,0316,0317,
-       0320,0321,0322,0323,0324,0325,0326,0327,
-       0330,0331,0332,0333,0334,0335,0336,0337,
-       0340,0341,0342,0343,0344,0345,0346,0347,
-       0350,0351,0352,0353,0354,0355,0356,0357,
-       0360,0361,0362,0363,0364,0365,0366,0367,
-       0370,0371,0372,0373,0374,0375,0376,0377,
-};
-
-static const unsigned char e2o[] =
-{
-       0000,0001,0002,0003,0004,0005,0006,0007,
-       0010,0011,0012,0013,0014,0015,0016,0017,
-       0020,0021,0022,0023,0024,0045,0026,0027,
-       0030,0031,0032,0033,0034,0035,0036,0037,
-       0040,0041,0042,0043,0044,0025,0046,0047,
-       0050,0051,0052,0053,0054,0055,0056,0057,
-       0060,0061,0062,0063,0064,0065,0066,0067,
-       0070,0071,0072,0073,0074,0075,0076,0077,
-       0100,0101,0252,0112,0261,0237,0262,0152,
-       0265,0273,0357,0113,0114,0115,0116,0117,
-       0120,0264,0232,0212,0260,0312,0257,0274,
-       0220,0217,0132,0133,0134,0135,0136,0241,
-       0140,0141,0352,0372,0276,0240,0266,0263,
-       0235,0332,0163,0153,0154,0155,0156,0157,
-       0233,0213,0267,0270,0271,0253,0144,0145,
-       0142,0171,0172,0173,0174,0175,0176,0177,
-       0146,0201,0202,0203,0204,0205,0206,0207,
-       0210,0211,0143,0147,0236,0150,0164,0161,
-       0162,0221,0222,0223,0224,0225,0226,0227,
-       0230,0231,0137,0170,0165,0166,0167,0254,
-       0151,0107,0242,0243,0244,0245,0246,0247,
-       0250,0251,0355,0356,0353,0255,0354,0277,
-       0200,0375,0376,0373,0374,0272,0256,0131,
-       0104,0105,0102,0106,0103,0275,0234,0110,
-       0300,0301,0302,0303,0304,0305,0306,0307,
-       0310,0311,0124,0121,0122,0123,0130,0125,
-       0320,0321,0322,0323,0324,0325,0326,0327,
-       0330,0331,0126,0127,0214,0111,0315,0316,
-       0340,0377,0342,0343,0344,0345,0346,0347,
-       0350,0351,0313,0317,0314,0341,0160,0335,
-       0360,0361,0362,0363,0364,0365,0366,0367,
-       0370,0371,0336,0333,0334,0215,0216,0337,
-};
-
-static const unsigned char i2a[] =
-{
-       0000,0001,0002,0003,0234,0011,0206,0177,
-       0227,0215,0216,0013,0014,0015,0016,0017,
-       0020,0021,0022,0023,0235,0205,0010,0207,
-       0030,0031,0222,0217,0034,0035,0036,0037,
-       0200,0201,0202,0203,0204,0012,0027,0033,
-       0210,0211,0212,0213,0214,0005,0006,0007,
-       0220,0221,0026,0223,0224,0225,0226,0004,
-       0230,0231,0232,0233,0024,0025,0236,0032,
-       0040,0240,0241,0242,0243,0244,0245,0246,
-       0247,0250,0112,0056,0074,0050,0053,0174,
-       0046,0251,0252,0253,0254,0255,0256,0257,
-       0260,0261,0041,0044,0052,0051,0073,0136,
-       0055,0057,0262,0263,0264,0265,0266,0267,
-       0270,0271,0152,0054,0045,0137,0076,0077,
-       0272,0273,0274,0275,0276,0277,0300,0301,
-       0302,0140,0072,0043,0100,0047,0075,0042,
-       0303,0141,0142,0143,0144,0145,0146,0147,
-       0150,0151,0304,0305,0306,0307,0310,0311,
-       0312,0152,0153,0154,0155,0156,0157,0160,
-       0161,0162,0313,0314,0315,0316,0317,0320,
-       0321,0176,0163,0164,0165,0166,0167,0170,
-       0171,0172,0322,0323,0324,0133,0326,0327,
-       0330,0331,0332,0333,0334,0335,0336,0337,
-       0340,0341,0342,0343,0344,0135,0346,0347,
-       0173,0101,0102,0103,0104,0105,0106,0107,
-       0110,0111,0350,0351,0352,0353,0354,0355,
-       0175,0112,0113,0114,0115,0116,0117,0120,
-       0121,0122,0356,0357,0360,0361,0362,0363,
-       0134,0237,0123,0124,0125,0126,0127,0130,
-       0131,0132,0364,0365,0366,0367,0370,0371,
-       0060,0061,0062,0063,0064,0065,0066,0067,
-       0070,0071,0372,0373,0374,0375,0376,0377,
-};
-
-static const unsigned char i2e[] =
-{
-       0000,0001,0002,0003,0004,0005,0006,0007,
-       0010,0011,0012,0013,0014,0015,0016,0017,
-       0020,0021,0022,0023,0024,0025,0026,0027,
-       0030,0031,0032,0033,0034,0035,0036,0037,
-       0040,0041,0042,0043,0044,0045,0046,0047,
-       0050,0051,0052,0053,0054,0055,0056,0057,
-       0060,0061,0062,0063,0064,0065,0066,0067,
-       0070,0071,0072,0073,0074,0075,0076,0077,
-       0100,0101,0102,0103,0104,0105,0106,0107,
-       0110,0111,0321,0113,0114,0115,0116,0117,
-       0120,0121,0122,0123,0124,0125,0126,0127,
-       0130,0131,0132,0133,0134,0135,0136,0232,
-       0140,0141,0142,0143,0144,0145,0146,0147,
-       0150,0151,0221,0153,0154,0155,0156,0157,
-       0160,0161,0162,0163,0164,0165,0166,0167,
-       0170,0171,0172,0173,0174,0175,0176,0177,
-       0200,0201,0202,0203,0204,0205,0206,0207,
-       0210,0211,0212,0213,0214,0215,0216,0217,
-       0220,0221,0222,0223,0224,0225,0226,0227,
-       0230,0231,0152,0233,0234,0235,0236,0237,
-       0240,0137,0242,0243,0244,0245,0246,0247,
-       0250,0251,0252,0253,0254,0255,0256,0257,
-       0260,0261,0262,0263,0264,0265,0266,0267,
-       0270,0271,0272,0273,0274,0275,0276,0277,
-       0300,0301,0302,0303,0304,0305,0306,0307,
-       0310,0311,0312,0313,0314,0315,0316,0317,
-       0320,0321,0322,0323,0324,0325,0326,0327,
-       0330,0331,0332,0333,0334,0335,0336,0337,
-       0340,0341,0342,0343,0344,0345,0346,0347,
-       0350,0351,0352,0353,0354,0355,0356,0357,
-       0360,0361,0362,0363,0364,0365,0366,0367,
-       0370,0371,0372,0373,0374,0375,0376,0377,
-};
-
-static const unsigned char i2o[] =
-{
-       0000,0001,0002,0003,0004,0005,0006,0007,
-       0010,0011,0012,0013,0014,0015,0016,0017,
-       0020,0021,0022,0023,0024,0045,0026,0027,
-       0030,0031,0032,0033,0034,0035,0036,0037,
-       0040,0041,0042,0043,0044,0025,0046,0047,
-       0050,0051,0052,0053,0054,0055,0056,0057,
-       0060,0061,0062,0063,0064,0065,0066,0067,
-       0070,0071,0072,0073,0074,0075,0076,0077,
-       0100,0101,0252,0112,0261,0237,0262,0152,
-       0265,0273,0321,0113,0114,0115,0116,0117,
-       0120,0264,0232,0212,0260,0312,0257,0274,
-       0220,0217,0132,0133,0134,0135,0136,0137,
-       0140,0141,0352,0372,0276,0240,0266,0263,
-       0235,0332,0221,0153,0154,0155,0156,0157,
-       0233,0213,0267,0270,0271,0253,0144,0145,
-       0142,0171,0172,0173,0174,0175,0176,0177,
-       0146,0201,0202,0203,0204,0205,0206,0207,
-       0210,0211,0143,0147,0236,0150,0164,0161,
-       0162,0221,0222,0223,0224,0225,0226,0227,
-       0230,0231,0163,0170,0165,0166,0167,0254,
-       0151,0241,0242,0243,0244,0245,0246,0247,
-       0250,0251,0355,0356,0353,0255,0354,0277,
-       0200,0375,0376,0373,0374,0272,0256,0131,
-       0104,0105,0102,0106,0103,0275,0234,0110,
-       0300,0301,0302,0303,0304,0305,0306,0307,
-       0310,0311,0124,0121,0122,0123,0130,0125,
-       0320,0321,0322,0323,0324,0325,0326,0327,
-       0330,0331,0126,0127,0214,0111,0315,0316,
-       0340,0377,0342,0343,0344,0345,0346,0347,
-       0350,0351,0313,0317,0314,0341,0160,0335,
-       0360,0361,0362,0363,0364,0365,0366,0367,
-       0370,0371,0336,0333,0334,0215,0216,0337,
-};
-
-static const unsigned char o2a[] =
-{
-       0000,0001,0002,0003,0234,0011,0206,0177,
-       0227,0215,0216,0013,0014,0015,0016,0017,
-       0020,0021,0022,0023,0235,0012,0010,0207,
-       0030,0031,0222,0217,0034,0035,0036,0037,
-       0200,0201,0202,0203,0204,0205,0027,0033,
-       0210,0211,0212,0213,0214,0005,0006,0007,
-       0220,0221,0026,0223,0224,0225,0226,0004,
-       0230,0231,0232,0233,0024,0025,0236,0032,
-       0040,0240,0342,0344,0340,0341,0343,0345,
-       0347,0361,0242,0056,0074,0050,0053,0174,
-       0046,0351,0352,0353,0350,0355,0356,0357,
-       0354,0337,0041,0044,0052,0051,0073,0136,
-       0055,0057,0302,0304,0300,0301,0303,0305,
-       0307,0321,0246,0054,0045,0137,0076,0077,
-       0370,0311,0312,0313,0310,0315,0316,0317,
-       0314,0140,0072,0043,0100,0047,0075,0042,
-       0330,0141,0142,0143,0144,0145,0146,0147,
-       0150,0151,0253,0273,0360,0375,0376,0261,
-       0260,0152,0153,0154,0155,0156,0157,0160,
-       0161,0162,0252,0272,0346,0270,0306,0244,
-       0265,0176,0163,0164,0165,0166,0167,0170,
-       0171,0172,0241,0277,0320,0133,0336,0256,
-       0254,0243,0245,0267,0251,0247,0266,0274,
-       0275,0276,0335,0250,0257,0135,0264,0327,
-       0173,0101,0102,0103,0104,0105,0106,0107,
-       0110,0111,0255,0364,0366,0362,0363,0365,
-       0175,0112,0113,0114,0115,0116,0117,0120,
-       0121,0122,0271,0373,0374,0371,0372,0377,
-       0134,0367,0123,0124,0125,0126,0127,0130,
-       0131,0132,0262,0324,0326,0322,0323,0325,
-       0060,0061,0062,0063,0064,0065,0066,0067,
-       0070,0071,0263,0333,0334,0331,0332,0237,
-};
-
-static const unsigned char o2e[] =
-{
-       0000,0001,0002,0003,0004,0005,0006,0007,
-       0010,0011,0012,0013,0014,0015,0016,0017,
-       0020,0021,0022,0023,0024,0045,0026,0027,
-       0030,0031,0032,0033,0034,0035,0036,0037,
-       0040,0041,0042,0043,0044,0025,0046,0047,
-       0050,0051,0052,0053,0054,0055,0056,0057,
-       0060,0061,0062,0063,0064,0065,0066,0067,
-       0070,0071,0072,0073,0074,0075,0076,0077,
-       0100,0101,0272,0274,0270,0271,0273,0241,
-       0277,0335,0103,0113,0114,0115,0116,0117,
-       0120,0313,0314,0315,0312,0317,0332,0333,
-       0316,0267,0132,0133,0134,0135,0136,0232,
-       0140,0141,0170,0212,0166,0167,0200,0213,
-       0215,0240,0107,0153,0154,0155,0156,0157,
-       0356,0217,0220,0152,0216,0234,0235,0236,
-       0233,0171,0172,0173,0174,0175,0176,0177,
-       0260,0201,0202,0203,0204,0205,0206,0207,
-       0210,0211,0123,0161,0334,0375,0376,0131,
-       0130,0221,0222,0223,0224,0225,0226,0227,
-       0230,0231,0122,0160,0276,0150,0214,0105,
-       0145,0137,0242,0243,0244,0245,0246,0247,
-       0250,0251,0102,0165,0237,0255,0266,0126,
-       0124,0104,0106,0147,0121,0110,0146,0162,
-       0163,0164,0265,0111,0127,0275,0144,0257,
-       0300,0301,0302,0303,0304,0305,0306,0307,
-       0310,0311,0125,0352,0354,0336,0337,0353,
-       0320,0321,0322,0323,0324,0325,0326,0327,
-       0330,0331,0151,0373,0374,0357,0372,0377,
-       0340,0355,0342,0343,0344,0345,0346,0347,
-       0350,0351,0142,0254,0256,0252,0253,0112,
-       0360,0361,0362,0363,0364,0365,0366,0367,
-       0370,0371,0143,0263,0264,0261,0262,0341,
-};
-
-static const unsigned char o2i[] =
-{
-       0000,0001,0002,0003,0004,0005,0006,0007,
-       0010,0011,0012,0013,0014,0015,0016,0017,
-       0020,0021,0022,0023,0024,0045,0026,0027,
-       0030,0031,0032,0033,0034,0035,0036,0037,
-       0040,0041,0042,0043,0044,0025,0046,0047,
-       0050,0051,0052,0053,0054,0055,0056,0057,
-       0060,0061,0062,0063,0064,0065,0066,0067,
-       0070,0071,0072,0073,0074,0075,0076,0077,
-       0100,0101,0272,0274,0270,0271,0273,0275,
-       0277,0335,0103,0113,0114,0115,0116,0117,
-       0120,0313,0314,0315,0312,0317,0332,0333,
-       0316,0267,0132,0133,0134,0135,0136,0137,
-       0140,0141,0170,0212,0166,0167,0200,0213,
-       0215,0240,0107,0153,0154,0155,0156,0157,
-       0356,0217,0220,0232,0216,0234,0235,0236,
-       0233,0171,0172,0173,0174,0175,0176,0177,
-       0260,0201,0202,0203,0204,0205,0206,0207,
-       0210,0211,0123,0161,0334,0375,0376,0131,
-       0130,0221,0222,0223,0224,0225,0226,0227,
-       0230,0231,0122,0160,0276,0150,0214,0105,
-       0145,0241,0242,0243,0244,0245,0246,0247,
-       0250,0251,0102,0165,0237,0255,0266,0126,
-       0124,0104,0106,0147,0121,0110,0146,0162,
-       0163,0164,0265,0111,0127,0275,0144,0257,
-       0300,0301,0302,0303,0304,0305,0306,0307,
-       0310,0311,0125,0352,0354,0336,0337,0353,
-       0320,0321,0322,0323,0324,0325,0326,0327,
-       0330,0331,0151,0373,0374,0357,0372,0377,
-       0340,0355,0342,0343,0344,0345,0346,0347,
-       0350,0351,0142,0254,0256,0252,0253,0255,
-       0360,0361,0362,0363,0364,0365,0366,0367,
-       0370,0371,0143,0263,0264,0261,0262,0341,
-};
-
-const unsigned char*   _cc_map[] =
-{
-       a2a,    a2e,    a2i,    a2o,
-       e2a,    a2a,    e2i,    e2o,
-       i2a,    i2e,    a2a,    i2o,
-       o2a,    o2e,    o2i,    a2a,
-};
-
-#if !_BLD_DLL && _dll_import
-const unsigned char** _imp___cc_map = _cc_map;
-#endif
-
-void*
-_ccmaps(void* b, size_t n, int in, int out)
-{
-       register unsigned char*         s;
-       register unsigned char*         e;
-       register const unsigned char*   m;
-
-       if (in != out)
-       {
-               m = CCMAP(in, out);
-               for (e = (s = (unsigned char*)b) + n; s < e; s++)
-                       *s = m[*s];
-       }
-       return b;
-}
-
-#ifdef GENERATE
-
-#undef CC_MAPS
-#define CC_MAPS        4
-
-#include <stdio.h>
-
-char   name[] = "aeio";
-
-main()
-{
-       register int            i;
-       register int            j;
-       register int            n;
-       register int            r;
-       register int            c;
-       register unsigned char* a;
-       register unsigned char* z;
-       register unsigned char* m;
-
-       for (j = 1; j < 4; j++)
-       {
-               a = CCMAP(0, j);
-               z = CCMAP(j, 0);
-               for (n = 0; n < 256; n++)
-                       z[n] = n;
-               for (n = 255; n >= 0; n--)
-                       z[a[n]] = n;
-       }
-       for (i = 0; i < 4; i++)
-               for (j = 0; j < 4; j++)
-                       if (i != j)
-                       {
-                               printf("static const unsigned char %c2%c[] 
=\n{\n", name[i], name[j]);
-                               m = CCMAP(i, j);
-                               if (i && j)
-                               {
-                                       for (n = 0; n < 256; n++)
-                                               m[n] = n;
-                                       a = CCMAP(i, 0);
-                                       z = CCMAP(0, j);
-                                       for (n = 256; n >= 0; n--)
-                                               m[n] = z[a[n]];
-                               }
-                               n = 0;
-                               for (r = 0; r < 32; r++)
-                               {
-                                       printf("        ");
-                                       for (c = 0; c < 8; c++)
-                                       {
-                                               printf("%04o,", m[n]);
-                                               n++;
-                                       }
-                                       printf("\n");
-                               }
-                               printf("};\n\n");
-                       }
-       return 0;
-}
-
-#endif
diff -r -N -u ksh93_2006_09_12/src/lib/libast/obsolete/ccmaps.c 
ksh93_2006_10_31/src/lib/libast/obsolete/ccmaps.c
--- ksh93_2006_09_12/src/lib/libast/obsolete/ccmaps.c   1996-10-09 
16:10:51.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/obsolete/ccmaps.c   1970-01-01 
01:00:00.000000000 +0100
@@ -1,40 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*           Copyright (c) 1985-2006 AT&T Knowledge Ventures            *
-*                      and is licensed under the                       *
-*                  Common Public License, Version 1.0                  *
-*                      by AT&T Knowledge Ventures                      *
-*                                                                      *
-*                A copy of the License is available at                 *
-*            http://www.opensource.org/licenses/cpl1.0.txt             *
-*         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf at research.att.com>                  *
-*                  David Korn <dgk at research.att.com>                   *
-*                   Phong Vo <kpv at research.att.com>                    *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-/*
- * Glenn Fowler
- * AT&T Research
- *
- * character code string map
- */
-
-#include <ast.h>
-#include <ccode.h>
-
-#undef ccmaps
-
-void*
-ccmaps(void* b, size_t n, int in, int out)
-{
-       return CCMAPS(b, n, in, out);
-}
diff -r -N -u ksh93_2006_09_12/src/lib/libast/obsolete/mematoe.c 
ksh93_2006_10_31/src/lib/libast/obsolete/mematoe.c
--- ksh93_2006_09_12/src/lib/libast/obsolete/mematoe.c  1997-08-29 
22:18:13.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/obsolete/mematoe.c  1970-01-01 
01:00:00.000000000 +0100
@@ -1,40 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*           Copyright (c) 1985-2006 AT&T Knowledge Ventures            *
-*                      and is licensed under the                       *
-*                  Common Public License, Version 1.0                  *
-*                      by AT&T Knowledge Ventures                      *
-*                                                                      *
-*                A copy of the License is available at                 *
-*            http://www.opensource.org/licenses/cpl1.0.txt             *
-*         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf at research.att.com>                  *
-*                  David Korn <dgk at research.att.com>                   *
-*                   Phong Vo <kpv at research.att.com>                    *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-/*
- * OBSOLETE 19970101 -- use ccmapcpy(op,ip,n,CC_ASCII,CC_EBCDIC2)
- */
-
-#include <ast.h>
-#include <ccode.h>
-
-/*
- * convert n bytes of CC_ASCII ip to CC_EBCDIC2 in op
- * ip==op is ok
- */
-
-void*
-mematoe(void* op, const void* ip, size_t n)
-{
-       return op == ip ? ccmaps(op, n, CC_ASCII, CC_EBCDIC2) : ccmapcpy(op, 
ip, n, CC_ASCII, CC_EBCDIC2);
-}
diff -r -N -u ksh93_2006_09_12/src/lib/libast/obsolete/memetoa.c 
ksh93_2006_10_31/src/lib/libast/obsolete/memetoa.c
--- ksh93_2006_09_12/src/lib/libast/obsolete/memetoa.c  1997-08-29 
22:19:25.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/obsolete/memetoa.c  1970-01-01 
01:00:00.000000000 +0100
@@ -1,40 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*           Copyright (c) 1985-2006 AT&T Knowledge Ventures            *
-*                      and is licensed under the                       *
-*                  Common Public License, Version 1.0                  *
-*                      by AT&T Knowledge Ventures                      *
-*                                                                      *
-*                A copy of the License is available at                 *
-*            http://www.opensource.org/licenses/cpl1.0.txt             *
-*         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf at research.att.com>                  *
-*                  David Korn <dgk at research.att.com>                   *
-*                   Phong Vo <kpv at research.att.com>                    *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-/*
- * OBSOLETE 19970101 -- use ccmapcpy(op,ip,n,CC_EBCDIC2,CC_ASCII)
- */
-
-#include <ast.h>
-#include <ccode.h>
-
-/*
- * convert n bytes of CC_EBCDIC2 ip to CC_ASCII in op
- * ip==op is ok
- */
-
-void*
-memetoa(void* op, const void* ip, size_t n)
-{
-       return op == ip ? ccmaps(op, n, CC_EBCDIC2, CC_ASCII) : ccmapcpy(op, 
ip, n, CC_EBCDIC2, CC_ASCII);
-}
diff -r -N -u ksh93_2006_09_12/src/lib/libast/obsolete/re.h 
ksh93_2006_10_31/src/lib/libast/obsolete/re.h
--- ksh93_2006_09_12/src/lib/libast/obsolete/re.h       1997-01-22 
07:13:26.000000000 +0100
+++ ksh93_2006_10_31/src/lib/libast/obsolete/re.h       1970-01-01 
01:00:00.000000000 +0100
@@ -1,75 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*           Copyright (c) 1985-2006 AT&T Knowledge Ventures            *
-*                      and is licensed under the                       *
-*                  Common Public License, Version 1.0                  *
-*                      by AT&T Knowledge Ventures                      *
-*                                                                      *
-*                A copy of the License is available at                 *
-*            http://www.opensource.org/licenses/cpl1.0.txt             *
-*         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf at research.att.com>                  *
-*                  David Korn <dgk at research.att.com>                   *
-*                   Phong Vo <kpv at research.att.com>                    *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-/*
- * Glenn Fowler
- * AT&T Research
- *
- * regular expression library definitions
- */
-
-#ifndef _RE_H
-#define _RE_H
-
-#include <sfio.h>
-
-#define RE_ALL         (1<<0)  /* substitute all occurrences           */
-#define RE_EDSTYLE     (1<<1)  /* ed(1) style meta characters          */
-#define RE_LOWER       (1<<2)  /* substitute to lower case             */
-#define RE_MATCH       (1<<3)  /* record matches in Re_program_t.match */
-#define RE_UPPER       (1<<4)  /* substitute to upper case             */
-#define RE_LEFTANCHOR  (1<<5)  /* match anchored on left               */
-#define RE_RIGHTANCHOR (1<<6)  /* match anchored on right              */
-#define RE_EXTERNAL    8       /* first external flag bit              */
-
-typedef struct                 /* sub-expression match                 */
-{
-       char*   sp;             /* start in source string               */
-       char*   ep;             /* end in source string                 */
-} Re_match_t;
-
-typedef struct                 /* compiled regular expression program  */
-{
-       Re_match_t      match['9'-'0'+1];/* sub-expression match table*/
-#ifdef _RE_PROGRAM_PRIVATE_
-       _RE_PROGRAM_PRIVATE_
-#endif
-} Re_program_t, reprogram;
-
-/*
- * interface routines
- */
-
-#if _BLD_ast && defined(__EXPORT__)
-#define extern         __EXPORT__
-#endif
-
-extern Re_program_t*   recomp(const char*, int);
-extern int             reexec(Re_program_t*, const char*);
-extern void            refree(Re_program_t*);
-extern void            reerror(const char*);
-extern char*           resub(Re_program_t*, const char*, const char*, char*, 
int);
-extern void            ressub(Re_program_t*, Sfio_t*, const char*, const 
char*, int);
-
-#undef extern
-
-#endif
diff -r -N -u ksh93_2006_09_12/src/lib/libast/obsolete/sfdcold.c 
ksh93_2006_10_31/src/lib/libast/obsolete/sfdcold.c
--- ksh93_2006_09_12/src/lib/libast/obsolete/sfdcold.c  2004-10-29 
14:49:05.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/obsolete/sfdcold.c  1970-01-01 
01:00:00.000000000 +0100
@@ -1,47 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*           Copyright (c) 1985-2006 AT&T Knowledge Ventures            *
-*                      and is licensed under the                       *
-*                  Common Public License, Version 1.0                  *
-*                      by AT&T Knowledge Ventures                      *
-*                                                                      *
-*                A copy of the License is available at                 *
-*            http://www.opensource.org/licenses/cpl1.0.txt             *
-*         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf at research.att.com>                  *
-*                  David Korn <dgk at research.att.com>                   *
-*                   Phong Vo <kpv at research.att.com>                    *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-/*
- * obsolete discipline names
- *
- * OBSOLETE 20010101 -- use new names
- */
-
-#include       <ast.h>
-
-#include       <sfdisc.h>
-
-#if defined(__EXPORT__)
-#define extern __EXPORT__
-#endif
-
-extern int
-sfdostext(Sfio_t* sp)
-{
-       return sfdcdos(sp);
-}
-
-extern int
-sfslowio(Sfio_t* sp)
-{
-       return sfdcslow(sp);
-}
diff -r -N -u ksh93_2006_09_12/src/lib/libast/obsolete/spawn.c 
ksh93_2006_10_31/src/lib/libast/obsolete/spawn.c
--- ksh93_2006_09_12/src/lib/libast/obsolete/spawn.c    2003-03-23 
05:36:19.000000000 +0100
+++ ksh93_2006_10_31/src/lib/libast/obsolete/spawn.c    2006-10-09 
22:45:02.000000000 +0200
@@ -25,24 +25,34 @@
  * OBSOLETE 20030321 -- use spawnveg()
  */
 
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-__STDPP__directive pragma pp:hide spawnve spawnvpe spawnvp spawnlp
-#else
+#include <ast_lib.h>
+
+#if !_lib_spawnve
 #define spawnve                ______spawnve
+#endif
+#if !_lib_spawnvpe
 #define spawnvpe       ______spawnvpe
+#endif
+#if !_lib_spawnvp
 #define spawnvp                ______spawnvp
+#endif
+#if !_lib_spawnlp
 #define spawnlp                ______spawnlp
 #endif
 
 #include <ast.h>
 #include <error.h>
 
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-__STDPP__directive pragma pp:nohide spawnve spawnvpe spawnvp spawnlp
-#else
+#if !_lib_spawnve
 #undef spawnve
+#endif
+#if !_lib_spawnvpe
 #undef spawnvpe
+#endif
+#if !_lib_spawnvp
 #undef spawnvp
+#endif
+#if !_lib_spawnlp
 #undef spawnlp
 #endif
 
@@ -78,7 +88,7 @@
        char                    buffer[PATH_MAX];
 
        if (*path != '/')
-               path = pathpath(buffer, name, NULL, X_OK|PATH_REGULAR);
+               path = pathpath(buffer, name, NULL, PATH_REGULAR|PATH_EXECUTE);
        if ((pid = spawnve(path, argv, envv)) >= 0)
                return pid;
        if (errno == ENOEXEC)
diff -r -N -u ksh93_2006_09_12/src/lib/libast/path/pathposix.c 
ksh93_2006_10_31/src/lib/libast/path/pathposix.c
--- ksh93_2006_09_12/src/lib/libast/path/pathposix.c    2003-08-21 
14:44:00.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/path/pathposix.c    2006-09-23 
09:26:57.000000000 +0200
@@ -35,7 +35,7 @@
 
 #if _UWIN
 
-extern int     uwin_path(const char*, char*, int);
+#include <uwin.h>
 
 size_t
 pathposix(const char* path, char* buf, size_t siz)
diff -r -N -u ksh93_2006_09_12/src/lib/libast/path/pathshell.c 
ksh93_2006_10_31/src/lib/libast/path/pathshell.c
--- ksh93_2006_09_12/src/lib/libast/path/pathshell.c    2004-07-23 
08:14:03.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/path/pathshell.c    2006-10-25 
17:21:48.000000000 +0200
@@ -41,7 +41,7 @@
  *
  * root/administrator has its own test
  *
- * astconf("SHELL",NiL,NiL) is returned by default
+ * astconf("SH",NiL,NiL) is returned by default
  *
  * NOTE: csh is rejected because the bsh/csh differentiation is
  *       not done for `csh script arg ...'
@@ -59,13 +59,13 @@
 
        static char*    val;
 
-       if ((sh = getenv("SHELL")) && *sh == '/' && strmatch(sh, 
"*/(sh|*[!cC]sh)?(-+([a-zA-Z0-9.]))?(.exe)"))
+       if ((sh = getenv("SHELL")) && *sh == '/' && strmatch(sh, 
"*/(sh|*[!cC]sh)*([[:digit:]])?(-+([.[:alnum:]]))?(.exe)"))
        {
                if (!(ru = getuid()) || !eaccess("/bin", W_OK))
                {
                        if (stat(sh, &st))
                                goto defshell;
-                       if (ru != st.st_uid && !strmatch(sh, 
"?(/usr)?(/local)/?(l)bin/?([a-z])sh?(.exe)"))
+                       if (ru != st.st_uid && !strmatch(sh, 
"?(/usr)?(/local)/?([ls])bin/?([[:lower:]])sh?(.exe)"))
                                goto defshell;
                }
                else
@@ -104,7 +104,7 @@
  defshell:
        if (!(sh = val))
        {
-               if (!*(sh = astconf("SHELL", NiL, NiL)) || *sh != '/' || 
eaccess(sh, X_OK) || !(sh = strdup(sh)))
+               if (!*(sh = astconf("SH", NiL, NiL)) || *sh != '/' || 
eaccess(sh, X_OK) || !(sh = strdup(sh)))
                        sh = "/bin/sh";
                val = sh;
        }
diff -r -N -u ksh93_2006_09_12/src/lib/libast/port/astconf.c 
ksh93_2006_10_31/src/lib/libast/port/astconf.c
--- ksh93_2006_09_12/src/lib/libast/port/astconf.c      2006-02-10 
09:43:21.000000000 +0100
+++ ksh93_2006_10_31/src/lib/libast/port/astconf.c      2006-10-25 
19:29:18.000000000 +0200
@@ -23,10 +23,10 @@
 
 /*
  * string interface to confstr(),pathconf(),sysconf(),sysinfo()
- * extended to allow some features to be set
+ * extended to allow some features to be set per-process
  */
 
-static const char id[] = "\n@(#)$Id: getconf (AT&T Research) 2006-02-10 $\0\n";
+static const char id[] = "\n@(#)$Id: getconf (AT&T Research) 2006-10-25 $\0\n";
 
 #include "univlib.h"
 
@@ -35,11 +35,16 @@
 #include <fs3d.h>
 #include <ctype.h>
 #include <regex.h>
+#include <proc.h>
 
-#include "confmap.h"
 #include "conftab.h"
 #include "FEATURE/libpath"
 
+#ifndef _pth_getconf
+#undef ASTCONF_system
+#define ASTCONF_system         0
+#endif
+
 #if _sys_systeminfo
 # if !_lib_sysinfo
 #   if _lib_systeminfo
@@ -58,19 +63,17 @@
 #else
 # undef        _lib_sysinfo
 #endif
-#if !_lib_sysinfo
-# define sysinfo(a,b,c)        ((errno=EINVAL),(-1))
-#endif
 
 #define OP_conformance         1
 #define OP_fs_3d               2
-#define OP_hosttype            3
-#define OP_libpath             4
-#define OP_libprefix           5
-#define OP_libsuffix           6
-#define OP_path_attributes     7
-#define OP_path_resolve                8
-#define OP_universe            9
+#define OP_getconf             3
+#define OP_hosttype            4
+#define OP_libpath             5
+#define OP_libprefix           6
+#define OP_libsuffix           7
+#define OP_path_attributes     8
+#define OP_path_resolve                9
+#define OP_universe            10
 
 #define CONF_ERROR     (CONF_USER<<0)
 #define CONF_READONLY  (CONF_USER<<1)
@@ -137,6 +140,20 @@
        },
        {
                &dynamic[3],
+               "GETCONF",
+#ifdef _pth_getconf
+               _pth_getconf,
+#else
+               &null[0],
+#endif
+               0,
+               7,
+               CONF_AST,
+               CONF_READONLY,
+               OP_getconf
+       },
+       {
+               &dynamic[4],
                "HOSTTYPE",
                HOSTTYPE,
                0,
@@ -146,7 +163,7 @@
                OP_hosttype
        },
        {
-               &dynamic[4],
+               &dynamic[5],
                "LIBPATH",
 #ifdef CONF_LIBPATH
                CONF_LIBPATH,
@@ -160,7 +177,7 @@
                OP_libpath
        },
        {
-               &dynamic[5],
+               &dynamic[6],
                "LIBPREFIX",
 #ifdef CONF_LIBPREFIX
                CONF_LIBPREFIX,
@@ -174,7 +191,7 @@
                OP_libprefix
        },
        {
-               &dynamic[6],
+               &dynamic[7],
                "LIBSUFFIX",
 #ifdef CONF_LIBSUFFIX
                CONF_LIBSUFFIX,
@@ -188,7 +205,7 @@
                OP_libsuffix
        },
        {
-               &dynamic[7],
+               &dynamic[8],
                "PATH_ATTRIBUTES",
 #if _WINIX
                "c",
@@ -202,7 +219,7 @@
                OP_path_attributes
        },
        {
-               &dynamic[8],
+               &dynamic[9],
                "PATH_RESOLVE",
                &null[0],
                "metaphysical",
@@ -249,7 +266,7 @@
 
 static State_t state = { "getconf", "_AST_FEATURES", dynamic };
 
-static char*   feature(const char*, const char*, const char*, Error_f);
+static char*   feature(const char*, const char*, const char*, int, Error_f);
 
 /*
  * return fmtbuf() copy of s
@@ -315,7 +332,7 @@
                                ve = 0;
                        *de = 0;
                        *se = 0;
-                       feature(s, d, v, 0);
+                       feature(s, d, v, 0, 0);
                        *se = ' ';
                        *de = ' ';
                        if (!ve)
@@ -483,7 +500,7 @@
                                                                sfwrite(tmp, d, 
r);
                                                                sfputc(tmp, 
'/');
                                                                sfputr(tmp, 
command, 0);
-                                                               if 
(!eaccess(sfstruse(tmp), X_OK))
+                                                               if ((d = 
sfstruse(tmp)) && !eaccess(d, X_OK))
                                                                {
                                                                        ok = 1;
                                                                        if 
(fp->op != OP_universe)
@@ -539,7 +556,7 @@
  */
 
 static char*
-format(register Feature_t* fp, const char* path, const char* value, Error_f 
conferror)
+format(register Feature_t* fp, const char* path, const char* value, int flags, 
Error_f conferror)
 {
        register Feature_t*     sp;
        register int            n;
@@ -571,7 +588,7 @@
                {
                        register char*  s;
                        register char*  e;
-                       register long   v;
+                       _ast_intmax_t   v;
 
                        /*
                         * _PC_PATH_ATTRIBUTES is a bitmap for 'a' to 'z'
@@ -650,7 +667,7 @@
  */
 
 static char*
-feature(const char* name, const char* path, const char* value, Error_f 
conferror)
+feature(const char* name, const char* path, const char* value, int flags, 
Error_f conferror)
 {
        register Feature_t*     fp;
        register int            n;
@@ -658,6 +675,9 @@
        if (value && (streq(value, "-") || streq(value, "0")))
                value = null;
        for (fp = state.features; fp && !streq(fp->name, name); fp = fp->next);
+#if DEBUG || DEBUG_astconf
+       error(-2, "astconf feature name=%s path=%s value=%s flags=%04x fp=%p", 
name, path, value, flags, fp);
+#endif
        if (!fp)
        {
                if (!value)
@@ -690,7 +710,7 @@
        }
        else
                state.recent = fp;
-       return format(fp, path, value, conferror);
+       return format(fp, path, value, flags, conferror);
 }
 
 /*
@@ -698,25 +718,27 @@
  */
 
 static int
-lookup(register Lookup_t* look, const char* name)
+lookup(register Lookup_t* look, const char* name, int flags)
 {
        register Conf_t*        mid = (Conf_t*)conf;
        register Conf_t*        lo = mid;
        register Conf_t*        hi = mid + conf_elements;
        register int            v;
        register int            c;
-       Conf_t*                 hit;
+       char*                   e;
        const Prefix_t*         p;
 
+       static Conf_t           num;
+
        look->flags = 0;
        look->call = -1;
-       look->standard = -1;
+       look->standard = (flags & ASTCONF_AST) ? CONF_AST : -1;
        look->section = -1;
        while (*name == '_')
                name++;
  again:
        for (p = prefix; p < &prefix[prefix_elements]; p++)
-               if (strneq(name, p->name, p->length) && ((c = name[p->length] 
== '_') || (v = isdigit(name[p->length]) && name[p->length + 1] == '_')))
+               if (strneq(name, p->name, p->length) && ((c = name[p->length] 
== '_' || name[p->length] == '(') || (v = isdigit(name[p->length]) && 
name[p->length + 1] == '_')))
                {
                        if (p->call < 0)
                        {
@@ -730,6 +752,17 @@
                                        break;
                                look->call = p->call;
                        }
+                       if (name[p->length] == '(')
+                       {
+                               look->conf = &num;
+                               strncpy((char*)num.name, name, 
sizeof(num.name));
+                               num.call = p->call;
+                               num.flags = *name == 'C' ? CONF_STRING : 0;
+                               num.op = (short)strtol(name + p->length + 1, 
&e, 10);
+                               if (*e++ != ')' || *e)
+                                       break;
+                               return 1;
+                       }
                        name += p->length + c;
                        if (look->section < 0 && !c && v)
                        {
@@ -743,39 +776,35 @@
                look->section = 1;
 #endif
        look->name = name;
-#if DEBUG
-       error(-1, "astconf lookup name=%s standard=%d section=%d call=%d", 
look->name, look->standard, look->section, look->call);
+#if DEBUG || DEBUG_astconf
+       error(-1, "astconf normal name=%s standard=%d section=%d call=%d 
flags=%04x elements=%d", look->name, look->standard, look->section, look->call, 
flags, conf_elements);
 #endif
        c = *((unsigned char*)name);
        while (lo <= hi)
        {
                mid = lo + (hi - lo) / 2;
+#if DEBUG || DEBUG_astconf
+               error(-2, "astconf lookup name=%s mid=%s", name, mid->name);
+#endif
                if (!(v = c - *((unsigned char*)mid->name)) && !(v = 
strcmp(name, mid->name)))
                {
-                       hit = hi = mid;
-                       for (;;)
+                       hi = mid;
+                       lo = (Conf_t*)conf;
+                       do
                        {
-                               lo = (Conf_t*)conf;
-                               do
-                               {
-                                       if ((look->standard < 0 || 
look->standard == mid->standard) &&
-                                           (look->section < 0 || look->section 
== mid->section) &&
-                                           (look->call < 0 || look->call == 
mid->call))
-                                               goto found;
-                               } while (mid-- > lo && streq(mid->name, 
look->name));
-                               mid = hi;
-                               hi = lo + conf_elements - 1;
-                               while (++mid < hi && streq(mid->name, 
look->name))
-                               {
-                                       if ((look->standard < 0 || 
look->standard == mid->standard) &&
-                                           (look->section < 0 || look->section 
== mid->section) &&
-                                           (look->call < 0 || look->call == 
mid->call))
-                                               goto found;
-                               }
-                               if (look->standard < 0)
-                                       break;
-                               look->standard = -1;
-                               hi = mid = hit;
+                               if ((look->standard < 0 || look->standard == 
mid->standard) &&
+                                   (look->section < 0 || look->section == 
mid->section) &&
+                                   (look->call < 0 || look->call == mid->call))
+                                       goto found;
+                       } while (mid-- > lo && streq(mid->name, look->name));
+                       mid = hi;
+                       hi = lo + conf_elements - 1;
+                       while (++mid < hi && streq(mid->name, look->name))
+                       {
+                               if ((look->standard < 0 || look->standard == 
mid->standard) &&
+                                   (look->section < 0 || look->section == 
mid->section) &&
+                                   (look->call < 0 || look->call == mid->call))
+                                       goto found;
                        }
                        break;
                }
@@ -789,6 +818,9 @@
        if (look->call < 0 && look->standard >= 0)
                look->flags |= CONF_MINMAX;
        look->conf = mid;
+#if DEBUG || DEBUG_astconf
+       error(-1, "astconf lookup name=%s standard=%d:%d section=%d:%d 
call=%d:%d", look->name, look->standard, mid->standard, look->section, 
mid->section, look->call, mid->call);
+#endif
        return 1;
 }
 
@@ -824,66 +856,127 @@
 print(Sfio_t* sp, register Lookup_t* look, const char* name, const char* path, 
int listflags, Error_f conferror)
 {
        register Conf_t*        p = look->conf;
-       register int            flags = look->flags|CONF_DEFINED;
+       register int            flags = look->flags;
        char*                   call;
        char*                   f;
-       long                    v;
+       const char*             s;
        int                     olderrno;
        int                     drop;
+       _ast_intmax_t           v;
        char                    buf[PATH_MAX];
        char                    flg[16];
 
        if (!name && !(p->flags & CONF_STRING) && (p->flags & 
(CONF_FEATURE|CONF_LIMIT|CONF_MINMAX)) && (p->flags & 
(CONF_LIMIT|CONF_PREFIXED)) != CONF_LIMIT)
-       {
                flags |= CONF_PREFIXED;
-               if (p->flags & CONF_DEFINED)
-                       flags |= CONF_MINMAX;
-       }
        olderrno = errno;
        errno = 0;
-       switch ((flags & CONF_MINMAX) && (p->flags & CONF_DEFINED) ? 0 : 
p->call)
+#if DEBUG || DEBUG_astconf
+       error(-1, "astconf print name=%s:%s standard=%d section=%d call=%s 
op=%d flags=|%s%s%s%s%s:|%s%s%s%s%s"
+               , name , p->name, p->standard, p->section, prefix[p->call + 
CONF_call].name, p->op
+               , (flags & CONF_FEATURE) ? "FEATURE|" : ""
+               , (flags & CONF_LIMIT) ? "LIMIT|" : ""
+               , (flags & CONF_MINMAX) ? "MINMAX|" : ""
+               , (flags & CONF_PREFIXED) ? "PREFIXED|" : ""
+               , (flags & CONF_STRING) ? "STRING|" : ""
+               , (p->flags & CONF_FEATURE) ? "FEATURE|" : ""
+               , (p->flags & CONF_LIMIT_DEF) ? "LIMIT_DEF|" : (p->flags & 
CONF_LIMIT) ? "LIMIT|" : ""
+               , (p->flags & CONF_MINMAX_DEF) ? "MINMAX_DEF|" : (p->flags & 
CONF_MINMAX) ? "MINMAX|" : ""
+               , (p->flags & CONF_PREFIXED) ? "PREFIXED|" : ""
+               , (p->flags & CONF_STRING) ? "STRING|" : ""
+               );
+#endif
+       flags |= CONF_LIMIT_DEF|CONF_MINMAX_DEF;
+       s = 0;
+       switch ((p->op < 0 || (flags & CONF_MINMAX) && (p->flags & 
CONF_MINMAX_DEF)) ? 0 : p->call)
        {
-       case 0:
-               if (p->flags & CONF_DEFINED)
-                       v = p->value;
-               else
-               {
-                       flags &= ~CONF_DEFINED;
-                       v = -1;
-               }
-               break;
        case CONF_confstr:
                call = "confstr";
+#if _lib_confstr
                if (!(v = confstr(p->op, buf, sizeof(buf))))
                {
                        v = -1;
                        errno = EINVAL;
                }
+               else if (v > 0)
+               {
+                       buf[sizeof(buf) - 1] = 0;
+                       s = (const char*)buf;
+               }
                break;
+#else
+               goto predef;
+#endif
        case CONF_pathconf:
                call = "pathconf";
+#if _lib_pathconf
                v = pathconf(path, p->op);
                break;
+#else
+               goto predef;
+#endif
        case CONF_sysconf:
                call = "sysconf";
+#if _lib_sysconf
                v = sysconf(p->op);
                break;
+#else
+               goto predef;
+#endif
        case CONF_sysinfo:
                call = "sysinfo";
-               v = sysinfo(p->op, buf, sizeof(buf));
+#if _lib_sysinfo
+               if ((v = sysinfo(p->op, buf, sizeof(buf))) >= 0)
+               {
+                       buf[sizeof(buf) - 1] = 0;
+                       s = (const char*)buf;
+               }
                break;
+#else
+               goto predef;
+#endif
        default:
                call = "synthesis";
                errno = EINVAL;
                v = -1;
                break;
+       case 0:
+               call = 0;
+               if (p->flags & CONF_MINMAX_DEF)
+               {
+                       if (!((p->flags & CONF_LIMIT_DEF)))
+                               flags |= CONF_MINMAX;
+                       listflags &= ~ASTCONF_system;
+               }
+       predef:
+               if (!(listflags & ASTCONF_system))
+               {
+                       if (flags & CONF_MINMAX)
+                       {
+                               if (p->flags & CONF_MINMAX_DEF)
+                               {
+                                       v = p->minmax.number;
+                                       s = p->minmax.string;
+                                       break;
+                               }
+                       }
+                       else if (p->flags & CONF_LIMIT_DEF)
+                       {
+                               v = p->limit.number;
+                               s = p->limit.string;
+                               break;
+                       }
+               }
+               flags &= ~(CONF_LIMIT_DEF|CONF_MINMAX_DEF);
+               v = -1;
+               errno = EINVAL;
+               break;
        }
        if (v == -1)
        {
                if (!errno)
                {
                        if ((p->flags & CONF_FEATURE) || !(p->flags & 
(CONF_LIMIT|CONF_MINMAX)))
-                               flags &= ~CONF_DEFINED;
+                               flags &= ~(CONF_LIMIT_DEF|CONF_MINMAX_DEF);
                }
                else if (!(flags & CONF_PREFIXED))
                {
@@ -891,27 +984,27 @@
                        {
                                if (conferror)
                                {
-                                       (*conferror)(&state, &state, 
ERROR_SYSTEM|2, "%s: %s error", p->name, call);
-                                       return 0;
+                                       if (call)
+                                               (*conferror)(&state, &state, 
ERROR_SYSTEM|2, "%s: %s error", p->name, call);
+                                       else if (!(listflags & ASTCONF_system))
+                                               (*conferror)(&state, &state, 2, 
"%s: unknown name", p->name);
                                }
-                               return null;
+                               return (listflags & ASTCONF_error) ? (char*)0 : 
null;
                        }
-                       flags &= ~CONF_DEFINED;
+                       flags &= ~(CONF_LIMIT_DEF|CONF_MINMAX_DEF);
                        flags |= CONF_ERROR;
                }
                else
-                       flags &= ~CONF_DEFINED;
+                       flags &= ~(CONF_LIMIT_DEF|CONF_MINMAX_DEF);
        }
        errno = olderrno;
-       if ((listflags & ASTCONF_defined) && !(flags & CONF_DEFINED))
+       if ((listflags & ASTCONF_defined) && !(flags & 
(CONF_LIMIT_DEF|CONF_MINMAX_DEF)))
                return null;
        if ((drop = !sp) && !(sp = sfstropen()))
                return null;
        if (listflags & ASTCONF_table)
        {
                f = flg;
-               if (p->flags & CONF_DEFINED)
-                       *f++ = 'D';
                if (p->flags & CONF_FEATURE)
                        *f++ = 'F';
                if (p->flags & CONF_LIMIT)
@@ -929,17 +1022,30 @@
                if (f == flg)
                        *f++ = 'X';
                *f = 0;
-               sfprintf(sp, "%*s %*s %d %2s %5s ", sizeof(p->name), p->name, 
sizeof(prefix[p->standard].name), prefix[p->standard].name, p->section, 
prefix[p->call + CONF_call].name, flg);
+               sfprintf(sp, "%*s %*s %d %2s %4d %5s ", sizeof(p->name), 
p->name, sizeof(prefix[p->standard].name), prefix[p->standard].name, 
p->section, prefix[p->call + CONF_call].name, p->op, flg);
+               if (p->flags & CONF_LIMIT_DEF)
+               {
+                       if (p->limit.string)
+                               sfprintf(sp, "L[%s] ", (listflags & 
ASTCONF_quote) ? fmtquote(p->limit.string, "\"", "\"", strlen(p->limit.string), 
FMT_SHELL) : p->limit.string);
+                       else
+                               sfprintf(sp, "L[%I*d] ", 
sizeof(p->limit.number), p->limit.number);
+               }
+               if (p->flags & CONF_MINMAX_DEF)
+               {
+                       if (p->minmax.string)
+                               sfprintf(sp, "M[%s] ", (listflags & 
ASTCONF_quote) ? fmtquote(p->minmax.string, "\"", "\"", 
strlen(p->minmax.string), FMT_SHELL) : p->minmax.string);
+                       else
+                               sfprintf(sp, "M[%I*d] ", 
sizeof(p->minmax.number), p->minmax.number);
+               }
                if (flags & CONF_ERROR)
                        sfprintf(sp, "error");
-               else if (p->flags & CONF_STRING)
-                       sfprintf(sp, "%s", (listflags & ASTCONF_quote) ? 
fmtquote(buf, "\"", "\"", strlen(buf), FMT_SHELL) : buf);
                else if (v != -1)
-                       sfprintf(sp, "%ld", v);
-               else if (flags & CONF_DEFINED)
-                       sfprintf(sp, "%lu", v);
-               else
-                       sfprintf(sp, "undefined");
+               {
+                       if (s)
+                               sfprintf(sp, "%s", (listflags & ASTCONF_quote) 
? fmtquote(s, "\"", "\"", strlen(s), FMT_SHELL) : s);
+                       else
+                               sfprintf(sp, "%I*d", sizeof(v), v);
+               }
                sfprintf(sp, "\n");
        }
        else
@@ -961,12 +1067,13 @@
                        }
                        if (flags & CONF_ERROR)
                                sfprintf(sp, "error");
-                       else if (p->flags & CONF_STRING)
-                               sfprintf(sp, "%s", (listflags & ASTCONF_quote) 
? fmtquote(buf, "\"", "\"", strlen(buf), FMT_SHELL) : buf);
                        else if (v != -1)
-                               sfprintf(sp, "%ld", v);
-                       else if (flags & CONF_DEFINED)
-                               sfprintf(sp, "%lu", v);
+                       {
+                               if (s)
+                                       sfprintf(sp, "%s", (listflags & 
ASTCONF_quote) ? fmtquote(s, "\"", "\"", strlen(s), FMT_SHELL) : s);
+                               else
+                                       sfprintf(sp, "%I*d", sizeof(v), v);
+                       }
                        else
                                sfprintf(sp, "undefined");
                        if (!name)
@@ -980,17 +1087,17 @@
                        if (p->section > 1)
                                sfprintf(sp, "%d", p->section);
                        sfprintf(sp, "_%s=", (listflags & ASTCONF_lower) ? 
fmtlower(p->name) : p->name);
-                       if (p->flags & CONF_DEFINED)
+                       if (p->flags & CONF_MINMAX_DEF)
                        {
-                               if ((v = p->value) == -1 && ((p->flags & 
CONF_FEATURE) || !(p->flags & (CONF_LIMIT|CONF_MINMAX))))
-                                       flags &= ~CONF_DEFINED;
+                               if (v == -1 && (v = p->minmax.number) == -1 && 
((p->flags & CONF_FEATURE) || !(p->flags & (CONF_LIMIT|CONF_MINMAX))))
+                                       flags &= ~CONF_MINMAX_DEF;
                                else
-                                       flags |= CONF_DEFINED;
+                                       flags |= CONF_MINMAX_DEF;
                        }
                        if (v != -1)
-                               sfprintf(sp, "%ld", v);
-                       else if (flags & CONF_DEFINED)
-                               sfprintf(sp, "%lu", v);
+                               sfprintf(sp, "%I*d", sizeof(v), v);
+                       else if (flags & CONF_MINMAX_DEF)
+                               sfprintf(sp, "%I*u", sizeof(v), v);
                        else
                                sfprintf(sp, "undefined");
                        sfprintf(sp, "\n");
@@ -998,7 +1105,10 @@
        }
        if (drop)
        {
-               call = buffer(sfstruse(sp));
+               if (call = sfstruse(sp))
+                       call = buffer(call);
+               else
+                       call = "[ out of space ]";
                sfclose(sp);
                return call;
        }
@@ -1006,6 +1116,39 @@
 }
 
 /*
+ * return read stream to native getconf utility
+ */
+
+static Sfio_t*
+nativeconf(Proc_t** pp, const char* operand)
+{
+#ifdef _pth_getconf
+       Sfio_t*         sp;
+       char*           cmd[3];
+       long            ops[2];
+
+#if DEBUG || DEBUG_astconf
+       error(-1, "astconf defer %s %s", _pth_getconf, operand);
+#endif
+       cmd[0] = (char*)state.id;
+       cmd[1] = (char*)operand;
+       cmd[2] = 0;
+       ops[0] = PROC_FD_DUP(open("/dev/null",O_WRONLY,0), 2, PROC_FD_CHILD);
+       ops[1] = 0;
+       if (*pp = procopen(_pth_getconf, cmd, environ, ops, PROC_READ))
+       {
+               if (sp = sfnew(NiL, NiL, SF_UNBOUND, (*pp)->rfd, SF_READ))
+               {
+                       sfdisc(sp, SF_POPDISC);
+                       return sp;
+               }
+               procclose(*pp);
+       }
+#endif
+       return 0;
+}
+
+/*
  * value==0 gets value for name
  * value!=0 sets value for name and returns previous value
  * path==0 implies path=="/"
@@ -1013,25 +1156,35 @@
  * settable return values are in permanent store
  * non-settable return values copied to a tmp fmtbuf() buffer
  *
- *     if (streq(astgetconf("PATH_RESOLVE", NiL, NiL, 0), "logical"))
+ *     if (streq(astgetconf("PATH_RESOLVE", NiL, NiL, 0, 0), "logical"))
  *             our_way();
  *
- *     universe = astgetconf("UNIVERSE", NiL, "att", 0);
- *     astgetconf("UNIVERSE", NiL, universe, 0);
+ *     universe = astgetconf("UNIVERSE", NiL, "att", 0, 0);
+ *     astgetconf("UNIVERSE", NiL, universe, 0, 0);
+ *
+ * if (flags&ASTCONF_error)!=0 then error return value is 0
+ * otherwise 0 not returned
  */
 
 #define ALT    16
 
 char*
-astgetconf(const char* name, const char* path, const char* value, Error_f 
conferror)
+astgetconf(const char* name, const char* path, const char* value, int flags, 
Error_f conferror)
 {
        register char*  s;
-       char*           e;
        int             n;
-       long            v;
        Lookup_t        look;
        Sfio_t*         tmp;
 
+#if __OBSOLETE__ < 20080101
+       if (pointerof(flags) == (void*)errorf)
+       {
+               conferror = errorf;
+               flags = ASTCONF_error;
+       }
+       else if (conferror && conferror != errorf)
+               conferror = 0;
+#endif
        if (!name)
        {
                if (path)
@@ -1058,38 +1211,19 @@
        INITIALIZE();
        if (!path)
                path = "/";
-       if (isdigit(*name))
-       {
-               n = (int)strtol(name, &e, 10);
-               if (!*e)
-               {
-                       if (value)
-                               goto ro;
-                       v = sysconf(n);
-                       if (v == -1)
-                               return "error";
-                       s = fmtbuf(n = 16);
-                       sfsprintf(s, n, "%lu", v);
-                       return s;
-               }
-       }
-       if (state.recent && streq(name, state.recent->name) && (s = 
format(state.recent, path, value, conferror)))
+       if (state.recent && streq(name, state.recent->name) && (s = 
format(state.recent, path, value, flags, conferror)))
                return s;
-       if (lookup(&look, name))
+       if (lookup(&look, name, flags))
        {
                if (value)
                {
                ro:
                        errno = EINVAL;
                        if (conferror)
-                       {
                                (*conferror)(&state, &state, 2, "%s: cannot set 
value", name);
-                               return 0;
-                       }
-                       return null;
+                       return (flags & ASTCONF_error) ? (char*)0 : null;
                }
-               s = print(NiL, &look, name, path, 0, conferror);
-               return s;
+               return print(NiL, &look, name, path, flags, conferror);
        }
        if ((n = strlen(name)) > 3 && n < (ALT + 3))
        {
@@ -1100,8 +1234,7 @@
                                sfprintf(tmp, "/dev/");
                                for (s = (char*)name; s < (char*)name + n - 3; 
s++)
                                        sfputc(tmp, isupper(*s) ? tolower(*s) : 
*s);
-                               s = sfstruse(tmp);
-                               if (!access(s, F_OK))
+                               if ((s = sfstruse(tmp)) && !access(s, F_OK))
                                {
                                        if (value)
                                                goto ro;
@@ -1121,19 +1254,16 @@
 
                        strcpy(altname, name);
                        altname[n - 3] = 0;
-                       if (lookup(&altlook, altname))
+                       if (lookup(&altlook, altname, flags))
                        {
                                if (value)
                                {
                                        errno = EINVAL;
                                        if (conferror)
-                                       {
                                                (*conferror)(&state, &state, 2, 
"%s: cannot set value", altname);
-                                               return 0;
-                                       }
-                                       return null;
+                                       return (flags & ASTCONF_error) ? 
(char*)0 : null;
                                }
-                               return print(NiL, &altlook, altname, path, 0, 
conferror);
+                               return print(NiL, &altlook, altname, path, 
flags, conferror);
                        }
                        for (s = altname; *s; s++)
                                if (isupper(*s))
@@ -1143,8 +1273,7 @@
                                for (n = 0; n < elementsof(dirs); n++)
                                {
                                        sfprintf(tmp, "%s/%s/.", dirs[n], 
altname);
-                                       s = sfstruse(tmp);
-                                       if (!access(s, F_OK))
+                                       if ((s = sfstruse(tmp)) && !access(s, 
F_OK))
                                        {
                                                if (value)
                                                        goto ro;
@@ -1157,18 +1286,22 @@
                        }
                }
        }
-       if ((look.standard < 0 || look.standard == CONF_AST) && look.call <= 0 
&& look.section <= 1 && (s = feature(look.name, path, value, conferror)))
+       if ((look.standard < 0 || look.standard == CONF_AST) && look.call <= 0 
&& look.section <= 1 && (s = feature(look.name, path, value, flags, conferror)))
                return s;
        errno = EINVAL;
-       if (conferror)
-               return 0;
-       return null;
+       if (conferror && !(flags & ASTCONF_system))
+               (*conferror)(&state, &state, 2, "%s: unknown name", name);
+       return (flags & ASTCONF_error) ? (char*)0 : null;
 }
 
+/*
+ * astconf() never returns 0
+ */
+
 char*
 astconf(const char* name, const char* path, const char* value)
 {
-       return astgetconf(name, path, value, 0);
+       return astgetconf(name, path, value, 0, 0);
 }
 
 /*
@@ -1204,6 +1337,10 @@
        regdisc_t       redisc;
        int             olderrno;
        char            flg[8];
+#ifdef _pth_getconf_a
+       Proc_t*         proc;
+       Sfio_t*         pp;
+#endif
 
        INITIALIZE();
        if (!path)
@@ -1231,6 +1368,7 @@
                        return;
        }
        if (flags & ASTCONF_read)
+       {
                for (look.conf = (Conf_t*)conf; look.conf < 
(Conf_t*)&conf[conf_elements]; look.conf++)
                {
                        if (pattern)
@@ -1253,9 +1391,39 @@
                        }
                        print(sp, &look, NiL, path, flags, errorf);
                }
+#ifdef _pth_getconf_a
+               if (pp = nativeconf(&proc, _pth_getconf_a))
+               {
+                       call = "GC";
+                       while (f = sfgetr(pp, '\n', 1))
+                       {
+                               for (s = f; *s && *s != '=' && *s != ':' && 
!isspace(*s); s++);
+                               if (*s)
+                                       for (*s++ = 0; isspace(*s); s++);
+                               if (!lookup(&look, f, flags))
+                               {
+                                       if (flags & ASTCONF_table)
+                                       {
+                                               if (look.standard < 0)
+                                                       look.standard = 0;
+                                               if (look.section < 1)
+                                                       look.section = 1;
+                                               sfprintf(sp, "%*s %*s %d %2s 
%4d %5s %s\n", sizeof(conf[0].name), f, sizeof(prefix[look.standard].name), 
prefix[look.standard].name, look.section, call, 0, "N", s);
+                                       }
+                                       else if (flags & ASTCONF_parse)
+                                               sfprintf(sp, "%s %s - %s\n", 
state.id, f, s); 
+                                       else
+                                               sfprintf(sp, "%s=%s\n", f, 
(flags & ASTCONF_quote) ? fmtquote(s, "\"", "\"", strlen(s), FMT_SHELL) : s);
+                               }
+                       }
+                       sfclose(pp);
+                       procclose(proc);
+               }
+#endif
+       }
        if (flags & ASTCONF_write)
        {
-               call = "GC";
+               call = "AC";
                for (fp = state.features; fp; fp = fp->next)
                {
                        if (pattern)
@@ -1276,7 +1444,7 @@
                                                continue;
                                }
                        }
-                       if (!*(s = feature(fp->name, path, NiL, 0)))
+                       if (!(s = feature(fp->name, path, NiL, 0, 0)) || !*s)
                                s = "0";
                        if (flags & ASTCONF_table)
                        {
@@ -1288,10 +1456,10 @@
                                if (f == flg)
                                        *f++ = 'X';
                                *f = 0;
-                               sfprintf(sp, "%*s %*s %d %2s %5s %s\n", 
sizeof(conf[0].name), fp->name, sizeof(prefix[fp->standard].name), 
prefix[fp->standard].name, 1, call, flg, s);
+                               sfprintf(sp, "%*s %*s %d %2s %4d %5s %s\n", 
sizeof(conf[0].name), fp->name, sizeof(prefix[fp->standard].name), 
prefix[fp->standard].name, 1, call, 0, flg, s);
                        }
                        else if (flags & ASTCONF_parse)
-                               sfprintf(sp, "%s %s - %s\n", state.id, (flags & 
ASTCONF_lower) ? fmtlower(fp->name) : fp->name, s); 
+                               sfprintf(sp, "%s %s - %s\n", state.id, (flags & 
ASTCONF_lower) ? fmtlower(fp->name) : fp->name, fmtquote(s, "\"", "\"", 
strlen(s), FMT_SHELL)); 
                        else
                                sfprintf(sp, "%s=%s\n", (flags & ASTCONF_lower) 
? fmtlower(fp->name) : fp->name, (flags & ASTCONF_quote) ? fmtquote(s, "\"", 
"\"", strlen(s), FMT_SHELL) : s);
                }
diff -r -N -u ksh93_2006_09_12/src/lib/libast/port/astlicense.c 
ksh93_2006_10_31/src/lib/libast/port/astlicense.c
--- ksh93_2006_09_12/src/lib/libast/port/astlicense.c   2006-02-01 
18:36:56.000000000 +0100
+++ ksh93_2006_10_31/src/lib/libast/port/astlicense.c   2006-10-04 
20:53:54.000000000 +0200
@@ -37,6 +37,7 @@
 #endif
 
 #undef copy
+#undef BSD                     /* guess who defines this */
 #undef END
 #undef INLINE
 #undef TEST
diff -r -N -u ksh93_2006_09_12/src/lib/libast/regex/regcomp.c 
ksh93_2006_10_31/src/lib/libast/regex/regcomp.c
--- ksh93_2006_09_12/src/lib/libast/regex/regcomp.c     2006-08-23 
17:27:07.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/regex/regcomp.c     2006-10-06 
22:29:56.000000000 +0200
@@ -31,6 +31,8 @@
 #include "lclib.h"
 #endif
 
+#define serialize              re_serialize    /* hp.ia64 <unistd.h>! */
+
 #define C_ESC                  (-1)
 #define C_MB                   (-2)
 
@@ -115,6 +117,7 @@
        int             type;           /* BRE,ERE,ARE,SRE,KRE          */
        unsigned char*  cursor;         /* curent point in re           */
        unsigned char*  pattern;        /* the original pattern         */
+       unsigned char*  literal;        /* literal restart pattern      */
        int             parno;          /* number of last open paren    */
        int             parnest;        /* paren nest count             */
        int             posixkludge;    /* to make * nonspecial         */
@@ -2093,8 +2096,7 @@
                                        env->flags |= REG_NEWLINE;
                                else
                                        env->flags &= ~REG_NEWLINE;
-                               if (env->type < SRE)
-                                       env->explicit = (env->flags & 
(REG_NEWLINE|REG_SPAN)) == REG_NEWLINE ? env->mappednewline : -1;
+                               env->explicit = (env->flags & 
(REG_NEWLINE|REG_SPAN)) == REG_NEWLINE ? env->mappednewline : -1;
                                break;
                        case 'p':
                                if (i)
@@ -2113,8 +2115,7 @@
                                        env->flags |= REG_SPAN;
                                else
                                        env->flags &= ~REG_SPAN;
-                               if (env->type < SRE)
-                                       env->explicit = (env->flags & 
(REG_NEWLINE|REG_SPAN)) == REG_NEWLINE ? env->mappednewline : -1;
+                               env->explicit = (env->flags & 
(REG_NEWLINE|REG_SPAN)) == REG_NEWLINE ? env->mappednewline : -1;
                                break;
                        case 'x':
                                if (i)
@@ -2694,6 +2695,7 @@
                                env->type = type;
                                break;
                        case T_GROUP:
+                               p = env->cursor;
                                eat(env);
                                flags = env->flags;
                                type = env->type;
@@ -2701,6 +2703,8 @@
                                {
                                        if (env->error)
                                                return 0;
+                                       if (env->literal == env->pattern && 
env->literal == p)
+                                               env->literal = env->cursor;
                                        continue;
                                }
                                env->flags = flags;
@@ -3216,11 +3220,10 @@
        {
                if (env.flags & REG_SHELL_PATH)
                        env.explicit = env.mappedslash;
-               env.flags &= ~REG_NEWLINE;
                env.flags |= REG_LENIENT|REG_NULL;
                env.type = env.type == BRE ? SRE : KRE;
        }
-       else if ((env.flags & (REG_NEWLINE|REG_SPAN)) == REG_NEWLINE)
+       if ((env.flags & (REG_NEWLINE|REG_SPAN)) == REG_NEWLINE)
                env.explicit = env.mappednewline;
        p->env->leading = (env.flags & REG_SHELL_DOT) ? env.mappeddot : -1;
        env.posixkludge = !(env.flags & (REG_EXTENDED|REG_SHELL));
@@ -3239,7 +3242,7 @@
                }
                env.terminator = '\n';
        }
-       env.pattern = env.cursor = (unsigned char*)pattern;
+       env.literal = env.pattern = env.cursor = (unsigned char*)pattern;
        if (!(p->env->rex = alt(&env, 1, 0)))
                goto bad;
        if (env.parnest)
@@ -3336,6 +3339,7 @@
        if (env.type >= SRE && env.error != REG_ESPACE && !(flags & 
REG_LITERAL))
        {
                flags |= REG_LITERAL;
+               pattern = (const char*)env.literal;
                goto again;
        }
        return fatal(disc, env.error, pattern);
diff -r -N -u ksh93_2006_09_12/src/lib/libast/regex/regdecomp.c 
ksh93_2006_10_31/src/lib/libast/regex/regdecomp.c
--- ksh93_2006_09_12/src/lib/libast/regex/regdecomp.c   1970-01-01 
01:00:00.000000000 +0100
+++ ksh93_2006_10_31/src/lib/libast/regex/regdecomp.c   2006-09-28 
16:00:07.000000000 +0200
@@ -0,0 +1,388 @@
+/***********************************************************************
+*                                                                      *
+*               This software is part of the ast package               *
+*           Copyright (c) 1985-2006 AT&T Knowledge Ventures            *
+*                      and is licensed under the                       *
+*                  Common Public License, Version 1.0                  *
+*                      by AT&T Knowledge Ventures                      *
+*                                                                      *
+*                A copy of the License is available at                 *
+*            http://www.opensource.org/licenses/cpl1.0.txt             *
+*         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
+*                                                                      *
+*              Information and Software Systems Research               *
+*                            AT&T Research                             *
+*                           Florham Park NJ                            *
+*                                                                      *
+*                 Glenn Fowler <gsf at research.att.com>                  *
+*                  David Korn <dgk at research.att.com>                   *
+*                   Phong Vo <kpv at research.att.com>                    *
+*                                                                      *
+***********************************************************************/
+#pragma prototyped
+
+/*
+ * posix regex decompiler
+ */
+
+#include "reglib.h"
+
+#undef ismeta
+#define ismeta(c,t,e)  (state.magic[c] && state.magic[c][(t)+(e)] >= T_META)
+#define meta(f,c,t,e)  do { if (ismeta(c,t,e)) sfputc(f, '\\'); sfputc(f, c); 
} while (0)
+
+static void
+detrie(Trie_node_t* x, Sfio_t* sp, char* b, char* p, char* e)
+{
+       register Trie_node_t*   y;
+       char*                   o;
+       int                     k;
+
+       o = p;
+       k = 1;
+       do
+       {
+               if (k)
+               {
+                       o = p;
+                       if (p < e)
+                               *p++ = x->c;
+               }
+               sfputc(sp, x->c);
+               for (y = x->sib; y; y = y->sib)
+               {
+                       sfputc(sp, '|');
+                       sfputc(sp, '<');
+                       sfwrite(sp, b, p - b);
+                       sfputc(sp, '>');
+                       detrie(y, sp, b, p, e);
+               }
+               if (x->end && x->son)
+               {
+                       sfputc(sp, '|');
+                       sfputc(sp, '{');
+                       sfwrite(sp, b, p - b);
+                       sfputc(sp, '}');
+                       p = o;
+               }
+       } while (x = x->son);
+}
+
+static int
+decomp(register Rex_t* e, Sfio_t* sp, int type)
+{
+       Rex_t*          q;
+       unsigned char*  s;
+       unsigned char*  t;
+       int             c;
+       int             ib;
+       int             ie;
+       int             nb;
+       int             ne;
+       unsigned char   ic[2*UCHAR_MAX];
+       unsigned char   nc[2*UCHAR_MAX];
+
+       do
+       {
+               switch (e->type)
+               {
+               case REX_ALT:
+                       if (decomp(e->re.group.expr.binary.left, sp, type))
+                               return 1;
+                       sfputc(sp, '|');
+                       if (e->re.group.expr.binary.right && 
decomp(e->re.group.expr.binary.right, sp, type))
+                               return 1;
+                       break;
+               case REX_BACK:
+                       sfprintf(sp, "\\%d", e->lo);
+                       break;
+               case REX_BEG:
+                       if (type < SRE)
+                               sfputc(sp, '^');
+                       break;
+               case REX_END:
+                       if (type < SRE)
+                               sfputc(sp, '$');
+                       break;
+               case REX_WBEG:
+                       meta(sp, '<', type, 1);
+                       break;
+               case REX_WEND:
+                       meta(sp, '<', type, 1);
+                       break;
+               case REX_WORD:
+                       sfprintf(sp, "\\w");
+                       break;
+               case REX_CLASS:
+               case REX_COLL_CLASS:
+               case REX_ONECHAR:
+               case REX_DOT:
+               case REX_REP:
+                       if (type >= SRE)
+                       {
+                               c = ')';
+                               if (e->hi == RE_DUP_INF)
+                               {
+                                       if (!e->lo)
+                                               sfputc(sp, '*');
+                                       else if (e->lo == 1)
+                                               sfputc(sp, '+');
+                                       else
+                                               sfprintf(sp, "{%d,}", e->lo);
+                               }
+                               else if (e->hi != 1)
+                                       sfprintf(sp, "{%d,%d}", e->lo, e->hi);
+                               else if (e->lo == 0)
+                                       sfputc(sp, '?');
+                               else
+                                       c = 0;
+                       }
+                       switch (e->type)
+                       {
+                       case REX_REP:
+                               if (decomp(e->re.group.expr.rex, sp, type))
+                                       return 1;
+                               break;
+                       case REX_CLASS:
+                               sfputc(sp, '[');
+                               nb = ne = ib = ie = -2;
+                               s = nc;
+                               t = ic;
+                               for (c = 0; c <= UCHAR_MAX; c++)
+                                       if (settst(e->re.charclass, c))
+                                       {
+                                               if (nb < 0)
+                                                       ne = nb = c;
+                                               else if (ne == (c - 1))
+                                                       ne = c;
+                                               else
+                                               {
+                                                       if (ne == nb)
+                                                               *s++ = ne;
+                                                       else
+                                                       {
+                                                               *s++ = nb;
+                                                               *s++ = '-';
+                                                               *s++ = ne;
+                                                       }
+                                                       ne = nb = c;
+                                               }
+                                       }
+                                       else
+                                       {
+                                               if (ib < 0)
+                                                       ie = ib = c;
+                                               else if (ie == (c - 1))
+                                                       ie = c;
+                                               else
+                                               {
+                                                       if (ie == ib)
+                                                               *t++ = ie;
+                                                       else
+                                                       {
+                                                               *t++ = ib;
+                                                               *t++ = '-';
+                                                               *t++ = ie;
+                                                       }
+                                                       ie = ib = c;
+                                               }
+                                       }
+                               if (nb >= 0)
+                               {
+                                       *s++ = nb;
+                                       if (ne != nb)
+                                       {
+                                               *s++ = '-';
+                                               *s++ = ne;
+                                       }
+                               }
+                               if (ib >= 0)
+                               {
+                                       *t++ = ib;
+                                       if (ie != ib)
+                                       {
+                                               *t++ = '-';
+                                               *t++ = ie;
+                                       }
+                               }
+                               if ((t - ic + 1) < (s - nc + (nc[0] == '^')))
+                               {
+                                       sfputc(sp, '^');
+                                       sfwrite(sp, ic, t - ic);
+                               }
+                               else
+                               {
+                                       if (nc[0] == '^')
+                                               sfputc(sp, '\\');
+                                       sfwrite(sp, nc, s - nc);
+                               }
+                               sfputc(sp, ']');
+                               break;
+                       case REX_COLL_CLASS:
+                               break;
+                       case REX_ONECHAR:
+                               meta(sp, e->re.onechar, type, 1);
+                               break;
+                       case REX_DOT:
+                               sfputc(sp, '.');
+                               break;
+                       }
+                       if (type < SRE)
+                       {
+                               if (e->hi == RE_DUP_INF)
+                               {
+                                       if (!e->lo)
+                                               sfputc(sp, '*');
+                                       else if (e->lo == 1 && ismeta('+', 
type, 0))
+                                               meta(sp, '+', type, 1);
+                                       else
+                                       {
+                                               meta(sp, '{', type, 1);
+                                               sfprintf(sp, "%d,", e->lo);
+                                               meta(sp, '}', type, 1);
+                                       }
+                               }
+                               else if (e->hi != 1 || e->lo == 0 && 
!ismeta('?', type, 0))
+                               {
+                                       meta(sp, '{', type, 1);
+                                       sfprintf(sp, "%d,%d", e->lo, e->hi);
+                                       meta(sp, '}', type, 1);
+                               }
+                               else if (e->lo == 0)
+                                       meta(sp, '?', type, 1);
+                       }
+                       else if (c)
+                               sfputc(sp, c);
+                       break;
+               case REX_STRING:
+                       t = (s = e->re.string.base) + e->re.string.size;
+                       while (s < t)
+                       {
+                               c = *s++;
+                               meta(sp, c, type, 0);
+                       }
+                       break;
+               case REX_TRIE:
+                       ib = 0;
+                       for (c = 0; c <= UCHAR_MAX; c++)
+                               if (e->re.trie.root[c])
+                               {
+                                       char    pfx[1024];
+
+                                       if (ib)
+                                               sfputc(sp, '|');
+                                       else
+                                               ib = 1;
+                                       detrie(e->re.trie.root[c], sp, pfx, 
pfx, &pfx[sizeof(pfx)]);
+                               }
+                       break;
+               case REX_NEG:
+                       if (type >= SRE)
+                               sfprintf(sp, "!(");
+                       if (decomp(e->re.group.expr.rex, sp, type))
+                               return 1;
+                       if (type >= SRE)
+                               sfputc(sp, ')');
+                       else
+                               sfputc(sp, '!');
+                       break;
+               case REX_CONJ:
+                       if (decomp(e->re.group.expr.binary.left, sp, type))
+                               return 1;
+                       sfputc(sp, '&');
+                       if (decomp(e->re.group.expr.binary.right, sp, type))
+                               return 1;
+                       break;
+               case REX_GROUP:
+                       if (type >= SRE)
+                               sfputc(sp, '@');
+                       meta(sp, '(', type, 1);
+                       if (decomp(e->re.group.expr.rex, sp, type))
+                               return 1;
+                       meta(sp, ')', type, 1);
+                       break;
+               case REX_GROUP_AHEAD:
+               case REX_GROUP_AHEAD_NOT:
+               case REX_GROUP_BEHIND:
+               case REX_GROUP_BEHIND_NOT:
+                       meta(sp, '(', type, 1);
+                       sfputc(sp, '?');
+                       if (decomp(e->re.group.expr.rex, sp, type))
+                               return 1;
+                       meta(sp, ')', type, 1);
+                       break;
+               case REX_GROUP_COND:
+                       meta(sp, '(', type, 1);
+                       sfputc(sp, '?');
+                       if (e->re.group.expr.binary.left && 
decomp(e->re.group.expr.binary.left, sp, type))
+                               return 1;
+                       if (q = e->re.group.expr.binary.right)
+                       {
+                               sfputc(sp, ':');
+                               if (q->re.group.expr.binary.left && 
decomp(q->re.group.expr.binary.left, sp, type))
+                                       return 1;
+                               sfputc(sp, ':');
+                               if (q->re.group.expr.binary.right && 
decomp(q->re.group.expr.binary.right, sp, type))
+                                       return 1;
+                       }
+                       meta(sp, ')', type, 1);
+                       break;
+               case REX_GROUP_CUT:
+                       meta(sp, '(', type, 1);
+                       sfputc(sp, '?');
+                       if (decomp(e->re.group.expr.rex, sp, type))
+                               return 1;
+                       meta(sp, ')', type, 1);
+                       break;
+               }
+       } while (e = e->next);
+       return 0;
+}
+
+/*
+ * reconstruct pattern from compiled re p into sp
+ */
+
+size_t
+regdecomp(regex_t* p, regflags_t flags, char* buf, size_t n)
+{
+       Sfio_t*         sp;
+       char*           s;
+       int             type;
+       size_t          r;
+
+       if (!(sp = sfstropen()))
+               return 0;
+       if (flags < 0)
+               flags = p->env->flags;
+       switch (flags & (REG_AUGMENTED|REG_EXTENDED|REG_SHELL))
+       {
+       case 0:
+               type = BRE;
+               break;
+       case REG_AUGMENTED:
+       case REG_AUGMENTED|REG_EXTENDED:
+               type = ARE;
+               break;
+       case REG_EXTENDED:
+               type = ERE;
+               break;
+       case REG_SHELL:
+               type = SRE;
+               break;
+       default:
+               type = KRE;
+               break;
+       }
+       if (decomp(p->env->rex, sp, type))
+               r = 0;
+       else if ((r = sfstrtell(sp) + 1) <= n)
+       {
+               if (!(s = sfstruse(sp)))
+                       r = 0;
+               else
+                       memcpy(buf, s, r);
+       }
+       sfstrclose(sp);
+       return r;
+}
diff -r -N -u ksh93_2006_09_12/src/lib/libast/RELEASE 
ksh93_2006_10_31/src/lib/libast/RELEASE
--- ksh93_2006_09_12/src/lib/libast/RELEASE     2006-09-12 17:23:26.000000000 
+0200
+++ ksh93_2006_10_31/src/lib/libast/RELEASE     2006-11-02 20:50:51.000000000 
+0100
@@ -1,3 +1,36 @@
+06-10-31 disc/sfdcseekable.c: add SFSK_DISCARD for seekable window control
+06-10-31 comp/spawnveg.c,features/lib: handle posix_spawn exit status 127
+06-10-30 features/lib: fix posix_spawn() fork() prototype conflicts
+06-10-30 string/fmtscale.c: fix 1024 rounding bugs
+06-10-27 disc/sfkeyprintf.c: handle 'i' (=='d') -- oops
+06-10-26 sfio/sfvprintf.c: %#d => fmtscale(1000), %#i => fmtscale(1024)
+06-10-26 features/map.c: _map_libc cleanup
+06-10-26 features/fcntl: add to the circle of trust
+06-10-26 features/sys: add <sys/socket.h> socklen_t
+06-10-26 include/regex.h: handle include before <ast_map.h>
+06-10-25 astconf "SHELL" => "SH" to avoid _POSIX_SHELL conflict
+06-10-25 comp/conf.*: drop no-op duplicate conftab.c entries
+06-10-18 string/fmtscale.c: 1000: n[.]n[n](kMGTPE), 1024: n[.]n[n](KMGTPE)i
+06-10-11 ast_std.h: now implies <sys/stat.h> (did on most before anyway)
+06-10-11 strtoi.h: ignore sign for 0, validate scale shift
+06-10-11 strdup.c,vmstrdup.c: handle 0 arg
+06-10-11 add sfstruse()/sfstropen() error checks
+06-10-10 misc/procopen.c: envv==environ => don't modify environ
+06-10-10 misc/procclose.c: return valid exit(1) status
+06-10-06 port/astconf.c,comp/conf.sh,comp/conf.tab: play nice with getconf(1)
+06-10-01 comp/conf.tab: SHELL default checks { _CS_PATH } X { ksh ksh93 sh }
+06-10-01 comp/conf.sh: export CONF_getconf to shell actions
+06-10-01 comp/putenv.c: always enable setenv() for procopen()
+06-10-01 misc/procopen.c: use pathshell() or astconf("SHELL",0,0) if PARANOID
+06-10-01 path/pathshell.c: localize the shell path patterns and accept ksh93
+06-09-28 Makefile: avoid ast <stdio.h> vix iffe -X ast -- doh
+06-09-27 regex/regdecomp.c: add
+06-09-26 regex/regcomp.c: handle KRE ~(...)<invalid-kre>
+06-09-25 reorganize to avoid native header intercepts
+06-09-15 uwin/crypt.c: _UWIN only!
+06-09-14 Makefile: tweak the ast_common.h bootstrap again (finally?)
+06-09-14 misc/optget.c: noncommercial => OPT_proprietary
+06-09-12 string/strelapsed.c: fix multi-char qualifier parse
 06-09-12 string/strtoi.h: drop [cClLqQwW] multipliers
 06-09-11 misc/optget.c: add numeric arg validity check
 06-09-07 misc/optget.c,tm/tmfix.c: fix uninitialzed var refs
diff -r -N -u ksh93_2006_09_12/src/lib/libast/sfio/sfstrtof.h 
ksh93_2006_10_31/src/lib/libast/sfio/sfstrtof.h
--- ksh93_2006_09_12/src/lib/libast/sfio/sfstrtof.h     2006-08-30 
16:38:36.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/sfio/sfstrtof.h     2006-10-13 
05:45:44.000000000 +0200
@@ -20,7 +20,7 @@
 *                                                                      *
 ***********************************************************************/
 /*
- * AT&T Labs Research
+ * AT&T Research
  * Glenn Fowler & Phong Vo
  *
  * common header and implementation for
diff -r -N -u ksh93_2006_09_12/src/lib/libast/sfio/sfvprintf.c 
ksh93_2006_10_31/src/lib/libast/sfio/sfvprintf.c
--- ksh93_2006_09_12/src/lib/libast/sfio/sfvprintf.c    2006-07-21 
10:50:51.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/sfio/sfvprintf.c    2006-10-27 
21:41:09.000000000 +0200
@@ -106,6 +106,9 @@
        Sflong_t        lv;
        char            *sp, *ssp, *endsp, *ep, *endep;
        int             dot, width, precis, sign, decpt;
+#if _PACKAGE_ast
+       int             scale;
+#endif
        ssize_t         size;
        Sfdouble_t      dval;
        char            *tls[2], **ls;  /* for %..[separ]s              */
@@ -213,6 +216,9 @@
                else    form += 1;
 
                flags = 0;
+#if _PACKAGE_ast
+               scale = 0;
+#endif
                size = width = precis = base = n_s = argp = -1;
                ssp = _Sfdigits;
                endep = ep = NIL(char*);
@@ -658,6 +664,13 @@
                                {       sp = "(null)";
                                        flags &= ~SFFMT_LONG;
                                }
+#if _PACKAGE_ast
+               str_cvt:
+                               if(scale)
+                               {       size = base = -1;
+                                       flags &= ~SFFMT_LONG;
+                               }
+#endif
                                ls = tls; tls[0] = sp;
                        }
                        for(sp = *ls;;)
@@ -829,12 +842,24 @@
                        flags &= ~(SFFMT_SIGN|SFFMT_BLANK);
                        goto int_arg;
                case 'i':
+#if _PACKAGE_ast
+                       if((flags&SFFMT_ALTER) && base < 0)
+                       {       flags &= ~SFFMT_ALTER;
+                               scale = 1024;
+                       }
+#endif
                        fmt = 'd';
                        goto d_format;
                case 'u':
                        flags &= ~(SFFMT_SIGN|SFFMT_BLANK);
                case 'd':
                d_format:
+#if _PACKAGE_ast
+                       if((flags&SFFMT_ALTER) && base < 0)
+                       {       flags &= ~SFFMT_ALTER;
+                               scale = 1000;
+                       }
+#endif
                        if(base < 2 || base > SF_RADIX)
                                base = 10;
                        if((base&(n_s = base-1)) == 0)
@@ -857,6 +882,12 @@
                                        lv = (Sflong_t)argv.l;
                                else    lv = (Sflong_t)argv.ul;
                        long_cvt:
+#if _PACKAGE_ast
+                               if(scale)
+                               {       sp = fmtscale(lv, scale);
+                                       goto str_cvt;
+                               }
+#endif
                                if(lv == 0 && precis == 0)
                                        break;
                                if(lv < 0 && fmt == 'd' )
@@ -908,6 +939,12 @@
                        else
                        {       v = argv.i;
                        int_cvt:
+#if _PACKAGE_ast
+                               if(scale)
+                               {       sp = fmtscale(v, scale);
+                                       goto str_cvt;
+                               }
+#endif
                                if(v == 0 && precis == 0)
                                        break;
                                if(v < 0 && fmt == 'd' )
diff -r -N -u ksh93_2006_09_12/src/lib/libast/std/bytesex.h 
ksh93_2006_10_31/src/lib/libast/std/bytesex.h
--- ksh93_2006_09_12/src/lib/libast/std/bytesex.h       1970-01-01 
01:00:00.000000000 +0100
+++ ksh93_2006_10_31/src/lib/libast/std/bytesex.h       1999-12-16 
11:51:29.000000000 +0100
@@ -0,0 +1,43 @@
+/***********************************************************************
+*                                                                      *
+*               This software is part of the ast package               *
+*           Copyright (c) 1985-2006 AT&T Knowledge Ventures            *
+*                      and is licensed under the                       *
+*                  Common Public License, Version 1.0                  *
+*                      by AT&T Knowledge Ventures                      *
+*                                                                      *
+*                A copy of the License is available at                 *
+*            http://www.opensource.org/licenses/cpl1.0.txt             *
+*         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
+*                                                                      *
+*              Information and Software Systems Research               *
+*                            AT&T Research                             *
+*                           Florham Park NJ                            *
+*                                                                      *
+*                 Glenn Fowler <gsf at research.att.com>                  *
+*                  David Korn <dgk at research.att.com>                   *
+*                   Phong Vo <kpv at research.att.com>                    *
+*                                                                      *
+***********************************************************************/
+/*
+ * linux/gnu compatibility
+ */
+
+#ifndef _BYTESEX_H
+#define _BYTESEX_H
+
+#include <ast_common.h>
+
+#undef __BYTE_ORDER
+
+#if ( _ast_intswap & 3 ) == 3
+#define __BYTE_ORDER   __LITTLE_ENDIAN
+#else
+#if ( _ast_intswap & 3 ) == 1
+#define __BYTE_ORDER   __PDP_ENDIAN
+#else
+#define __BYTE_ORDER   __BIG_ENDIAN
+#endif
+#endif
+
+#endif
diff -r -N -u ksh93_2006_09_12/src/lib/libast/std/endian.h 
ksh93_2006_10_31/src/lib/libast/std/endian.h
--- ksh93_2006_09_12/src/lib/libast/std/endian.h        1970-01-01 
01:00:00.000000000 +0100
+++ ksh93_2006_10_31/src/lib/libast/std/endian.h        1996-12-10 
23:26:58.000000000 +0100
@@ -0,0 +1,54 @@
+/***********************************************************************
+*                                                                      *
+*               This software is part of the ast package               *
+*           Copyright (c) 1985-2006 AT&T Knowledge Ventures            *
+*                      and is licensed under the                       *
+*                  Common Public License, Version 1.0                  *
+*                      by AT&T Knowledge Ventures                      *
+*                                                                      *
+*                A copy of the License is available at                 *
+*            http://www.opensource.org/licenses/cpl1.0.txt             *
+*         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
+*                                                                      *
+*              Information and Software Systems Research               *
+*                            AT&T Research                             *
+*                           Florham Park NJ                            *
+*                                                                      *
+*                 Glenn Fowler <gsf at research.att.com>                  *
+*                  David Korn <dgk at research.att.com>                   *
+*                   Phong Vo <kpv at research.att.com>                    *
+*                                                                      *
+***********************************************************************/
+/*
+ * linux/gnu compatibility
+ */
+
+#ifndef _ENDIAN_H
+#define _ENDIAN_H
+
+#include <bytesex.h>
+
+#define        __LITTLE_ENDIAN 1234
+#define        __BIG_ENDIAN    4321
+#define        __PDP_ENDIAN    3412
+
+#if defined (__USE_BSD) && !defined(__STRICT_ANSI__)
+
+#ifndef LITTLE_ENDIAN
+#define        LITTLE_ENDIAN   __LITTLE_ENDIAN
+#endif
+
+#ifndef BIG_ENDIAN
+#define        BIG_ENDIAN      __BIG_ENDIAN
+#endif
+
+#ifndef PDP_ENDIAN
+#define        PDP_ENDIAN      __PDP_ENDIAN
+#endif
+
+#undef BYTE_ORDER
+#define        BYTE_ORDER      __BYTE_ORDER
+
+#endif
+
+#endif
diff -r -N -u ksh93_2006_09_12/src/lib/libast/std/limits.h 
ksh93_2006_10_31/src/lib/libast/std/limits.h
--- ksh93_2006_09_12/src/lib/libast/std/limits.h        2002-03-04 
14:40:43.000000000 +0100
+++ ksh93_2006_10_31/src/lib/libast/std/limits.h        1970-01-01 
01:00:00.000000000 +0100
@@ -1,22 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*           Copyright (c) 1985-2006 AT&T Knowledge Ventures            *
-*                      and is licensed under the                       *
-*                  Common Public License, Version 1.0                  *
-*                      by AT&T Knowledge Ventures                      *
-*                                                                      *
-*                A copy of the License is available at                 *
-*            http://www.opensource.org/licenses/cpl1.0.txt             *
-*         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf at research.att.com>                  *
-*                  David Korn <dgk at research.att.com>                   *
-*                   Phong Vo <kpv at research.att.com>                    *
-*                                                                      *
-***********************************************************************/
-#include <ast_limits.h>
diff -r -N -u ksh93_2006_09_12/src/lib/libast/stdio/_stdfun.c 
ksh93_2006_10_31/src/lib/libast/stdio/_stdfun.c
--- ksh93_2006_09_12/src/lib/libast/stdio/_stdfun.c     2006-02-15 
20:16:50.000000000 +0100
+++ ksh93_2006_10_31/src/lib/libast/stdio/_stdfun.c     2006-09-24 
10:34:17.000000000 +0200
@@ -32,8 +32,11 @@
 #include <ast_windows.h>
 #include <uwin.h>
 #include <dlfcn.h>
+#include "FEATURE/uwin"
 
-#if _ALPHA_
+#if _lib___iob_func
+#define IOB            ((char*)__iob_func())
+#elif _dat__iob
 #define IOB            ((char*)_iob)
 #else
 #define IOB            ((char*)__p__iob())
diff -r -N -u ksh93_2006_09_12/src/lib/libast/stdio/vfwprintf.c 
ksh93_2006_10_31/src/lib/libast/stdio/vfwprintf.c
--- ksh93_2006_09_12/src/lib/libast/stdio/vfwprintf.c   2004-10-27 
21:43:59.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/stdio/vfwprintf.c   2006-10-12 
20:29:08.000000000 +0200
@@ -44,12 +44,16 @@
                        wcstombs(m, fmt, n + 1);
                        sfvprintf(t, m, args);
                        free(m);
-                       x = sfstruse(t);
-                       n = mbstowcs(NiL, x, 0);
-                       if (w = (wchar_t*)sfreserve(f, n * sizeof(wchar_t) + 1, 
0))
-                               v = mbstowcs(w, x, n + 1);
-                       else
+                       if (!(x = sfstruse(t)))
                                v = -1;
+                       else
+                       {
+                               n = mbstowcs(NiL, x, 0);
+                               if (w = (wchar_t*)sfreserve(f, n * 
sizeof(wchar_t) + 1, 0))
+                                       v = mbstowcs(w, x, n + 1);
+                               else
+                                       v = -1;
+                       }
                        sfstrclose(t);
                }
                else
diff -r -N -u ksh93_2006_09_12/src/lib/libast/string/fmtclock.c 
ksh93_2006_10_31/src/lib/libast/string/fmtclock.c
--- ksh93_2006_09_12/src/lib/libast/string/fmtclock.c   2000-10-21 
06:11:30.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/string/fmtclock.c   2006-10-06 
23:43:45.000000000 +0200
@@ -35,11 +35,15 @@
        char*                   buf;
        int                     z;
 
+       static unsigned int     clk_tck;
+
+       if (!clk_tck && !(clk_tck = (unsigned int)strtoul(astconf("CLK_TCK", 
NiL, NiL), NiL, 10)))
+               clk_tck = 60;
        if (t == 0)
                return "0";
        if (t == ((Sfulong_t)~0))
                return "%";
-       t = (t * 1000000) / CLOCKS_PER_SEC;
+       t = (t * 1000000) / clk_tck;
        if (t < 1000)
                u = 'u';
        else if ((t /= 1000) < 1000)
diff -r -N -u ksh93_2006_09_12/src/lib/libast/string/fmtscale.c 
ksh93_2006_10_31/src/lib/libast/string/fmtscale.c
--- ksh93_2006_09_12/src/lib/libast/string/fmtscale.c   2001-02-20 
07:44:17.000000000 +0100
+++ ksh93_2006_10_31/src/lib/libast/string/fmtscale.c   2006-10-31 
05:46:16.000000000 +0100
@@ -24,10 +24,12 @@
  * Glenn Fowler
  * AT&T Research
  *
- * return number n scaled to metric powers of k { 1000 1024 }
+ * return number n scaled to metric multiples of k { 1000 1024 }
+ * return string length is at most 5 chars + terminating nul
  */
 
 #include <ast.h>
+#include <lclib.h>
 
 char*
 fmtscale(register Sfulong_t n, int k)
@@ -36,27 +38,57 @@
        int                     r;
        int                     z;
        const char*             u;
+       char                    suf[3];
+       char*                   s;
        char*                   buf;
+       Lc_numeric_t*           p = (Lc_numeric_t*)LCINFO(AST_LC_NUMERIC)->data;
 
-       static const char       scale[] = "bKMGTPX";
+       static const char       scale[] = "bkMGTPE";
 
-       m = 0;
        u = scale;
-       while (n > k && *(u + 1))
+       if (n < 1000)
+               r = 0;
+       else
        {
-               m = n;
-               n /= k;
-               u++;
+               m = 0;
+               while (n >= k && *(u + 1))
+               {
+                       m = n;
+                       n /= k;
+                       u++;
+               }
+               if ((r = (10 * (m % k) + (k / 2)) / k) > 9)
+               {
+                       r = 0;
+                       n++;
+               }
+               if (k == 1024 && n >= 1000)
+               {
+                       n = 1;
+                       r = 0;
+                       u++;
+               }
        }
        buf = fmtbuf(z = 8);
-       r = (m % k) / (k / 10 + 1);
+       s = suf;
+       if (u > scale)
+       {
+               if (k == 1024)
+               {
+                       *s++ = *u == 'k' ? 'K' : *u;
+                       *s++ = 'i';
+               }
+               else
+                       *s++ = *u;
+       }
+       *s = 0;
        if (n > 0 && n < 10)
-               sfsprintf(buf, z, "%I*u.%d%c", sizeof(n), n, r, *u);
+               sfsprintf(buf, z, "%I*u%c%d%s", sizeof(n), n, p->decimal >= 0 ? 
p->decimal : '.', r, suf);
        else
        {
                if (r >= 5)
                        n++;
-               sfsprintf(buf, z, "%I*u%c", sizeof(n), n, *u);
+               sfsprintf(buf, z, "%I*u%s", sizeof(n), n, suf);
        }
        return buf;
 }
diff -r -N -u ksh93_2006_09_12/src/lib/libast/string/modedata.c 
ksh93_2006_10_31/src/lib/libast/string/modedata.c
--- ksh93_2006_09_12/src/lib/libast/string/modedata.c   2003-09-23 
14:54:44.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/string/modedata.c   2006-09-21 
04:55:17.000000000 +0200
@@ -32,7 +32,7 @@
 
 struct modeop  modetab[MODELEN] =
 {
-       0170000, 12, 0000000, 0, "-pc?d?b?-Cl?sD??",
+       0170000, 12, 0000000, 0, "-pc?d?b?-Cl?sDw?",
        0000400,  8, 0000000, 0, "-r",
        0000200,  7, 0000000, 0, "-w",
        0004000, 10, 0000100, 6, "-xSs",
diff -r -N -u ksh93_2006_09_12/src/lib/libast/string/stracmp.c 
ksh93_2006_10_31/src/lib/libast/string/stracmp.c
--- ksh93_2006_09_12/src/lib/libast/string/stracmp.c    2003-05-30 
02:18:23.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/string/stracmp.c    2006-09-22 
09:24:42.000000000 +0200
@@ -36,8 +36,6 @@
 
 #include <ctype.h>
 
-#undef stracmp
-
 int
 stracmp(const char* aa, const char* ab)
 {
diff -r -N -u ksh93_2006_09_12/src/lib/libast/string/strdup.c 
ksh93_2006_10_31/src/lib/libast/string/strdup.c
--- ksh93_2006_09_12/src/lib/libast/string/strdup.c     2003-06-24 
16:18:50.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/string/strdup.c     2006-10-13 
03:15:21.000000000 +0200
@@ -40,5 +40,5 @@
        register char*  t;
        register int    n;
 
-       return (t = newof(0, char, n = strlen(s) + 1, 0)) ? (char*)memcpy(t, s, 
n) : 0;
+       return (s && (t = newof(0, char, n = strlen(s) + 1, 0))) ? 
(char*)memcpy(t, s, n) : (char*)0;
 }
diff -r -N -u ksh93_2006_09_12/src/lib/libast/string/strelapsed.c 
ksh93_2006_10_31/src/lib/libast/string/strelapsed.c
--- ksh93_2006_09_12/src/lib/libast/string/strelapsed.c 2006-08-27 
09:39:50.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/string/strelapsed.c 2006-09-14 
00:47:10.000000000 +0200
@@ -27,6 +27,7 @@
  * parse elapsed time in 1/n secs from s
  * compatible with fmtelapsed()
  * also handles ps [day-][hour:]min:sec
+ * also handles coshell % for 'infinity'
  * if e!=0 then it is set to first unrecognized char
  */
 
@@ -61,10 +62,9 @@
                {
                        t = ~t;
                        last = s;
+                       break;
                }
-               else
-                       s--;
-               if (s == last)
+               if (s == last + 1)
                        break;
                if (!p)
                        while (isspace(c) || c == '_')
@@ -72,14 +72,23 @@
                switch (c)
                {
                case 'S':
-                       v *= 20 * 12 * 4 * 7 * 24 * 60 * 60;
+                       if (*s == 'E' || *s == 'e')
+                       {
+                               v += f;
+                               f = 0;
+                       }
+                       else
+                               v *= 20 * 12 * 4 * 7 * 24 * 60 * 60;
                        break;
                case 'y':
                case 'Y':
                        v *= 12 * 4 * 7 * 24 * 60 * 60;
                        break;
                case 'M':
-                       v *= 4 * 7 * 24 * 60 * 60;
+                       if (*s == 'I' || *s == 'i')
+                               v *= 60;
+                       else
+                               v *= 4 * 7 * 24 * 60 * 60;
                        break;
                case 'w':
                        v *= 7 * 24 * 60 * 60;
diff -r -N -u ksh93_2006_09_12/src/lib/libast/string/strlcat.c 
ksh93_2006_10_31/src/lib/libast/string/strlcat.c
--- ksh93_2006_09_12/src/lib/libast/string/strlcat.c    2002-11-27 
22:38:48.000000000 +0100
+++ ksh93_2006_10_31/src/lib/libast/string/strlcat.c    2006-09-23 
05:42:18.000000000 +0200
@@ -20,20 +20,24 @@
 *                                                                      *
 ***********************************************************************/
 #pragma prototyped
+/*
+ * strlcat implementation
+ */
 
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-__STDPP__directive pragma pp:hide strlcat
-#else
 #define strlcat                ______strlcat
-#endif
 
 #include <ast.h>
 
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-__STDPP__directive pragma pp:nohide strlcat
-#else
 #undef strlcat
-#endif
+
+#undef _def_map_ast
+#include <ast_map.h>
+
+#if _lib_strlcat
+
+NoN(strlcat)
+
+#else
 
 /*
  * append at t onto s limiting total size of s to n
@@ -70,3 +74,5 @@
                while (*t++);
        return t - o - 1;
 }
+
+#endif
diff -r -N -u ksh93_2006_09_12/src/lib/libast/string/strlcpy.c 
ksh93_2006_10_31/src/lib/libast/string/strlcpy.c
--- ksh93_2006_09_12/src/lib/libast/string/strlcpy.c    2006-07-20 
12:14:12.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/string/strlcpy.c    2006-09-23 
05:42:44.000000000 +0200
@@ -20,30 +20,24 @@
 *                                                                      *
 ***********************************************************************/
 #pragma prototyped
+/*
+ * strlcpy implementation
+ */
 
-#include <ast_map.h>
-
-#ifdef strlcpy
+#define strlcpy                ______strlcpy
 
 #include <ast.h>
 
-#else
+#undef strlcpy
 
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-__STDPP__directive pragma pp:hide strlcpy
-#else
-#define strlcpy                ______strlcpy
-#endif
+#undef _def_map_ast
+#include <ast_map.h>
 
-#include <ast.h>
+#if _lib_strlcpy
 
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
-__STDPP__directive pragma pp:nohide strlcpy
-#else
-#undef strlcpy
-#endif
+NoN(strlcpy)
 
-#endif
+#else
 
 /*
  * copy at most n chars from t into s
@@ -73,3 +67,5 @@
                while (*t++);
        return t - o - 1;
 }
+
+#endif
diff -r -N -u ksh93_2006_09_12/src/lib/libast/string/strnacmp.c 
ksh93_2006_10_31/src/lib/libast/string/strnacmp.c
--- ksh93_2006_09_12/src/lib/libast/string/strnacmp.c   2003-06-11 
22:12:34.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/string/strnacmp.c   2006-09-22 
09:26:43.000000000 +0200
@@ -36,8 +36,6 @@
 
 #include <ctype.h>
 
-#undef strnacmp
-
 int
 strnacmp(const char* a, const char* b, size_t n)
 {
diff -r -N -u ksh93_2006_09_12/src/lib/libast/string/strtoi.h 
ksh93_2006_10_31/src/lib/libast/string/strtoi.h
--- ksh93_2006_09_12/src/lib/libast/string/strtoi.h     2006-09-12 
17:21:02.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/string/strtoi.h     2006-10-13 
21:30:36.000000000 +0200
@@ -476,31 +476,31 @@
                        {
                        case 'b':
                        case 'B':
-                               v = ((S2I_utype)1) << 9;
-                               break;
-                       case 'g':
-                       case 'G':
-                               v = ((S2I_utype)1) << 30;
+                               shift = 9;
                                break;
                        case 'k':
                        case 'K':
-                               v = ((S2I_utype)1) << 10;
+                               shift = 10;
                                break;
                        case 'm':
                        case 'M':
-                               v = ((S2I_utype)1) << 20;
+                               shift = 20;
                                break;
-                       case 'p':
-                       case 'P':
-                               if (sizeof(S2I_number) <= 4)
-                                       overflow = 1;
-                               v = ((S2I_utype)1) << 50;
+                       case 'g':
+                       case 'G':
+                               shift = 30;
                                break;
                        case 't':
                        case 'T':
-                               if (sizeof(S2I_number) <= 4)
-                                       overflow = 1;
-                               v = ((S2I_utype)1) << 40;
+                               shift = 40;
+                               break;
+                       case 'p':
+                       case 'P':
+                               shift = 50;
+                               break;
+                       case 'e':
+                       case 'E':
+                               shift = 60;
                                break;
                        default:
                                if (m <= 1)
@@ -521,8 +521,33 @@
                                else
                                        v = m;
                                s--;
+                               shift = 0;
                                break;
                        }
+                       if (shift)
+                       {
+                               if (S2I_valid(s))
+                                       switch (*s)
+                                       {
+                                       case 'b':
+                                       case 'B':
+                                       case 'i':
+                                       case 'I':
+                                               s++;
+                                               break;
+                                       }
+#if S2I_unsigned
+                               if (shift >= (sizeof(S2I_type) * CHAR_BIT))
+#else
+                               if (shift >= (sizeof(S2I_type) * CHAR_BIT - 1))
+#endif
+                               {
+                                       v = 0;
+                                       overflow = 1;
+                               }
+                               else
+                                       v = ((S2I_utype)1) << shift;
+                       }
                        if (v)
                        {
                                if (MPYOVER(n, v))
@@ -543,8 +568,28 @@
 #endif
        }
 #if !S2I_unsigned
-       else if (!(qualifier & QU) && (n - negative) > S2I_max)
-               overflow = 1;
+       else if (!(qualifier & QU))
+       {
+               if (negative)
+               {
+                       if (!n)
+                       {
+                               b = k;
+                               do
+                               {
+                                       if (b >= s)
+                                       {
+                                               negative = 0;
+                                               break;
+                                       }
+                               } while (*b++ == '0');
+                       }
+                       if (negative && (n - 1) > S2I_max)
+                               overflow = 1;
+               }
+               else if (n > S2I_max)
+                       overflow = 1;
+       }
 #endif
        if (e)
                *e = (char*)s;
diff -r -N -u ksh93_2006_09_12/src/lib/libast/tm/tmxscan.c 
ksh93_2006_10_31/src/lib/libast/tm/tmxscan.c
--- ksh93_2006_09_12/src/lib/libast/tm/tmxscan.c        2005-01-05 
21:09:15.000000000 +0100
+++ ksh93_2006_10_31/src/lib/libast/tm/tmxscan.c        2006-10-04 
17:51:15.000000000 +0200
@@ -424,7 +424,6 @@
                                        goto again;
                                }
        }
- fix:
        t = gen(tm, &set);
  done:
        if (e)
diff -r -N -u ksh93_2006_09_12/src/lib/libast/uwin/crypt.c 
ksh93_2006_10_31/src/lib/libast/uwin/crypt.c
--- ksh93_2006_09_12/src/lib/libast/uwin/crypt.c        2004-12-23 
09:12:39.000000000 +0100
+++ ksh93_2006_10_31/src/lib/libast/uwin/crypt.c        2006-10-27 
21:47:19.000000000 +0200
@@ -20,6 +20,15 @@
 *                                                                      *
 ***********************************************************************/
 #pragma prototyped
+
+#include "FEATURE/uwin"
+
+#if !_UWIN || _lib_crypt
+
+void _STUB_crypt(){}
+
+#else
+
 /*
  * Copyright (c) 1989, 1993
  *     The Regents of the University of California.  All rights reserved.
@@ -56,11 +65,19 @@
 static char sccsid[] = "@(#)crypt.c    8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 
+#define crypt          ______crypt
+#define encrypt                ______encrypt
+#define setkey         ______setkey
+
 /* #include <unistd.h> */
 #include <stdio.h>
 #include <limits.h>
 #include <pwd.h>
 
+#undef crypt
+#undef encrypt
+#undef setkey
+
 #ifndef _PASSWORD_EFMT1
 #define _PASSWORD_EFMT1 '-'
 #endif
@@ -961,3 +978,5 @@
        (void)printf("\n");
 }
 #endif
+
+#endif
diff -r -N -u ksh93_2006_09_12/src/lib/libast/uwin/mathimpl.h 
ksh93_2006_10_31/src/lib/libast/uwin/mathimpl.h
--- ksh93_2006_09_12/src/lib/libast/uwin/mathimpl.h     2004-10-19 
05:11:54.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/uwin/mathimpl.h     2006-09-23 
09:25:53.000000000 +0200
@@ -99,3 +99,5 @@
 #if defined(_BLD_ast) && defined(__EXPORT__)
 #define extern __EXPORT__
 #endif
+
+extern double  copysign(double, double);
diff -r -N -u ksh93_2006_09_12/src/lib/libast/vmalloc/vmdebug.c 
ksh93_2006_10_31/src/lib/libast/vmalloc/vmdebug.c
--- ksh93_2006_09_12/src/lib/libast/vmalloc/vmdebug.c   2004-04-09 
07:38:52.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/vmalloc/vmdebug.c   2006-10-05 
09:03:22.000000000 +0200
@@ -54,6 +54,8 @@
 #define DB_WATCH       4
 #define DB_RESIZED     5
 
+#define LONGV(x)       ((Vmulong_t)(x))
+
 static int Dbinit = 0;
 #define DBINIT()       (Dbinit ? 0 : (dbinit(), Dbinit=1) )
 static void dbinit()
@@ -159,11 +161,11 @@
        }
        else if(type == DB_CHECK)
        {       bufp = (*_Vmstrcpy)(bufp, "bad byte at", '=');
-               bufp = (*_Vmstrcpy)(bufp, (*_Vmitoa)(VLONG(where),-1), ':');
+               bufp = (*_Vmstrcpy)(bufp, (*_Vmitoa)(LONGV(where),-1), ':');
                if((s = DBFILE(data)) && (bufp + strlen(s) + SLOP) < endbuf)
                {       bufp = (*_Vmstrcpy)(bufp,"allocated at", '=');
                        bufp = (*_Vmstrcpy)(bufp, s, ',');
-                       bufp = 
(*_Vmstrcpy)(bufp,(*_Vmitoa)(VLONG(DBLINE(data)),-1),':');
+                       bufp = 
(*_Vmstrcpy)(bufp,(*_Vmitoa)(LONGV(DBLINE(data)),-1),':');
                }
        }
 
@@ -171,7 +173,7 @@
        if(file && file[0] && line > 0 && (bufp + strlen(file) + SLOP) < endbuf)
        {       bufp = (*_Vmstrcpy)(bufp, "detected at", '=');
                bufp = (*_Vmstrcpy)(bufp, file, ',');
-               bufp = (*_Vmstrcpy)(bufp, (*_Vmitoa)(VLONG(line),-1), ',');
+               bufp = (*_Vmstrcpy)(bufp, (*_Vmitoa)(LONGV(line),-1), ',');
                bufp = (*_Vmstrcpy)(bufp, (*_Vmitoa)(VLONG(func),-1), ':');
        }
 
diff -r -N -u ksh93_2006_09_12/src/lib/libast/vmalloc/vmhdr.h 
ksh93_2006_10_31/src/lib/libast/vmalloc/vmhdr.h
--- ksh93_2006_09_12/src/lib/libast/vmalloc/vmhdr.h     2005-04-07 
22:06:43.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/vmalloc/vmhdr.h     2006-09-25 
19:40:16.000000000 +0200
@@ -158,6 +158,10 @@
 #endif /*DEBUG*/
 
 #define VMPAGESIZE     8192
+#if _AST_PAGESIZE > VMPAGESIZE
+#undef VMPAGESIZE
+#define VMPAGESIZE     _AST_PAGESIZE
+#endif
 #if _lib_getpagesize
 #define GETPAGESIZE(x) ((x) ? (x) : \
                         (((x)=getpagesize()) < VMPAGESIZE ? ((x)=VMPAGESIZE) : 
(x)) )
diff -r -N -u ksh93_2006_09_12/src/lib/libast/vmalloc/vmstrdup.c 
ksh93_2006_10_31/src/lib/libast/vmalloc/vmstrdup.c
--- ksh93_2006_09_12/src/lib/libast/vmalloc/vmstrdup.c  2004-08-18 
05:45:12.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libast/vmalloc/vmstrdup.c  2006-10-13 
03:15:10.000000000 +0200
@@ -42,7 +42,7 @@
        register char*  t;
        register int    n;
 
-       return((t = vmalloc(v, n = strlen(s) + 1)) ? (char*)memcpy(t, s, n) : 
(char*)0);
+       return (s && (t = vmalloc(v, n = strlen(s) + 1))) ? (char*)memcpy(t, s, 
n) : (char*)0;
 }
 
 #endif
diff -r -N -u ksh93_2006_09_12/src/lib/libcmd/basename.c 
ksh93_2006_10_31/src/lib/libcmd/basename.c
--- ksh93_2006_09_12/src/lib/libcmd/basename.c  2002-11-14 22:30:21.000000000 
+0100
+++ ksh93_2006_10_31/src/lib/libcmd/basename.c  2006-11-01 21:15:51.000000000 
+0100
@@ -29,7 +29,7 @@
  */
 
 static const char usage[] =
-"[-?\n@(#)$Id: basename (AT&T Labs Research) 1999-04-10 $\n]"
+"[-?\n@(#)$Id: basename (AT&T Research) 1999-04-10 $\n]"
 USAGE_LICENSE
 "[+NAME?basename - strip directory and suffix from filenames]"
 "[+DESCRIPTION?\bbasename\b removes all leading directory components "
@@ -57,7 +57,7 @@
 ;
 
 
-#include <cmdlib.h>
+#include <cmd.h>
 
 static void namebase(Sfio_t *outfile, register char *pathname, char *suffix)
 {
@@ -96,7 +96,7 @@
 {
        register int  n;
 
-       cmdinit(argv, context, ERROR_CATALOG, 0);
+       cmdinit(argc, argv, context, ERROR_CATALOG, 0);
        while (n = optget(argv, usage)) switch (n)
        {
        case ':':
diff -r -N -u ksh93_2006_09_12/src/lib/libcmd/cat.c 
ksh93_2006_10_31/src/lib/libcmd/cat.c
--- ksh93_2006_09_12/src/lib/libcmd/cat.c       2006-05-17 18:45:45.000000000 
+0200
+++ ksh93_2006_10_31/src/lib/libcmd/cat.c       2006-11-01 21:15:54.000000000 
+0100
@@ -27,11 +27,11 @@
  * cat
  */
 
-#include <cmdlib.h>
+#include <cmd.h>
 #include <fcntl.h>
 
 static const char usage[] =
-"[-?\n@(#)$Id: cat (AT&T Labs Research) 2006-05-17 $\n]"
+"[-?\n@(#)$Id: cat (AT&T Research) 2006-05-17 $\n]"
 USAGE_LICENSE
 "[+NAME?cat - concatenate files]"
 "[+DESCRIPTION?\bcat\b copies each \afile\a in sequence to the standard"
@@ -95,14 +95,12 @@
 
 #define printof(c)     ((c)^0100)
 
-static char            states[UCHAR_MAX+1];
-
 /*
  * called for any special output processing
  */
 
 static int
-vcat(Sfio_t *fdin, Sfio_t *fdout, int flags)
+vcat(register char* states, Sfio_t *fdin, Sfio_t *fdout, int flags)
 {
        register unsigned char* cp;
        register unsigned char* cpold;
@@ -114,8 +112,10 @@
        int                     printdefer = (flags&(B_FLAG|N_FLAG));
        int                     lastchar;
 
-       static unsigned char    meta[4] = "M-";
+       unsigned char           meta[4];
 
+       meta[0] = 'M';
+       meta[1] = '-';
        for (;;)
        {
                /* read in a buffer full */
@@ -233,9 +233,10 @@
        char*                   mode;
        int                     att;
        int                     dovcat=0;
+       char                    states[UCHAR_MAX+1];
 
        NoP(argc);
-       cmdinit(argv, context, ERROR_CATALOG, 0);
+       cmdinit(argc, argv, context, ERROR_CATALOG, 0);
        att = !strcmp(astconf("UNIVERSE", NiL, NiL), "att");
        mode = "r";
        for (;;)
@@ -296,6 +297,7 @@
        argv += opt_info.index;
        if (error_info.errors)
                error(ERROR_usage(2), "%s", optusage(NiL));
+       memset(states, 0, sizeof(states));
        if (flags&V_FLAG)
        {
                memset(states, T_CONTROL, ' ');
@@ -354,7 +356,7 @@
                if (flags&U_FLAG)
                        sfsetbuf(fp, (void*)fp, -1);
                if (dovcat)
-                       n = vcat(fp, sfstdout, flags);
+                       n = vcat(states, fp, sfstdout, flags);
                else if (sfmove(fp, sfstdout, SF_UNBOUND, -1) >= 0 && sfeof(fp))
                        n = 0;
                else
diff -r -N -u ksh93_2006_09_12/src/lib/libcmd/chgrp.c 
ksh93_2006_10_31/src/lib/libcmd/chgrp.c
--- ksh93_2006_09_12/src/lib/libcmd/chgrp.c     2005-04-14 15:36:24.000000000 
+0200
+++ ksh93_2006_10_31/src/lib/libcmd/chgrp.c     2006-11-01 21:15:56.000000000 
+0100
@@ -28,7 +28,7 @@
  */
 
 static const char usage_1[] =
-"[-?@(#)$Id: chgrp (AT&T Labs Research) 2005-04-14 $\n]"
+"[-?@(#)$Id: chgrp (AT&T Research) 2006-10-11 $\n]"
 USAGE_LICENSE
 ;
 
@@ -89,7 +89,7 @@
 #define lchown         ______lchown
 #endif
 
-#include <cmdlib.h>
+#include <cmd.h>
 #include <cdt.h>
 #include <ls.h>
 #include <ctype.h>
@@ -124,11 +124,6 @@
 
 extern int     lchown(const char*, uid_t, gid_t);
 
-static struct State_s
-{
-       int             interrupt;
-} state;
-
 #if !_lib_lchown
 
 #ifndef ENOSYS
@@ -221,13 +216,7 @@
        struct stat     st;
        int             (*chownf)(const char*, uid_t, gid_t);
 
-       if (argc < 0)
-       {
-               state.interrupt = 1;
-               return -1;
-       }
-       state.interrupt = 0;
-       cmdinit(argv, context, ERROR_CATALOG, ERROR_NOTIFY);
+       cmdinit(argc, argv, context, ERROR_CATALOG, ERROR_NOTIFY);
        flags = fts_flags() | FTS_TOP | FTS_NOPOSTORDER | FTS_NOSEEDOTDIR;
        if (!(sp = sfstropen()))
                error(ERROR_SYSTEM|3, "out of space");
@@ -245,7 +234,8 @@
        else
                sfputr(sp, ERROR_translate(0, 0, 0, "[[owner:]group]"), -1);
        sfputr(sp, usage_3, -1);
-       usage = sfstruse(sp);
+       if (!(usage = sfstruse(sp)))
+               error(ERROR_SYSTEM|3, "out of space");
        for (;;)
        {
                switch (optget(argv, usage))
@@ -382,7 +372,7 @@
        }
        if (!(fts = fts_open(argv + 1, flags, NiL)))
                error(ERROR_system(1), "%s: not found", argv[1]);
-       while (!state.interrupt && (ent = fts_read(fts)))
+       while (!cmdquit() && (ent = fts_read(fts)))
                switch (ent->fts_info)
                {
                case FTS_F:
diff -r -N -u ksh93_2006_09_12/src/lib/libcmd/chmod.c 
ksh93_2006_10_31/src/lib/libcmd/chmod.c
--- ksh93_2006_09_12/src/lib/libcmd/chmod.c     2006-06-25 19:17:59.000000000 
+0200
+++ ksh93_2006_10_31/src/lib/libcmd/chmod.c     2006-11-01 21:15:59.000000000 
+0100
@@ -28,7 +28,7 @@
  */
 
 static const char usage[] =
-"[-?\n@(#)$Id: chmod (AT&T Labs Research) 2006-06-25 $\n]"
+"[-?\n@(#)$Id: chmod (AT&T Research) 2006-06-25 $\n]"
 USAGE_LICENSE
 "[+NAME?chmod - change the access permissions of files]"
 "[+DESCRIPTION?\bchmod\b changes the permission of each file "
@@ -132,7 +132,7 @@
 #define lchmod         ______lchmod
 #endif
 
-#include <cmdlib.h>
+#include <cmd.h>
 #include <ls.h>
 #include <fts.h>
 
@@ -146,11 +146,6 @@
 
 extern int     lchmod(const char*, mode_t);
 
-static struct State_s
-{
-       int             interrupt;
-} state;
-
 int
 b_chmod(int argc, char** argv, void* context)
 {
@@ -169,13 +164,7 @@
 #endif
        struct stat     st;
 
-       if (argc < 0)
-       {
-               state.interrupt = 1;
-               return -1;
-       }
-       state.interrupt = 0;
-       cmdinit(argv, context, ERROR_CATALOG, ERROR_NOTIFY);
+       cmdinit(argc, argv, context, ERROR_CATALOG, ERROR_NOTIFY);
        flags = fts_flags() | FTS_TOP | FTS_NOPOSTORDER | FTS_NOSEEDOTDIR;
 
        /*
@@ -258,7 +247,7 @@
                        umask(ignore);
                error(ERROR_system(1), "%s: not found", *argv);
        }
-       while (!state.interrupt && (ent = fts_read(fts)))
+       while (!cmdquit() && (ent = fts_read(fts)))
                switch (ent->fts_info)
                {
                case FTS_SL:
diff -r -N -u ksh93_2006_09_12/src/lib/libcmd/chown.c 
ksh93_2006_10_31/src/lib/libcmd/chown.c
--- ksh93_2006_09_12/src/lib/libcmd/chown.c     2000-12-14 17:22:45.000000000 
+0100
+++ ksh93_2006_10_31/src/lib/libcmd/chown.c     2006-11-01 21:16:02.000000000 
+0100
@@ -29,7 +29,7 @@
 
 static const char id[] = "\n@(#)$Id: chown (AT&T Research) 1997-11-11 $\0\n";
 
-#include <cmdlib.h>
+#include <cmd.h>
 
 int
 b_chown(int argc, char** argv, void* context)
diff -r -N -u ksh93_2006_09_12/src/lib/libcmd/cmd.h 
ksh93_2006_10_31/src/lib/libcmd/cmd.h
--- ksh93_2006_09_12/src/lib/libcmd/cmd.h       2005-04-09 18:53:55.000000000 
+0200
+++ ksh93_2006_10_31/src/lib/libcmd/cmd.h       2006-11-01 21:36:25.000000000 
+0100
@@ -32,6 +32,9 @@
 #include <error.h>
 #include <stak.h>
 
+#define cmdinit(a,b,c,d,e)     _cmd_init(a,b,c,d,e)
+#define cmdquit()              0
+
 #if _BLD_cmd && defined(__EXPORT__)
 #define extern         __EXPORT__
 #endif
@@ -40,13 +43,13 @@
 
 #undef extern
 
-#if defined(BUILTIN) && !defined(STANDALONE)
-#define STANDALONE     BUILTIN
+#if defined(CMD_BUILTIN) && !defined(CMD_STANDALONE)
+#define CMD_STANDALONE CMD_BUILTIN
 #endif
 
-#ifdef STANDALONE
+#ifdef CMD_STANDALONE
 
-#if DYNAMIC
+#if CMD_DYNAMIC
 
 #include <dlldefs.h>
 
@@ -54,18 +57,18 @@
 
 #else
 
-extern int STANDALONE(int, char**, void*);
+extern int CMD_STANDALONE(int, char**, void*);
 
 #endif
 
-#ifndef BUILTIN
+#ifndef CMD_BUILTIN
 
 /*
  * command initialization
  */
 
-static void
-cmdinit(register char** argv, void* context, const char* catalog, int flags)
+static int
+cmdinit(int argc, register char** argv, void* context, const char* catalog, 
int flags)
 {
        register char*  cp;
        register char*  pp;
@@ -82,6 +85,7 @@
        opt_info.index = 0;
        if (context)
                error_info.flags |= flags;
+       return 0;
 }
 
 #endif
@@ -89,7 +93,7 @@
 int
 main(int argc, char** argv)
 {
-#if DYNAMIC
+#if CMD_DYNAMIC
        register char*  s;
        register char*  t;
        void*           dll;
@@ -129,18 +133,38 @@
        }
        return (*fun)(argc, argv, NiL);
 #else
-       return STANDALONE(argc, argv, NiL);
+       return CMD_STANDALONE(argc, argv, NiL);
 #endif
 }
 
 #else
 
+#undef cmdinit
+#define cmdinit(a,b,c,d,e)     do{if(_cmd_init(a,b,c,d,e))return -1;}while(0)
+
+#ifndef CMD_BUILTIN
+
+#undef cmdquit
+#define cmdquit()              (_cmd_quit)
+
 #if _BLD_cmd && defined(__EXPORT__)
-#define extern         __EXPORT__
+#define extern                 extern __EXPORT__
+#endif
+#if !_BLD_cmd && defined(__IMPORT__)
+#define extern                 extern __IMPORT__
+#endif
+
+extern int     _cmd_quit;
+
+#undef extern
+
+#endif
+
+#if _BLD_cmd && defined(__EXPORT__)
+#define extern                 extern __EXPORT__
 #endif
 
-extern int     cmdrecurse(int, char**, int, char**);
-extern void    cmdinit(char**, void*, const char*, int);
+extern int     _cmd_init(int, char**, void*, const char*, int);
 
 #undef extern
 
diff -r -N -u ksh93_2006_09_12/src/lib/libcmd/cmdinit.c 
ksh93_2006_10_31/src/lib/libcmd/cmdinit.c
--- ksh93_2006_09_12/src/lib/libcmd/cmdinit.c   2002-11-14 22:29:53.000000000 
+0100
+++ ksh93_2006_10_31/src/lib/libcmd/cmdinit.c   2006-11-01 22:54:52.000000000 
+0100
@@ -23,13 +23,21 @@
  * command initialization
  */
 
-#include <cmdlib.h>
+#include <cmd.h>
 
-void
-cmdinit(char** argv, void* context, const char* catalog, int flags)
+int    _cmd_quit = 0;
+
+int
+_cmd_init(int argc, char** argv, void* context, const char* catalog, int flags)
 {
        register char*  cp;
 
+       if (argc < 0)
+       {
+               _cmd_quit = 1;
+               return -1;
+       }
+       _cmd_quit = 0;
        if (cp = strrchr(argv[0], '/'))
                cp++;
        else
@@ -40,4 +48,17 @@
        opt_info.index = 0;
        if (context)
                error_info.flags |= flags;
+       return 0;
 }
+
+#if __OBSOLETE__ < 20080101
+
+#undef cmdinit
+
+void
+cmdinit(char** argv, void* context, const char* catalog, int flags)
+{
+       _cmd_init(0, argv, context, catalog, flags);
+}
+
+#endif
diff -r -N -u ksh93_2006_09_12/src/lib/libcmd/cmdlib.h 
ksh93_2006_10_31/src/lib/libcmd/cmdlib.h
--- ksh93_2006_09_12/src/lib/libcmd/cmdlib.h    2000-04-13 17:22:44.000000000 
+0200
+++ ksh93_2006_10_31/src/lib/libcmd/cmdlib.h    1970-01-01 01:00:00.000000000 
+0100
@@ -1,39 +0,0 @@
-/***********************************************************************
-*                                                                      *
-*               This software is part of the ast package               *
-*           Copyright (c) 1992-2006 AT&T Knowledge Ventures            *
-*                      and is licensed under the                       *
-*                  Common Public License, Version 1.0                  *
-*                      by AT&T Knowledge Ventures                      *
-*                                                                      *
-*                A copy of the License is available at                 *
-*            http://www.opensource.org/licenses/cpl1.0.txt             *
-*         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
-*                                                                      *
-*              Information and Software Systems Research               *
-*                            AT&T Research                             *
-*                           Florham Park NJ                            *
-*                                                                      *
-*                 Glenn Fowler <gsf at research.att.com>                  *
-*                  David Korn <dgk at research.att.com>                   *
-*                                                                      *
-***********************************************************************/
-#pragma prototyped
-
-/*
- * common ast cmd library definitions
- */
-
-#ifndef _CMDLIB_H
-#define _CMDLIB_H
-
-#include <ast.h>
-#include <cmd.h>
-#include <error.h>
-#include <stak.h>
-
-#define rev_line       _cmd_revline
-
-extern int             rev_line(Sfio_t*, Sfio_t*, off_t);
-
-#endif
diff -r -N -u ksh93_2006_09_12/src/lib/libcmd/cmdrecurse.c 
ksh93_2006_10_31/src/lib/libcmd/cmdrecurse.c
--- ksh93_2006_09_12/src/lib/libcmd/cmdrecurse.c        1995-06-14 
20:05:37.000000000 +0200
+++ ksh93_2006_10_31/src/lib/libcmd/cmdrecurse.c        2006-11-01 
21:16:09.000000000 +0100
@@ -23,7 +23,7 @@
  * use tw to recurse on argc,argv with pfxc,pfxv prefix args
  */
 
-#include <cmdlib.h>
+#include <cmd.h>
 #include <proc.h>
 #include <ftwalk.h>
 
diff -r -N -u ksh93_2006_09_12/src/lib/libcmd/cmp.c 
ksh93_2006_10_31/src/lib/libcmd/cmp.c
--- ksh93_2006_09_12/src/lib/libcmd/cmp.c       2004-12-01 19:58:37.000000000 
+0100
+++ ksh93_2006_10_31/src/lib/libcmd/cmp.c       2006-11-01 22:23:08.000000000 
+0100
@@ -28,7 +28,7 @@
  */
 
 static const char usage[] =
-"[-?\n@(#)$Id: cmp (AT&T Labs Research) 2004-12-01 $\n]"
+"[-?\n@(#)$Id: cmp (AT&T Research) 2004-12-01 $\n]"
 USAGE_LICENSE
 "[+NAME?cmp - compare two files]"
 "[+DESCRIPTION?\bcmp\b compares two files \afile1\a and \afile2\a.  "
@@ -63,7 +63,7 @@
 ;
 
 
-#include <cmdlib.h>
+#include <cmd.h>
 #include <ls.h>
 #include <ctype.h>
 
@@ -195,7 +195,7 @@
        int             flags = 0;
 
        NoP(argc);
-       cmdinit(argv, context, ERROR_CATALOG, 0);
+       cmdinit(argc, argv, context, ERROR_CATALOG, 0);
        while (n = optget(argv, usage)) switch (n)
        {
        case 'l':
@@ -260,14 +260,14 @@
                        goto done;
                }
        }
-       if (o1 && sfseek(f1, o1, 0) != o1)
+       if (o1 && sfseek(f1, o1, SEEK_SET) != o1)
        {
                if (!(flags & CMP_SILENT))
                        error(ERROR_exit(0), "%s: EOF", file1);
                n = 1;
                goto done;
        }
-       if (o2 && sfseek(f2, o2, 0) != o2)
+       if (o2 && sfseek(f2, o2, SEEK_SET) != o2)
        {
                if (!(flags & CMP_SILENT))
                        error(ERROR_exit(0), "%s: EOF", file2);
diff -r -N -u ksh93_2006_09_12/src/lib/libcmd/comm.c 
ksh93_2006_10_31/src/lib/libcmd/comm.c
--- ksh93_2006_09_12/src/lib/libcmd/comm.c      2004-03-08 00:29:48.000000000 
+0100
+++ ksh93_2006_10_31/src/lib/libcmd/comm.c      2006-11-01 22:21:34.000000000 
+0100
@@ -27,7 +27,7 @@
  */
 
 static const char usage[] =
-"[-?\n@(#)$Id: comm (AT&T Labs Research) 1999-04-28 $\n]"
+"[-?\n@(#)$Id: comm (AT&T Research) 1999-04-28 $\n]"
 USAGE_LICENSE
 "[+NAME?comm - select or reject lines common to two files]"
 "[+DESCRIPTION?\bcomm\b reads two files \afile1\a and \afile2\a "
@@ -56,7 +56,7 @@
 ;
 
 
-#include <cmdlib.h>
+#include <cmd.h>
 
 #define C_FILE1                1
 #define C_FILE2                2
@@ -127,7 +127,7 @@
        if(!mode || !cp1)
        {
                if(cp1 && in1==sfstdin)
-                       sfseek(in1,0L,SEEK_END);
+                       sfseek(in1,(Sfoff_t)0,SEEK_END);
                return(0);
        }
        /* process the remaining stream */
@@ -152,7 +152,7 @@
        register char *cp;
        Sfio_t *f1, *f2;
 
-       cmdinit(argv, context, ERROR_CATALOG, 0);
+       cmdinit(argc, argv, context, ERROR_CATALOG, 0);
        while (n = optget(argv, usage)) switch (n)
        {
            case '1':
@@ -191,7 +191,7 @@
                        error(ERROR_system(1)," write error");
        }
        else if(f1==sfstdin || f2==sfstdin)
-               sfseek(sfstdin,0L,SEEK_END);
+               sfseek(sfstdin,(Sfoff_t)0,SEEK_END);
        if(f1!=sfstdin)
                sfclose(f1);
        if(f2!=sfstdin)
diff -r -N -u ksh93_2006_09_12/src/lib/libcmd/cp.c 
ksh93_2006_10_31/src/lib/libcmd/cp.c
--- ksh93_2006_09_12/src/lib/libcmd/cp.c        2006-01-29 07:17:47.000000000 
+0100
+++ ksh93_2006_10_31/src/lib/libcmd/cp.c        2006-11-01 21:16:16.000000000 
+0100
@@ -27,7 +27,7 @@
  */
 
 static const char usage_head[] =
-"[-?@(#)$Id: cp (AT&T Labs Research) 2006-01-28 $\n]"
+"[-?@(#)$Id: cp (AT&T Research) 2006-10-31 $\n]"
 USAGE_LICENSE
 ;
 
@@ -123,7 +123,7 @@
 #include <cmd.h>
 #include <ls.h>
 #include <times.h>
-#include <ftwalk.h>
+#include <fts.h>
 #include <fs3d.h>
 #include <hashkey.h>
 #include <stk.h>
@@ -140,22 +140,22 @@
 #define BAK_number     2               /* append .suffix number suffix */
 #define BAK_simple     3               /* append suffix                */
 
-static struct                          /* program state                */
+typedef struct State_s                 /* program state                */
 {
        int             backup;         /* BAK_* type                   */
        int             directory;      /* destination is directory     */
-       int             flags;          /* FTW_* flags                  */
+       int             flags;          /* FTS_* flags                  */
        int             force;          /* force approval               */
        int             fs3d;           /* 3d fs enabled                */
        int             hierarchy;      /* preserve hierarchy           */
        int             interactive;    /* prompt for approval          */
-       int             interrupt;      /* interrupt -- punt            */
        int             missmode;       /* default missing dir mode     */
        int             official;       /* move to next view            */
        int             op;             /* {CP,LN,MV}                   */
        int             pathsiz;        /* state.path buffer size       */
        int             perm;           /* permissions to preserve      */
        int             postsiz;        /* state.path post index        */
+       int             presiz;         /* state.path pre index         */
        int             preserve;       /* preserve { id mode time }    */
        int             recursive;      /* subtrees too                 */
        int             suflen;         /* strlen(state.suffix)         */
@@ -174,23 +174,23 @@
        Sfio_t*         tmp;            /* tmp string stream            */
 
        char            text[PATH_MAX]; /* link text buffer             */
-} state;
+} State_t;
 
-static char    dot[2] = { '.' };
+static const char      dot[2] = { '.' };
 
 /*
  * preserve support
  */
 
 static void
-preserve(const char* path, struct stat* ns, struct stat* os)
+preserve(State_t* state, const char* path, struct stat* ns, struct stat* os)
 {
        int     n;
 
        if (tmxtouch(path, tmxgetatime(os), tmxgetmtime(os), TMX_NOTIME, 0))
                error(ERROR_SYSTEM|2, "%s: cannot reset access and modify 
times", path);
        n = ((ns->st_uid != os->st_uid) << 1) | (ns->st_gid != os->st_gid);
-       if (n && chown(state.path, os->st_uid, os->st_gid))
+       if (n && chown(state->path, os->st_uid, os->st_gid))
                switch (n)
                {
                case 01:
@@ -210,7 +210,7 @@
  */
 
 static int
-visit(register Ftw_t* ftw)
+visit(State_t* state, register FTSENT* ent)
 {
        register char*  base;
        register int    n;
@@ -226,74 +226,72 @@
        Sfio_t*         ip;
        Sfio_t*         op;
        FTS*            fts;
-       FTSENT*         ent;
+       FTSENT*         sub;
        struct stat     st;
 
-       static int      presiz;
-
-       if (state.interrupt)
+       if (cmdquit())
                return -1;
-       if (ftw->info == FTW_DC)
+       if (ent->fts_info == FTS_DC)
        {
-               error(2, "%s: directory causes cycle", ftw->path);
-               ftw->status = FTW_SKIP;
+               error(2, "%s: directory causes cycle", ent->fts_path);
+               fts_set(NiL, ent, FTS_SKIP);
                return 0;
        }
-       if (ftw->level == 0)
+       if (ent->fts_level == 0)
        {
-               base = ftw->name;
-               len = ftw->namelen;
-               if (state.hierarchy)
-                       presiz = -1;
+               base = ent->fts_name;
+               len = ent->fts_namelen;
+               if (state->hierarchy)
+                       state->presiz = -1;
                else
                {
-                       presiz = ftw->pathlen;
+                       state->presiz = ent->fts_pathlen;
                        while (*base == '.' && *(base + 1) == '/')
                                for (base += 2; *base == '/'; base++);
                        if (*base == '.' && !*(base + 1))
-                               presiz--;
+                               state->presiz--;
                        else if (*base)
-                               presiz -= base - ftw->name;
-                       base = ftw->name + len;
-                       while (base > ftw->name && *(base - 1) == '/')
+                               state->presiz -= base - ent->fts_name;
+                       base = ent->fts_name + len;
+                       while (base > ent->fts_name && *(base - 1) == '/')
                                base--;
-                       while (base > ftw->name && *(base - 1) != '/')
+                       while (base > ent->fts_name && *(base - 1) != '/')
                                base--;
-                       len -= base - ftw->name;
-                       if (state.directory)
-                               presiz -= len + 1;
+                       len -= base - ent->fts_name;
+                       if (state->directory)
+                               state->presiz -= len + 1;
                }
        }
        else
        {
-               base = ftw->path + presiz + 1;
-               len = ftw->pathlen - presiz - 1;
+               base = ent->fts_path + state->presiz + 1;
+               len = ent->fts_pathlen - state->presiz - 1;
        }
        len++;
-       if (state.directory)
+       if (state->directory)
        {
-               if ((state.postsiz + len) > state.pathsiz && !(state.path = 
newof(state.path, char, state.pathsiz = roundof(state.postsiz + len, 
PATH_CHUNK), 0)))
+               if ((state->postsiz + len) > state->pathsiz && !(state->path = 
newof(state->path, char, state->pathsiz = roundof(state->postsiz + len, 
PATH_CHUNK), 0)))
                        error(3, "out of space");
-               if (state.hierarchy && ftw->level == 0 && strchr(base, '/'))
+               if (state->hierarchy && ent->fts_level == 0 && strchr(base, 
'/'))
                {
-                       s = state.path + state.postsiz;
+                       s = state->path + state->postsiz;
                        memcpy(s, base, len);
                        while (e = strchr(s, '/'))
                        {
                                *e = 0;
-                               if (access(state.path, F_OK))
+                               if (access(state->path, F_OK))
                                {
-                                       st.st_mode = state.missmode;
+                                       st.st_mode = state->missmode;
                                        if (s = strrchr(s, '/'))
                                        {
                                                *s = 0;
-                                               stat(state.path, &st);
+                                               stat(state->path, &st);
                                                *s = '/';
                                        }
-                                       if (mkdir(state.path, st.st_mode & 
S_IPERM))
+                                       if (mkdir(state->path, st.st_mode & 
S_IPERM))
                                        {
-                                               error(ERROR_SYSTEM|2, "%s: 
cannot create directory -- %s ignored", state.path, ftw->path);
-                                               ftw->status = FTW_SKIP;
+                                               error(ERROR_SYSTEM|2, "%s: 
cannot create directory -- %s ignored", state->path, ent->fts_path);
+                                               fts_set(NiL, ent, FTS_SKIP);
                                                return 0;
                                        }
                                }
@@ -302,149 +300,152 @@
                        }
                }
        }
-       switch (ftw->info)
+       switch (ent->fts_info)
        {
-       case FTW_DP:
-               if (state.preserve && state.op != LN || ftw->level > 0 && 
(ftw->statb.st_mode & S_IRWXU) != S_IRWXU)
+       case FTS_DP:
+               if (state->preserve && state->op != LN || ent->fts_level > 0 && 
(ent->fts_statp->st_mode & S_IRWXU) != S_IRWXU)
                {
-                       if (len && ftw->level > 0)
-                               memcpy(state.path + state.postsiz, base, len);
+                       if (len && ent->fts_level > 0)
+                               memcpy(state->path + state->postsiz, base, len);
                        else
-                               state.path[state.postsiz] = 0;
-                       if (stat(state.path, &st))
-                               error(ERROR_SYSTEM|2, "%s: cannot stat", 
state.path);
+                               state->path[state->postsiz] = 0;
+                       if (stat(state->path, &st))
+                               error(ERROR_SYSTEM|2, "%s: cannot stat", 
state->path);
                        else
                        {
-                               if ((ftw->statb.st_mode & S_IPERM) != 
(st.st_mode & S_IPERM) && chmod(state.path, ftw->statb.st_mode & S_IPERM))
-                                       error(ERROR_SYSTEM|2, "%s: cannot reset 
directory mode to %s", state.path, fmtmode(st.st_mode & S_IPERM, 0) + 1);
-                               if (state.preserve)
-                                       preserve(state.path, &st, &ftw->statb);
+                               if ((ent->fts_statp->st_mode & S_IPERM) != 
(st.st_mode & S_IPERM) && chmod(state->path, ent->fts_statp->st_mode & S_IPERM))
+                                       error(ERROR_SYSTEM|2, "%s: cannot reset 
directory mode to %s", state->path, fmtmode(st.st_mode & S_IPERM, 0) + 1);
+                               if (state->preserve)
+                                       preserve(state, state->path, &st, 
ent->fts_statp);
                        }
                }
                return 0;
-       case FTW_DNR:
-       case FTW_DNX:
-       case FTW_D:
-               if (!state.recursive)
-               {
-                       ftw->status = FTW_SKIP;
-                       if (state.op == CP)
-                               error(1, "%s: directory -- copying as plain 
file", ftw->path);
-                       else if (state.link == link && !state.force)
+       case FTS_DNR:
+       case FTS_DNX:
+       case FTS_D:
+               if (!state->recursive)
+               {
+                       fts_set(NiL, ent, FTS_SKIP);
+                       if (state->op == CP)
+                               error(1, "%s: directory -- copying as plain 
file", ent->fts_path);
+                       else if (state->link == link && !state->force)
                        {
-                               error(2, "%s: cannot link directory", 
ftw->path);
+                               error(2, "%s: cannot link directory", 
ent->fts_path);
                                return 0;
                        }
                }
-               else switch (ftw->info)
+               else switch (ent->fts_info)
                {
-               case FTW_DNR:
-                       error(2, "%s: cannot read directory", ftw->path);
+               case FTS_DNR:
+                       error(2, "%s: cannot read directory", ent->fts_path);
                        return 0;
-               case FTW_DNX:
-                       error(2, "%s: cannot search directory", ftw->path);
-                       ftw->status = FTW_SKIP;
+               case FTS_DNX:
+                       error(2, "%s: cannot search directory", ent->fts_path);
+                       fts_set(NiL, ent, FTS_SKIP);
+
                        /*FALLTHROUGH*/
-               case FTW_D:
-                       if (state.directory)
-                               memcpy(state.path + state.postsiz, base, len);
-                       if (!(*state.stat)(state.path, &st))
+               case FTS_D:
+                       if (state->directory)
+                               memcpy(state->path + state->postsiz, base, len);
+                       if (!(*state->stat)(state->path, &st))
                        {
                                if (!S_ISDIR(st.st_mode))
                                {
-                                       error(2, "%s: not a directory -- %s 
ignored", state.path, ftw->path);
+                                       error(2, "%s: not a directory -- %s 
ignored", state->path, ent->fts_path);
                                        return 0;
                                }
                        }
-                       else if (mkdir(state.path, (ftw->statb.st_mode & 
S_IPERM)|(ftw->info == FTW_D ? S_IRWXU : 0)))
+                       else if (mkdir(state->path, (ent->fts_statp->st_mode & 
S_IPERM)|(ent->fts_info == FTS_D ? S_IRWXU : 0)))
                        {
-                               error(ERROR_SYSTEM|2, "%s: cannot create 
directory -- %s ignored", state.path, ftw->path);
-                               ftw->status = FTW_SKIP;
+                               error(ERROR_SYSTEM|2, "%s: cannot create 
directory -- %s ignored", state->path, ent->fts_path);
+                               fts_set(NiL, ent, FTS_SKIP);
                        }
-                       if (!state.directory)
+                       if (!state->directory)
                        {
-                               state.directory = 1;
-                               state.path[state.postsiz++] = '/';
-                               presiz--;
+                               state->directory = 1;
+                               state->path[state->postsiz++] = '/';
+                               state->presiz--;
                        }
                        return 0;
                }
                break;
-       case FTW_NS:
-               if (state.link != pathsetlink)
+       case FTS_ERR:
+       case FTS_NS:
+       case FTS_SLNONE:
+               if (state->link != pathsetlink)
                {
-                       error(2, "%s: not found", ftw->path);
+                       error(2, "%s: not found", ent->fts_path);
                        return 0;
                }
                break;
 #if 0
-       case FTW_SL:
-               if (state.op == CP)
+       case FTS_SL:
+               if (state->op == CP)
                {
-                       error(2, "%s: cannot copy non-terminal symbolic link", 
ftw->path);
+                       error(2, "%s: cannot copy non-terminal symbolic link", 
ent->fts_path);
                        return 0;
                }
                break;
 #endif
        }
-       if (state.directory)
-               memcpy(state.path + state.postsiz, base, len);
-       if ((*state.stat)(state.path, &st))
+       if (state->directory)
+               memcpy(state->path + state->postsiz, base, len);
+       if ((*state->stat)(state->path, &st))
                st.st_mode = 0;
-       else if (state.update && !S_ISDIR(st.st_mode) && (unsigned 
long)ftw->statb.st_mtime < (unsigned long)st.st_mtime)
+       else if (state->update && !S_ISDIR(st.st_mode) && (unsigned 
long)ent->fts_statp->st_mtime < (unsigned long)st.st_mtime)
        {
-               ftw->status = FTW_SKIP;
+               fts_set(NiL, ent, FTS_SKIP);
                return 0;
        }
-       else if (!state.fs3d || !iview(&st))
+       else if (!state->fs3d || !iview(&st))
        {
                /*
                 * target is in top 3d view
                 */
 
-               if (st.st_dev == ftw->statb.st_dev && st.st_ino == 
ftw->statb.st_ino)
+               if (st.st_dev == ent->fts_statp->st_dev && st.st_ino == 
ent->fts_statp->st_ino)
                {
-                       if (state.op == MV)
+                       if (state->op == MV)
                        {
                                /*
                                 * let rename() handle it
                                 */
 
-                               if (state.verbose)
-                                       sfputr(sfstdout, state.path, '\n');
+                               if (state->verbose)
+                                       sfputr(sfstdout, state->path, '\n');
                                goto operate;
                        }
-                       if (!state.official)
-                               error(2, "%s: identical to %s", state.path, 
ftw->path);
+                       if (!state->official)
+                               error(2, "%s: identical to %s", state->path, 
ent->fts_path);
                        return 0;
                }
                if (S_ISDIR(st.st_mode))
                {
-                       error(2, "%s: cannot %s existing directory", 
state.path, state.opname);
+                       error(2, "%s: cannot %s existing directory", 
state->path, state->opname);
                        return 0;
                }
-               if (state.verbose)
-                       sfputr(sfstdout, state.path, '\n');
-               rm = state.op == LN || ftw->info == FTW_SL;
-               if (!rm || !state.force)
+               if (state->verbose)
+                       sfputr(sfstdout, state->path, '\n');
+               rm = state->op == LN || ent->fts_info == FTS_SL;
+               if (!rm || !state->force)
                {
-                       if ((n = open(state.path, O_RDWR|O_BINARY)) >= 0)
+                       if ((n = open(state->path, O_RDWR|O_BINARY)) >= 0)
                        {
                                close(n);
-                               if (state.force)
+                               if (state->force)
                                        /* ok */;
-                               else if (state.interactive)
+                               else if (state->interactive)
                                {
-                                       if (astquery(-1, "%s %s? ", 
state.opname, state.path))
+                                       if (astquery(-1, "%s %s? ", 
state->opname, state->path))
                                                return 0;
                                }
-                               else if (state.op == LN)
+                               else if (state->op == LN)
                                {
-                                       error(2, "%s: cannot %s existing file", 
state.path, state.opname);
+                                       error(2, "%s: cannot %s existing file", 
state->path, state->opname);
                                        return 0;
                                }
                        }
-                       else if (state.force)
+                       else if (state->force)
                                rm = 1;
                        else
                        {
@@ -452,93 +453,94 @@
 #ifdef ETXTBSY
                                    errno == ETXTBSY ? "``running program''" : 
 #endif
-                                   st.st_uid != state.uid ? "``not owner''" :
+                                   st.st_uid != state->uid ? "``not owner''" :
                                    fmtmode(st.st_mode & 
(S_IRWXU|S_IRWXG|S_IRWXO), 0) + 1;
-                               if (state.interactive)
+                               if (state->interactive)
                                {
-                                       if (astquery(-1, "override protection 
%s for %s? ", protection, state.path))
+                                       if (astquery(-1, "override protection 
%s for %s? ", protection, state->path))
                                                return 0;
                                        rm = 1;
                                }
                                else if (!rm)
                                {
-                                       error(2, "%s: cannot %s %s protection", 
state.path, state.opname, protection);
+                                       error(2, "%s: cannot %s %s protection", 
state->path, state->opname, protection);
                                        return 0;
                                }
                        }
                }
-               switch (state.backup)
+               switch (state->backup)
                {
                case BAK_existing:
                case BAK_number:
                        v = 0;
-                       if (s = strrchr(state.path, '/'))
+                       if (s = strrchr(state->path, '/'))
                        {
-                               e = state.path;
+                               e = state->path;
                                *s++ = 0;
                        }
                        else
                        {
-                               e = dot;
-                               s = state.path;
+                               e = (char*)dot;
+                               s = state->path;
                        }
                        n = strlen(s);
                        if (fts = fts_open((char**)e, 
FTS_NOCHDIR|FTS_ONEPATH|FTS_PHYSICAL|FTS_NOPOSTORDER|FTS_NOSTAT|FTS_NOSEEDOTDIR,
 NiL))
                        {
-                               while (ent = fts_read(fts))
+                               while (sub = fts_read(fts))
                                {
-                                       if (strneq(s, ent->fts_name, n) && 
ent->fts_name[n] == '.' && strneq(ent->fts_name + n + 1, state.suffix, 
state.suflen) && (m = strtol(ent->fts_name + n + state.suflen + 1, &e, 10)) && 
streq(e, state.suffix) && m > v)
+                                       if (strneq(s, sub->fts_name, n) && 
sub->fts_name[n] == '.' && strneq(sub->fts_name + n + 1, state->suffix, 
state->suflen) && (m = strtol(sub->fts_name + n + state->suflen + 1, &e, 10)) 
&& streq(e, state->suffix) && m > v)
                                                v = m;
-                                       if (ent->fts_level)
-                                               fts_set(NiL, ent, FTS_SKIP);
+                                       if (sub->fts_level)
+                                               fts_set(NiL, sub, FTS_SKIP);
                                }
                                fts_close(fts);
                        }
-                       if (s != state.path)
+                       if (s != state->path)
                                *--s = '/';
-                       if (v || state.backup == BAK_number)
+                       if (v || state->backup == BAK_number)
                        {
-                               sfprintf(state.tmp, "%s.%s%d%s", state.path, 
state.suffix, v + 1, state.suffix);
+                               sfprintf(state->tmp, "%s.%s%d%s", state->path, 
state->suffix, v + 1, state->suffix);
                                goto backup;
                        }
                        /*FALLTHROUGH*/
                case BAK_simple:
-                       sfprintf(state.tmp, "%s%s", state.path, state.suffix);
+                       sfprintf(state->tmp, "%s%s", state->path, 
state->suffix);
                backup:
-                       s = sfstruse(state.tmp);
-                       if (rename(state.path, s))
+                       if (!(s = sfstruse(state->tmp)))
+                               error(ERROR_SYSTEM|3, "%s: out of space", 
state->path);
+                       if (rename(state->path, s))
                        {
-                               error(ERROR_SYSTEM|2, "%s: cannot backup to 
%s", state.path, s);
+                               error(ERROR_SYSTEM|2, "%s: cannot backup to 
%s", state->path, s);
                                return 0;
                        }
                        break;
                default:
-                       if (rm && remove(state.path))
+                       if (rm && remove(state->path))
                        {
-                               error(ERROR_SYSTEM|2, "%s: cannot remove", 
state.path);
+                               error(ERROR_SYSTEM|2, "%s: cannot remove", 
state->path);
                                return 0;
                        }
                        break;
                }
        }
  operate:
-       switch (state.op)
+       switch (state->op)
        {
        case MV:
                for (;;)
                {
-                       if (!rename(ftw->path, state.path))
+                       if (!rename(ent->fts_path, state->path))
                                return 0;
                        if (errno == ENOENT)
                                rm = 1;
-                       else if (!rm && st.st_mode && !remove(state.path))
+                       else if (!rm && st.st_mode && !remove(state->path))
                        {
                                rm = 1;
                                continue;
                        }
-                       if (errno != EXDEV && (rm || 
S_ISDIR(ftw->statb.st_mode)))
+                       if (errno != EXDEV && (rm || 
S_ISDIR(ent->fts_statp->st_mode)))
                        {
-                               error(ERROR_SYSTEM|2, "%s: cannot rename to 
%s", ftw->path, state.path);
+                               error(ERROR_SYSTEM|2, "%s: cannot rename to 
%s", ent->fts_path, state->path);
                                return 0;
                        }
                        else
@@ -546,39 +548,39 @@
                }
                /*FALLTHROUGH*/
        case CP:
-               if (S_ISLNK(ftw->statb.st_mode))
+               if (S_ISLNK(ent->fts_statp->st_mode))
                {
-                       if ((n = pathgetlink(ftw->path, state.text, 
sizeof(state.text) - 1)) < 0)
+                       if ((n = pathgetlink(ent->fts_path, state->text, 
sizeof(state->text) - 1)) < 0)
                        {
-                               error(ERROR_SYSTEM|2, "%s: cannot read symbolic 
link text", ftw->path);
+                               error(ERROR_SYSTEM|2, "%s: cannot read symbolic 
link text", ent->fts_path);
                                return 0;
                        }
-                       state.text[n] = 0;
-                       if (pathsetlink(state.text, state.path))
+                       state->text[n] = 0;
+                       if (pathsetlink(state->text, state->path))
                        {
-                               error(ERROR_SYSTEM|2, "%s: cannot copy symbolic 
link to %s", ftw->path, state.path);
+                               error(ERROR_SYSTEM|2, "%s: cannot copy symbolic 
link to %s", ent->fts_path, state->path);
                                return 0;
                        }
                }
-               else if (state.op == CP || S_ISREG(ftw->statb.st_mode) || 
S_ISDIR(ftw->statb.st_mode))
+               else if (state->op == CP || S_ISREG(ent->fts_statp->st_mode) || 
S_ISDIR(ent->fts_statp->st_mode))
                {
-                       if (ftw->statb.st_size > 0 && (rfd = open(ftw->path, 
O_RDONLY|O_BINARY)) < 0)
+                       if (ent->fts_statp->st_size > 0 && (rfd = 
open(ent->fts_path, O_RDONLY|O_BINARY)) < 0)
                        {
-                               error(ERROR_SYSTEM|2, "%s: cannot read", 
ftw->path);
+                               error(ERROR_SYSTEM|2, "%s: cannot read", 
ent->fts_path);
                                return 0;
                        }
-                       else if ((wfd = open(state.path, 
O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, ftw->statb.st_mode & state.perm)) < 0)
+                       else if ((wfd = open(state->path, 
O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, ent->fts_statp->st_mode & state->perm)) < 0)
                        {
-                               error(ERROR_SYSTEM|2, "%s: cannot write", 
state.path);
-                               if (ftw->statb.st_size > 0)
+                               error(ERROR_SYSTEM|2, "%s: cannot write", 
state->path);
+                               if (ent->fts_statp->st_size > 0)
                                        close(rfd);
                                return 0;
                        }
-                       else if (ftw->statb.st_size > 0)
+                       else if (ent->fts_statp->st_size > 0)
                        {
                                if (!(ip = sfnew(NiL, NiL, SF_UNBOUND, rfd, 
SF_READ)))
                                {
-                                       error(ERROR_SYSTEM|2, "%s: %s read 
stream error", ftw->path, state.path);
+                                       error(ERROR_SYSTEM|2, "%s: %s read 
stream error", ent->fts_path, state->path);
                                        close(rfd);
                                        close(wfd);
                                }
@@ -587,7 +589,7 @@
                                        n = 0;
                                        if (!(op = sfnew(NiL, NiL, SF_UNBOUND, 
wfd, SF_WRITE)))
                                        {
-                                               error(ERROR_SYSTEM|2, "%s: %s 
write stream error", ftw->path, state.path);
+                                               error(ERROR_SYSTEM|2, "%s: %s 
write stream error", ent->fts_path, state->path);
                                                close(wfd);
                                                sfclose(ip);
                                        }
@@ -597,51 +599,51 @@
                                                        n |= 3;
                                                if (!sfeof(ip))
                                                        n |= 1;
-                                               if (sfsync(op) || state.sync && 
fsync(wfd) || sfclose(op))
+                                               if (sfsync(op) || state->sync 
&& fsync(wfd) || sfclose(op))
                                                        n |= 2;
                                                if (sfclose(ip))
                                                        n |= 1;
                                                if (n)
-                                                       error(ERROR_SYSTEM|2, 
"%s: %s %s error", ftw->path, state.path, n == 1 ? ERROR_translate(0, 0, 0, 
"read") : n == 2 ? ERROR_translate(0, 0, 0, "write") : ERROR_translate(0, 0, 0, 
"io"));
+                                                       error(ERROR_SYSTEM|2, 
"%s: %s %s error", ent->fts_path, state->path, n == 1 ? ERROR_translate(0, 0, 
0, "read") : n == 2 ? ERROR_translate(0, 0, 0, "write") : ERROR_translate(0, 0, 
0, "io"));
                                        }
                                }
                        }
                        else
                                close(wfd);
                }
-               else if (S_ISBLK(ftw->statb.st_mode) || 
S_ISCHR(ftw->statb.st_mode) || S_ISFIFO(ftw->statb.st_mode))
+               else if (S_ISBLK(ent->fts_statp->st_mode) || 
S_ISCHR(ent->fts_statp->st_mode) || S_ISFIFO(ent->fts_statp->st_mode))
                {
-                       if (mknod(state.path, ftw->statb.st_mode, 
idevice(&ftw->statb)))
+                       if (mknod(state->path, ent->fts_statp->st_mode, 
idevice(ent->fts_statp)))
                        {
-                               error(ERROR_SYSTEM|2, "%s: cannot copy special 
file to %s", ftw->path, state.path);
+                               error(ERROR_SYSTEM|2, "%s: cannot copy special 
file to %s", ent->fts_path, state->path);
                                return 0;
                        }
                }
                else
                {
-                       error(2, "%s: cannot copy -- unknown file type 0%o", 
ftw->path, S_ITYPE(ftw->statb.st_mode));
+                       error(2, "%s: cannot copy -- unknown file type 0%o", 
ent->fts_path, S_ITYPE(ent->fts_statp->st_mode));
                        return 0;
                }
-               if (state.preserve)
+               if (state->preserve)
                {
-                       if (ftw->info != FTW_SL)
+                       if (ent->fts_info != FTS_SL)
                        {
-                               if (stat(state.path, &st))
-                                       error(ERROR_SYSTEM|2, "%s: cannot 
stat", state.path);
+                               if (stat(state->path, &st))
+                                       error(ERROR_SYSTEM|2, "%s: cannot 
stat", state->path);
                                else
                                {
-                                       if ((ftw->statb.st_mode & state.perm) 
!= (st.st_mode & state.perm) && chmod(state.path, ftw->statb.st_mode & 
state.perm))
-                                               error(ERROR_SYSTEM|2, "%s: 
cannot reset mode to %s", state.path, fmtmode(st.st_mode & state.perm, 0) + 1);
-                                       preserve(state.path, &st, &ftw->statb);
+                                       if ((ent->fts_statp->st_mode & 
state->perm) != (st.st_mode & state->perm) && chmod(state->path, 
ent->fts_statp->st_mode & state->perm))
+                                               error(ERROR_SYSTEM|2, "%s: 
cannot reset mode to %s", state->path, fmtmode(st.st_mode & state->perm, 0) + 
1);
+                                       preserve(state, state->path, &st, 
ent->fts_statp);
                                }
                        }
-                       if (state.op == MV && remove(ftw->path))
-                               error(ERROR_SYSTEM|1, "%s: cannot remove", 
ftw->path);
+                       if (state->op == MV && remove(ent->fts_path))
+                               error(ERROR_SYSTEM|1, "%s: cannot remove", 
ent->fts_path);
                }
                break;
        case LN:
-               if ((*state.link)(ftw->path, state.path))
-                       error(ERROR_SYSTEM|2, "%s: cannot link to %s", 
ftw->path, state.path);
+               if ((*state->link)(ent->fts_path, state->path))
+                       error(ERROR_SYSTEM|2, "%s: cannot link to %s", 
ent->fts_path, state->path);
                break;
        }
        return 0;
@@ -654,20 +656,19 @@
        register char*  s;
        char**          v;
        char*           backup_type;
+       FTS*            fts;
+       FTSENT* ent;
        const char*     usage;
        int             path_resolve;
        int             standard;
        struct stat     st;
+       State_t         state;
 
-       if (argc < 0)
-       {
-               state.interrupt = 1;
-               return -1;
-       }
+       cmdinit(argc, argv, context, ERROR_CATALOG, ERROR_NOTIFY);
        memset(&state, 0, sizeof(state));
-       cmdinit(argv, context, ERROR_CATALOG, ERROR_NOTIFY);
+       state.presiz = -1;
        backup_type = 0;
-       state.flags = FTW_DOT|FTW_MULTIPLE|FTW_TWICE|FTW_NOSEEDOTDIR;
+       state.flags = FTS_NOCHDIR|FTS_NOSEEDOTDIR;
        state.uid = geteuid();
        if (!(state.tmp = sfstropen()))
                error(ERROR_SYSTEM|3, "out of space [tmp string]");
@@ -686,7 +687,7 @@
        case 'L':
                sfputr(state.tmp, usage_ln, -1);
                state.op = LN;
-               state.flags |= FTW_PHYSICAL;
+               state.flags |= FTS_PHYSICAL;
                state.link = link;
                state.stat = lstat;
                path_resolve = 1;
@@ -695,7 +696,7 @@
        case 'M':
                sfputr(state.tmp, usage_mv, -1);
                state.op = MV;
-               state.flags |= FTW_PHYSICAL;
+               state.flags |= FTS_PHYSICAL;
                state.preserve = 1;
                state.stat = lstat;
                path_resolve = 1;
@@ -705,14 +706,15 @@
                break;
        }
        sfputr(state.tmp, usage_tail, -1);
-       usage = sfstruse(state.tmp);
+       if (!(usage = sfstruse(state.tmp)))
+               error(ERROR_SYSTEM|3, "%s: out of space", state.path);
        state.opname = state.op == CP ? ERROR_translate(0, 0, 0, "overwrite") : 
ERROR_translate(0, 0, 0, "replace");
        for (;;)
        {
                switch (optget(argv, usage))
                {
                case 'a':
-                       state.flags |= FTW_PHYSICAL;
+                       state.flags |= FTS_PHYSICAL;
                        state.preserve = 1;
                        state.recursive = 1;
                        path_resolve = 1;
@@ -758,7 +760,7 @@
                        state.verbose = 1;
                        continue;
                case 'x':
-                       state.flags |= FTW_MOUNT;
+                       state.flags |= FTS_XDEV;
                        continue;
                case 'F':
 #if _lib_fsync
@@ -768,22 +770,22 @@
 #endif
                        continue;
                case 'H':
-                       state.flags |= FTW_META|FTW_PHYSICAL;
+                       state.flags |= FTS_META|FTS_PHYSICAL;
                        path_resolve = 1;
                        continue;
                case 'L':
-                       state.flags &= ~FTW_PHYSICAL;
+                       state.flags &= ~FTS_PHYSICAL;
                        path_resolve = 1;
                        continue;
                case 'P':
-                       state.flags &= ~FTW_META;
-                       state.flags |= FTW_PHYSICAL;
+                       state.flags &= ~FTS_META;
+                       state.flags |= FTS_PHYSICAL;
                        path_resolve = 1;
                        continue;
                case 'R':
                        state.recursive = 1;
-                       state.flags &= ~FTW_META;
-                       state.flags |= FTW_PHYSICAL;
+                       state.flags &= ~FTS_META;
+                       state.flags |= FTS_PHYSICAL;
                        path_resolve = 1;
                        continue;
                case 'S':
@@ -815,7 +817,7 @@
        if (!argc && !standard)
        {
                argc++;
-               argv[1] = dot;
+               argv[1] = (char*)dot;
        }
        if (state.backup)
        {
@@ -898,8 +900,14 @@
        }
        state.perm = state.uid ? S_IPERM : (S_IPERM & ~S_ISVTX);
        if (!state.recursive)
-               state.flags |= FTW_TOP;
-       ftwalk((char*)argv, visit, state.flags, NiL);
+               state.flags |= FTS_TOP;
+       if (fts = fts_open(argv, state.flags, NiL))
+       {
+               while ((ent = fts_read(fts)) && !visit(&state, ent));
+               fts_close(fts);
+       }
+       else
+               error(ERROR_SYSTEM|2, "%s: error", argv[0]);
        free(state.path);
        return error_info.errors != 0;
 }
diff -r -N -u ksh93_2006_09_12/src/lib/libcmd/cut.c 
ksh93_2006_10_31/src/lib/libcmd/cut.c
--- ksh93_2006_09_12/src/lib/libcmd/cut.c       2006-07-18 09:38:19.000000000 
+0200
+++ ksh93_2006_10_31/src/lib/libcmd/cut.c       2006-11-01 22:23:18.000000000 
+0100
@@ -29,7 +29,7 @@
  */
 
 static const char usage[] =
-"[-?\n@(#)$Id: cut (AT&T Labs Research) 2006-07-17 $\n]"
+"[-?\n@(#)$Id: cut (AT&T Research) 2006-07-17 $\n]"
 USAGE_LICENSE
 "[+NAME?cut - cut out selected columns or fields of each line of a file]"
 "[+DESCRIPTION?\bcut\b bytes, characters, or character-delimited fields "
@@ -77,23 +77,33 @@
 "[+SEE ALSO?\bpaste\b(1), \bgrep\b(1)]"
 ;
 
-#include <cmdlib.h>
+#include <cmd.h>
 #include <ctype.h>
 
-typedef struct
+typedef struct Last_s
 {
-       int     cflag;
-       int     sflag;
-       int     nlflag;
-       int     wdelim;
-       int     ldelim;
-       int     seqno;
-       int     reclen;
-       int     list[2];
+       int             seqno;
+       int             seq;
+       int             wdelim;
+       int             ldelim;
+} Last_t;
+
+typedef struct Cut_s
+{
+       int             cflag;
+       int             sflag;
+       int             nlflag;
+       int             wdelim;
+       int             ldelim;
+       int             seqno;
+       int             reclen;
+       int             list[2];
+       signed char     space[UCHAR_MAX];
+       Last_t          last;
 } Cut_t;
 
 #define HUGE           (1<<14)
-#define BSIZE          8*1024
+#define BLOCK          8*1024
 #define C_BYTES                1
 #define C_CHARS                2
 #define C_FIELDS       4
@@ -101,8 +111,6 @@
 #define C_NOCHOP       16
 #define C_NONEWLINE    32
 
-static int seqno;
-
 /*
  * compare the first of an array of integers
  */
@@ -120,13 +128,18 @@
        Cut_t *cuthdr;
        if (!(cuthdr = (Cut_t*)stakalloc(sizeof(Cut_t)+strlen(cp)*sizeof(int))))
                error(ERROR_exit(1), "out of space");
+       memset(cuthdr->space, 0, sizeof(cuthdr->space));
+       cuthdr->last.seqno = 0;
+       cuthdr->last.seq = 0;
+       cuthdr->last.wdelim = 0;
+       cuthdr->last.ldelim = '\n';
        cuthdr->cflag = ((mode&C_CHARS)!=0 && mbwide());
        cuthdr->sflag = ((mode&C_SUPRESS)!=0);
        cuthdr->nlflag = ((mode&C_NONEWLINE)!=0);
        cuthdr->wdelim = wdelim;
        cuthdr->ldelim = ldelim;
        cuthdr->reclen = reclen;
-       cuthdr->seqno = ++seqno;
+       cuthdr->seqno = ++cuthdr->last.seqno;
        lp = cuthdr->list;
        while(1) switch(c= *cp++)
        {
@@ -236,7 +249,7 @@
  * cut each line of file <fdin> and put results to <fdout> using list <list>
  */
 
-static int cutcols(const Cut_t *cuthdr,Sfio_t *fdin,Sfio_t *fdout)
+static int cutcols(Cut_t *cuthdr,Sfio_t *fdin,Sfio_t *fdout)
 {
        register int            c, ncol=0,len;
        register const int      *lp = cuthdr->list;
@@ -282,10 +295,8 @@
 
 #define endline(c)     (((signed char)-1)<0?(c)<0:(c)==((char)-1))
 
-static int cutfields(const Cut_t *cuthdr,Sfio_t *fdin,Sfio_t *fdout)
+static int cutfields(Cut_t *cuthdr,Sfio_t *fdin,Sfio_t *fdout)
 {
-       static signed char space[1<<CHAR_BIT];
-       static int lastseq, lastwdelim = 0, lastldelim = '\n';
        register unsigned char *cp;
        register int c, nfields;
        register const int *lp = cuthdr->list;
@@ -296,13 +307,13 @@
        int lastchar;
        Sfio_t *fdtmp = 0;
        long offset = 0;
-       if(cuthdr->seqno != lastseq)
+       if(cuthdr->seqno != cuthdr->last.seq)
        {
-               space[lastldelim] = 0;
-               space[lastwdelim] = 0;
-               space[(lastwdelim=cuthdr->wdelim)] = 1;
-               space[(lastldelim=cuthdr->ldelim)] = -1;
-               lastseq = cuthdr->seqno;
+               cuthdr->space[cuthdr->last.ldelim] = 0;
+               cuthdr->space[cuthdr->last.wdelim] = 0;
+               cuthdr->space[cuthdr->last.wdelim=cuthdr->wdelim] = 1;
+               cuthdr->space[cuthdr->last.ldelim=cuthdr->ldelim] = -1;
+               cuthdr->last.seq = cuthdr->seqno;
        }
        /* process each buffer */
        while ((inbuff = (unsigned char*)sfreserve(fdin, SF_UNBOUND, 0)) && (c 
= sfvalue(fdin)) > 0)
@@ -330,15 +341,15 @@
                        while(!inword)
                        {
                                /* skip over non-delimiter characters */
-                               while(!(c=space[*cp++]));
+                               while(!(c=cuthdr->space[*cp++]));
                                /* check for end-of-line */
                                if(endline(c))
                                {
                                        if(cp<=endbuff)
                                                break;
-                                       if((c=space[lastchar]),endline(c))
+                                       
if((c=cuthdr->space[lastchar]),endline(c))
                                                break;
-                                       /* restore last character */
+                                       /* restore cuthdr->last. character */
                                        if(lastchar != cuthdr->ldelim)
                                                *endbuff = lastchar;
                                        inword++;
@@ -370,7 +381,7 @@
                                                {
                                                        if(offset)
                                                        {
-                                                               
sfseek(fdtmp,0L,0);
+                                                               
sfseek(fdtmp,(Sfoff_t)0,SEEK_SET);
                                                                
sfmove(fdtmp,fdout,offset,-1);
                                                        }
                                                        copy = first;
@@ -380,7 +391,7 @@
                                                sfputc(fdout,'\n');
                                }
                                if(offset)
-                                       sfseek(fdtmp,offset=0L,0);
+                                       sfseek(fdtmp,offset=0,SEEK_SET);
                        }
                        if(copy && (c=cp-copy)>0 && (!nodelim || 
!cuthdr->sflag) && sfwrite(fdout,(char*)copy,c)< 0)
                                goto failed;
@@ -390,7 +401,7 @@
                {
                        /* copy line to tmpfile in case no fields */
                        if(!fdtmp)
-                               fdtmp = sftmp(BSIZE);
+                               fdtmp = sftmp(BLOCK);
                        sfwrite(fdtmp,(char*)first,c);
                        offset +=c;
                }
@@ -413,8 +424,7 @@
        int     ldelim = '\n';
        size_t  reclen = 0;
 
-       NoP(argc);
-       cmdinit(argv, context, ERROR_CATALOG, 0);
+       cmdinit(argc, argv, context, ERROR_CATALOG, 0);
        while (n = optget(argv, usage)) switch (n)
        {
          case 'b':
@@ -500,4 +510,3 @@
        while(cp= *argv++);
        return(error_info.errors?1:0);
 }
-
diff -r -N -u ksh93_2006_09_12/src/lib/libcmd/date.c 
ksh93_2006_10_31/src/lib/libcmd/date.c
--- ksh93_2006_09_12/src/lib/libcmd/date.c      2006-09-08 22:41:42.000000000 
+0200
+++ ksh93_2006_10_31/src/lib/libcmd/date.c      2006-11-01 21:16:22.000000000 
+0100
@@ -182,7 +182,7 @@
 "      \bstrftime\b(3), \bstrptime\b(3), \btm\b(3)]"
 ;
 
-#include <cmdlib.h>
+#include <cmd.h>
 #include <ls.h>
 #include <proc.h>
 #include <tmx.h>
@@ -220,13 +220,13 @@
                *argv++ = s;
                if (streq(astconf("UNIVERSE", NiL, NiL), "att"))
                {
-                       tmxfmt(buf, sizeof(buf), "%m%d%H%M%Y.%S", now);
+                       tmxfmt(buf, sizeof(buf), "%m%d%H" "%M%Y.%S", now);
                        if (adjust)
                                *argv++ = "-a";
                }
                else
                {
-                       tmxfmt(buf, sizeof(buf), "%Y%m%d%H%M.%S", now);
+                       tmxfmt(buf, sizeof(buf), "%Y%m%d%H" "%M.%S", now);
                        if (network)
                                *argv++ = "-n";
                        if (tm_info.flags & TM_UTC)
@@ -289,7 +289,7 @@
        int             show = 0;       /* show date and don't set      */
 
        NoP(argc);
-       cmdinit(argv, context, ERROR_CATALOG, 0);
+       cmdinit(argc, argv, context, ERROR_CATALOG, 0);
        setlocale(LC_ALL, "");
        tm_info.flags = TM_DATESTYLE;
        fmts = &fmt;
diff -r -N -u ksh93_2006_09_12/src/lib/libcmd/dirname.c 
ksh93_2006_10_31/src/lib/libcmd/dirname.c
--- ksh93_2006_09_12/src/lib/libcmd/dirname.c   2002-11-14 22:31:40.000000000 
+0100
+++ ksh93_2006_10_31/src/lib/libcmd/dirname.c   2006-11-01 21:16:24.000000000 
+0100
@@ -29,7 +29,7 @@
  */
 
 static const char usage[] =
-"[-?\n@(#)$Id: dirname (AT&T Labs Research) 2000-03-07 $\n]"
+"[-?\n@(#)$Id: dirname (AT&T Research) 2000-03-07 $\n]"
 USAGE_LICENSE
 "[+NAME?dirname - return directory portion of file name]"
 "[+DESCRIPTION?\bdirname\b treats \astring\a as a file name and returns "
@@ -58,9 +58,9 @@
 "[+SEE ALSO?\bbasename\b(1), \bgetconf\b(1), \bdirname\b(3)]"
 ;
 
-#include <cmdlib.h>
+#include <cmd.h>
 
-static void dirname(register Sfio_t *outfile, register const char *pathname)
+static void l_dirname(register Sfio_t *outfile, register const char *pathname)
 {
        register const char  *last;
        /* go to end of path */
@@ -97,7 +97,7 @@
 {
        register int n;
 
-       cmdinit(argv, context, ERROR_CATALOG, 0);
+       cmdinit(argc, argv, context, ERROR_CATALOG, 0);
        while (n = optget(argv, usage)) switch (n)
        {
        case ':':
@@ -111,6 +111,6 @@
        argc -= opt_info.index;
        if(error_info.errors || argc != 1)
                error(ERROR_usage(2),"%s", optusage(NiL));
-       dirname(sfstdout,argv[0]);
+       l_dirname(sfstdout,argv[0]);
        return(0);
 }
diff -r -N -u ksh93_2006_09_12/src/lib/libcmd/expr.c 
ksh93_2006_10_31/src/lib/libcmd/expr.c
--- ksh93_2006_09_12/src/lib/libcmd/expr.c      2004-05-27 20:57:48.000000000 
+0200
+++ ksh93_2006_10_31/src/lib/libcmd/expr.c      2006-11-01 21:16:26.000000000 
+0100
@@ -27,7 +27,7 @@
  */
 
 static const char usage[] =
-"[-?\n@(#)$Id: expr (AT&T Labs Research) 2004-05-27 $\n]"
+"[-?\n@(#)$Id: expr (AT&T Research) 2004-05-27 $\n]"
 USAGE_LICENSE
 "[+NAME?expr - evaluate arguments as an expression]"
 "[+DESCRIPTION?\bexpr\b evaluates an expression given as arguments and writes "
@@ -140,10 +140,10 @@
 
 #define numeric(np)    ((np)->type&T_NUM)
 
-static struct Optable_s
+static const struct Optable_s
 {
-       char    opname[3];
-       int     op;
+       const char      opname[3];
+       int             op;
 }
 optable[] =
 {
@@ -495,8 +495,7 @@
        Node_t  node;
        int     n;
 
-       NoP(argc);
-       cmdinit(argv,context, ERROR_CATALOG, 0);
+       cmdinit(argc, argv,context, ERROR_CATALOG, 0);
        state.standard = !strcmp(astconf("CONFORMANCE", NiL, NiL), "standard");
 #if 0
        if (state.standard)
@@ -534,4 +533,3 @@
                sfprintf(sfstdout,"%d\n",node.num);
        return numeric(&node)?node.num==0:*node.str==0;
 }
-
diff -r -N -u ksh93_2006_09_12/src/lib/libcmd/fds.c 
ksh93_2006_10_31/src/lib/libcmd/fds.c
--- ksh93_2006_09_12/src/lib/libcmd/fds.c       2005-04-12 05:25:46.000000000 
+0200
+++ ksh93_2006_10_31/src/lib/libcmd/fds.c       2006-11-01 21:16:28.000000000 
+0100
@@ -21,7 +21,7 @@
 #pragma prototyped
 
 static const char usage[] =
-"[-?\n@(#)$Id: fds (AT&T Research) 2005-04-11 $\n]"
+"[-?\n@(#)$Id: fds (AT&T Research) 2006-10-26 $\n]"
 USAGE_LICENSE
 "[+NAME?fds - list open file descriptor status]"
 "[+DESCRIPTION?\bfds\b lists the status for each open file descriptor. "
@@ -32,7 +32,7 @@
 "[+SEE ALSO?\blogname\b(1), \bwho\b(1), \bgetgroups\b(2)]"
 ;
 
-#include <cmdlib.h>
+#include <cmd.h>
 #include <ls.h>
 
 #include "FEATURE/sockets"
@@ -64,12 +64,13 @@
        struct stat             st;
 #ifdef S_IFSOCK
        struct sockaddr_in      addr;
-       int                     addrlen;
+       socklen_t               len;
        int                     type;
-       char                    num[12];
+       int                     prot;
+       char                    num[32];
 #endif
 
-       cmdinit(argv, context, ERROR_CATALOG, 0);
+       cmdinit(argc, argv, context, ERROR_CATALOG, 0);
        details = 0;
        for (;;)
        {
@@ -117,20 +118,44 @@
                        if (isatty(i) && (s = ttyname(i)))
                                sfprintf(sfstdout, "%02d %s%s %s %s\n", i, m, 
x, fmtmode(st.st_mode, 0), s);
 #ifdef S_IFSOCK
-                       else if (!st.st_mode && (st.st_mode = 
S_IFSOCK|S_IRUSR|S_IWUSR) && (addrlen = sizeof(addr)) && !getsockname(i, 
(struct sockaddr*)&addr, (void*)&addrlen) && addrlen == sizeof(addr) && 
addr.sin_family == AF_INET && (addrlen = sizeof(type)) && !getsockopt(i, 
SOL_SOCKET, SO_TYPE, (void*)&type, (void*)&addrlen))
+                       else if ((len = sizeof(addr))
+                                && !getsockname(i, (struct sockaddr*)&addr, 
(void*)&len)
+                                && len == sizeof(addr)
+                                && addr.sin_family == AF_INET
+#ifdef SO_TYPE
+                                && (len = sizeof(type))
+                                && !getsockopt(i, SOL_SOCKET, SO_TYPE, 
(void*)&type, (void*)&len)
+                                && len == sizeof(type)
+#else
+                                && !(type = 0)
+#endif
+#ifdef SO_PROTOTYPE
+                                && (len = sizeof(prot))
+                                && (!getsockopt(i, SOL_SOCKET, SO_PROTOTYPE, 
(void*)&prot, (void*)&len) || !(prot = 0))
+#else
+                                && !(prot = 0)
+#endif
+                               )
                        {
+                               if (!st.st_mode)
+                                       st.st_mode = S_IFSOCK|S_IRUSR|S_IWUSR;
+                               s = 0;
                                switch (type)
                                {
-                               case SOCK_STREAM:
-                                       s = "tcp";
-                                       break;
                                case SOCK_DGRAM:
                                        s = "udp";
                                        break;
-                               default:
-                                       sfprintf(sfstdout, s = num, "proto.%d", 
type);
+                               case SOCK_STREAM:
+                                       if (prot == 0)
+                                               s = "tcp";
+#ifdef IPPROTO_SCTP
+                                       else if (prot == IPPROTO_SCTP)
+                                               s = "sctp";
+#endif
                                        break;
                                }
+                               if (!s)
+                                       sfprintf(sfstdout, s = num, 
"type.%d.prot.%d", type, prot);
                                sfprintf(sfstdout, "%02d %s%s %s 
/dev/%s/%s/%d\n", i, m, x, fmtmode(st.st_mode, 0), s, inet_ntoa(addr.sin_addr), 
ntohs(addr.sin_port));
                        }
 #endif
diff -r -N -u ksh93_2006_09_12/src/lib/libcmd/fmt.c 
ksh93_2006_10_31/src/lib/libcmd/fmt.c
--- ksh93_2006_09_12/src/lib/libcmd/fmt.c       2005-08-10 23:39:45.000000000 
+0200
+++ ksh93_2006_10_31/src/lib/libcmd/fmt.c       2006-11-01 21:16:30.000000000 
+0100
@@ -51,7 +51,7 @@
     "\boptget\b(3)]"
 ;
 
-#include <cmdlib.h>
+#include <cmd.h>
 #include <ctype.h>
 
 typedef struct Fmt_s
@@ -565,7 +565,7 @@
        fmt.quote = 0;
        fmt.retain = 0;
        fmt.section = 1;
-       cmdinit(argv, context, ERROR_CATALOG, 0);
+       cmdinit(argc, argv, context, ERROR_CATALOG, 0);
        while (n = optget(argv, usage))
                switch (n)
                {
diff -r -N -u ksh93_2006_09_12/src/lib/libcmd/fold.c 
ksh93_2006_10_31/src/lib/libcmd/fold.c
--- ksh93_2006_09_12/src/lib/libcmd/fold.c      2004-11-18 23:38:51.000000000 
+0100
+++ ksh93_2006_10_31/src/lib/libcmd/fold.c      2006-11-01 21:16:33.000000000 
+0100
@@ -27,7 +27,7 @@
  */
 
 static const char usage[] =
-"[-?\n@(#)$Id: fold (AT&T Labs Research) 2004-11-18 $\n]"
+"[-?\n@(#)$Id: fold (AT&T Research) 2004-11-18 $\n]"
 USAGE_LICENSE
 "[+NAME?fold - fold lines]"
 "[+DESCRIPTION?\bfold\b is a filter that folds lines from its input, "
@@ -74,7 +74,7 @@
 ;
 
 
-#include <cmdlib.h>
+#include <cmd.h>
 
 #define WIDTH  80
 #define TABSIZE        8
@@ -86,9 +86,7 @@
 #define T_SP   5
 #define T_RET  6
 
-static char cols[1<<CHAR_BIT];
-
-static void fold(Sfio_t *in, Sfio_t *out, register int width, const char 
*cont, size_t contsize)
+static void fold(Sfio_t *in, Sfio_t *out, register int width, const char 
*cont, size_t contsize, char *cols)
 {
        register char *cp, *first;
        register int n, col=0, x=0;
@@ -176,8 +174,10 @@
        register char *cp;
        char *cont="\n";
        size_t contsize = 1;
+       char cols[1<<CHAR_BIT];
 
-       cmdinit(argv, context, ERROR_CATALOG, 0);
+       cmdinit(argc, argv, context, ERROR_CATALOG, 0);
+       memset(cols, 0, sizeof(cols));
        cols['\t'] = T_TAB;
        cols['\b'] = T_BS;
        cols['\n'] = T_NL;
@@ -233,7 +233,7 @@
                        error_info.errors = 1;
                        continue;
                }
-               fold(fp,sfstdout,width,cont,contsize);
+               fold(fp,sfstdout,width,cont,contsize,cols);
                if(fp!=sfstdin)
                        sfclose(fp);
        }
diff -r -N -u ksh93_2006_09_12/src/lib/libcmd/getconf.c 
ksh93_2006_10_31/src/lib/libcmd/getconf.c
--- ksh93_2006_09_12/src/lib/libcmd/getconf.c   2006-02-11 08:59:00.000000000 
+0100
+++ ksh93_2006_10_31/src/lib/libcmd/getconf.c   2006-11-01 21:16:35.000000000 
+0100
@@ -21,13 +21,13 @@
 #pragma prototyped
 /*
  * Glenn Fowler
- * AT&T Labs Research
+ * AT&T Research
  *
  * getconf - get configuration values
  */
 
 static const char usage[] =
-"[-?\n@(#)$Id: getconf (AT&T Labs Research) 2006-06-11 $\n]"
+"[-?\n@(#)$Id: getconf (AT&T Research) 2006-10-11 $\n]"
 USAGE_LICENSE
 "[+NAME?getconf - get configuration values]"
 "[+DESCRIPTION?\bgetconf\b displays the system configuration value for"
@@ -49,10 +49,15 @@
 "[+?If no operands are specified then all known variables are written in"
 "      \aname\a=\avalue\a form to the standard output, one per line."
 "      Only one of \b--call\b, \b--name\b or \b--standard\b may be specified.]"
+"[+?This implementation uses the \bastgetconf\b(3) string interface to the 
native"
+"      \bsysconf\b(2), \bconfstr\b(2), \bpathconf\b(2), and \bsysinfo\b(2)"
+"      system calls. If \bgetconf\b on \b$PATH\b is not the default native"
+"      \bgetconf\b, named by \b$(getconf GETCONF)\b, then \bastgetconf\b(3)"
+"      checks only \bast\b specific extensions and the native system calls;"
+"      invalid options and/or names not supported by \bastgetconf\b(3) cause"
+"      the \bgetconf\b on \b$PATH\b to be executed.]"
 
-"[a:all?All known variables are written in \aname\a=\avalue\a form to the"
-"      standard output, one per line. Present for compatibility with other"
-"      implementations.]"
+"[a:all?Call the native \bgetconf\b(1) with option \b-a\b.]"
 "[b:base?List base variable name sans call and standard prefixes.]"
 "[c:call?Display variables with call prefix that matches \aRE\a. The call"
 "      prefixes are:]:[RE]{"
@@ -78,6 +83,7 @@
 "              [+AES]"
 "              [+AST]"
 "              [+C]"
+"              [+GNU]"
 "              [+POSIX]"
 "              [+SVID]"
 "              [+XBS5]"
@@ -89,7 +95,8 @@
 "[w:writable?Display the named \bwritable\b variables in \aname\a=\avalue\a"
 "      form. If \aname\a is omitted then all \bwritable\b variables are"
 "      listed.]"
-"[v:specification?Ignored by this implementation.]:[name]"
+"[v:specification?Call the native \bgetconf\b(1) with option"
+"      \b-v\b \aname\a.]:[name]"
 
 "\n"
 "\n[ name [ path [ value ] ] ... ]\n"
@@ -108,32 +115,38 @@
 "      \bsysconf\b(2), \bastgetconf\b(3)]"
 ;
 
-#include <cmdlib.h>
+#include <cmd.h>
+#include <proc.h>
 
 int
 b_getconf(int argc, char** argv, void* context)
 {
-       register char*  name;
-       register char*  path;
-       register char*  value;
-       register char*  s;
-       char*           pattern;
-       int             all;
-       int             flags;
-
-       static char     empty[] = "-";
-
-       NoP(argc);
-       cmdinit(argv, context, ERROR_CATALOG, 0);
-       all = 0;
+       register char*          name;
+       register char*          path;
+       register char*          value;
+       register char*          s;
+       char*                   pattern;
+       char*                   native;
+       int                     flags;
+       char**                  oargv;
+       char                    cmd[PATH_MAX];
+
+       static const char       empty[] = "-";
+
+       cmdinit(argc, argv, context, ERROR_CATALOG, 0);
+       oargv = argv;
+       if (*(native = astconf("GETCONF", NiL, NiL)) != '/')
+               native = 0;
        flags = 0;
+       name = 0;
        pattern = 0;
        for (;;)
        {
                switch (optget(argv, usage))
                {
                case 'a':
-                       all = opt_info.num;
+                       if (native)
+                               goto defer;
                        continue;
                case 'b':
                        flags |= ASTCONF_base;
@@ -168,10 +181,16 @@
                case 't':
                        flags |= ASTCONF_table;
                        continue;
+               case 'v':
+                       if (native)
+                               goto defer;
+                       continue;
                case 'w':
                        flags |= ASTCONF_write;
                        continue;
                case ':':
+                       if (native)
+                               goto defer;
                        error(2, "%s", opt_info.arg);
                        break;
                case '?':
@@ -181,46 +200,70 @@
                break;
        }
        argv += opt_info.index;
-       if (error_info.errors || (name = *argv) && all)
-               error(ERROR_usage(2), "%s", optusage(NiL));
-       do
+       if (!(name = *argv))
+               path = 0;
+       else if (streq(name, empty))
        {
-               if (!name)
+               name = 0;
+               if (path = *++argv)
                {
-                       path = 0;
-                       value = 0;
+                       argv++;
+                       if (streq(path, empty))
+                               path = 0;
                }
-               else
+       }
+       if (error_info.errors || !name && *argv)
+               error(ERROR_usage(2), "%s", optusage(NiL));
+       if (!name)
+               astconflist(sfstdout, path, flags, pattern);
+       else
+       {
+               flags = native ? (ASTCONF_system|ASTCONF_error) : 0;
+               do
                {
-                       if (streq(name, empty))
-                               name = 0;
                        if (!(path = *++argv))
                                value = 0;
                        else
                        {
                                if (streq(path, empty))
+                               {
                                        path = 0;
+                                       flags = 0;
+                               }
                                if ((value = *++argv) && (streq(value, empty)))
+                               {
                                        value = 0;
+                                       flags = 0;
+                               }
                        }
-               }
-               if (!name)
-                       astconflist(sfstdout, path, flags, pattern);
-               else if (!(s = astgetconf(name, path, value, errorf)))
-               {
-                       error_info.errors++;
-                       break;
-               }
-               else if (!value)
-               {
-                       if (flags & X_OK)
+                       s = astgetconf(name, path, value, flags, errorf);
+                       if (error_info.errors)
+                               break;
+                       if (!s)
+                               goto defer;
+                       if (!value)
                        {
-                               sfputr(sfstdout, name, ' ');
-                               sfputr(sfstdout, path ? path : empty, ' ');
+                               if (flags & ASTCONF_write)
+                               {
+                                       sfputr(sfstdout, name, ' ');
+                                       sfputr(sfstdout, path ? path : empty, ' 
');
+                               }
+                               sfputr(sfstdout, *s ? s : "undefined", '\n');
                        }
-                       sfputr(sfstdout, *s ? s : "undefined", '\n');
-               }
-       } while (*argv && (name = *++argv));
-       error_info.flags &= ~ERROR_LIBRARY;
+               } while (*argv && (name = *++argv));
+       }
        return error_info.errors != 0;
+ defer:
+       if (!pathaccess(cmd, astconf("PATH", NiL, NiL), error_info.id, NiL, 
PATH_EXECUTE|PATH_REGULAR) &&
+           !pathaccess(cmd, "/usr/sbin:/sbin", error_info.id, NiL, 
PATH_EXECUTE|PATH_REGULAR))
+       {
+               if (name)
+                       error(3, "%s: unknown name -- no native getconf(1) to 
defer to", name);
+               else
+                       error(3, "no native getconf(1) to defer to");
+               flags = 2;
+       }
+       else if ((flags = procrun(cmd, oargv)) >= EXIT_NOEXEC)
+               error(ERROR_SYSTEM|2, "%s: exec error [%d]", cmd, flags);
+       return flags;
 }
diff -r -N -u ksh93_2006_09_12/src/lib/libcmd/head.c 
ksh93_2006_10_31/src/lib/libcmd/head.c
--- ksh93_2006_09_12/src/lib/libcmd/head.c      2005-05-17 15:12:13.000000000 
+0200
+++ ksh93_2006_10_31/src/lib/libcmd/head.c      2006-11-01 21:16:37.000000000 
+0100
@@ -27,7 +27,7 @@
  */
 
 static const char usage[] =
-"[-?\n@(#)$Id: head (AT&T Labs Research) 2005-05-17 $\n]"
+"[-?\n@(#)$Id: head (AT&T Research) 2006-09-27 $\n]"
 USAGE_LICENSE
 "[+NAME?head - output beginning portion of one or more files ]"
 "[+DESCRIPTION?\bhead\b copies one or more input files to standard "
@@ -65,12 +65,12 @@
 "[+SEE ALSO?\bcat\b(1), \btail\b(1)]"
 ;
 
-#include <cmdlib.h>
+#include <cmd.h>
 
 int
 b_head(int argc, register char** argv, void* context)
 {
-       static char header_fmt[] = "\n==> %s <==\n";
+       static const char       header_fmt[] = "\n==> %s <==\n";
 
        register Sfio_t*        fp;
        register char*          cp;
@@ -78,9 +78,9 @@
        register off_t          skip = 0;
        register int            delim = '\n';
        int                     header = 1;
-       char*                   format = header_fmt+1;
+       char*                   format = (char*)header_fmt+1;
 
-       cmdinit(argv, context, ERROR_CATALOG, 0);
+       cmdinit(argc, argv, context, ERROR_CATALOG, 0);
        for (;;)
        {
                switch (optget(argv, usage))
@@ -89,6 +89,11 @@
                        delim = -1;
                        /*FALLTHROUGH*/
                case 'n':
+                       if (opt_info.offset && 
argv[opt_info.index][opt_info.offset] == 'c')
+                       {
+                               delim = -1;
+                               opt_info.offset++;
+                       }
                        if ((keep = opt_info.number) <=0)
                                error(2, "%s: %I*d: positive numeric option 
argument expected", opt_info.name, sizeof(keep), keep);
                        continue;
@@ -131,7 +136,7 @@
                }
                if (argc > header)
                        sfprintf(sfstdout, format, cp);
-               format = header_fmt;
+               format = (char*)header_fmt;
                if (skip > 0)
                        sfmove(fp, NiL, skip, delim);
                if (sfmove(fp, sfstdout, keep, delim) < 0 && errno != EPIPE)
diff -r -N -u ksh93_2006_09_12/src/lib/libcmd/id.c 
ksh93_2006_10_31/src/lib/libcmd/id.c
--- ksh93_2006_09_12/src/lib/libcmd/id.c        2005-08-10 23:02:01.000000000 
+0200
+++ ksh93_2006_10_31/src/lib/libcmd/id.c        2006-11-01 21:16:40.000000000 
+0100
@@ -28,7 +28,7 @@
  */
 
 static const char usage[] =
-"[-?\n@(#)$Id: id (AT&T Labs Research) 2004-06-11 $\n]"
+"[-?\n@(#)$Id: id (AT&T Research) 2004-06-11 $\n]"
 USAGE_LICENSE
 "[+NAME?id - return user identity]"
 "[+DESCRIPTION?If no \auser\a operand is specified \bid\b writes user and "
@@ -59,7 +59,7 @@
 "[+SEE ALSO?\blogname\b(1), \bwho\b(1), \bgetgroups\b(2)]"
 ;
 
-#include <cmdlib.h>
+#include <cmd.h>
 
 #include "FEATURE/ids"
 
@@ -421,7 +421,7 @@
        register int    flags = 0;
        register int    n;
 
-       cmdinit(argv, context, ERROR_CATALOG, 0);
+       cmdinit(argc, argv, context, ERROR_CATALOG, 0);
        while (n = optget(argv, usage)) switch (n)
        {
        case 'a':
diff -r -N -u ksh93_2006_09_12/src/lib/libcmd/join.c 
ksh93_2006_10_31/src/lib/libcmd/join.c
--- ksh93_2006_09_12/src/lib/libcmd/join.c      2003-05-15 19:27:28.000000000 
+0200
+++ ksh93_2006_10_31/src/lib/libcmd/join.c      2006-11-02 16:39:53.000000000 
+0100
@@ -22,13 +22,13 @@
 /*
  * David Korn
  * Glenn Fowler
- * AT&T Labs Research
+ * AT&T Research
  *
  * join
  */
 
 static const char usage[] =
-"[-?\n@(#)$Id: join (AT&T Labs Research) 2003-05-15 $\n]"
+"[-?\n@(#)$Id: join (AT&T Research) 2006-10-31 $\n]"
 USAGE_LICENSE
 "[+NAME?join - relational database operator]"
 "[+DESCRIPTION?\bjoin\b performs an \aequality join\a on the files \afile1\a "
@@ -90,7 +90,7 @@
 "[+SEE ALSO?\bcut\b(1), \bcomm\b(1), \bpaste\b(1), \bsort\b(1), \buniq\b(1)]"
 ;
 
-#include <cmdlib.h>
+#include <cmd.h>
 #include <sfdisc.h>
 
 #define C_FILE1                001
@@ -105,10 +105,6 @@
 #define S_SPACE                2
 #define S_NL           3
 
-#if DEBUG_TRACE
-#define cmdinit(a,b,c,d)
-#endif
-
 typedef struct
 {
        Sfio_t*         iop;
@@ -121,6 +117,7 @@
        int             maxfields;
        int             spaces;
        int             hit;
+       int             discard;
        char**          fieldlist;
 } File_t;
 
@@ -140,11 +137,6 @@
        File_t          file[2];
 } Join_t;
 
-static struct State_s
-{
-       int             interrupt;
-} state;
-
 static void
 done(register Join_t* jp)
 {
@@ -268,7 +260,7 @@
  * read in a record from file <index> and split into fields
  */
 static unsigned char*
-getrec(Join_t* jp, int index)
+getrec(Join_t* jp, int index, int discard)
 {
        register unsigned char* sp = jp->state;
        register File_t*        fp = &jp->file[index];
@@ -277,8 +269,10 @@
        register char*          cp;
        register int            n = 0;
 
-       if (state.interrupt)
+       if (cmdquit())
                return 0;
+       if (discard && fp->discard)
+               sfraise(fp->iop, SFSK_DISCARD, NiL);
        fp->spaces = 0;
        fp->hit = 0;
        if (!(cp = sfgetr(fp->iop, '\n', 0)))
@@ -332,7 +326,7 @@
 
 #if DEBUG_TRACE
 static unsigned char* u1,u2,u3;
-#define getrec(p,n)    (u1 = getrec(p, n), sfprintf(sfstdout, 
"[g%d...@%i*d:%-.8s]", __LINE__, n, sizeof(Sfoff_t), sftell(p->file[n].iop), 
u1), u1)
+#define getrec(p,n,d)  (u1 = getrec(p, n, d), sfprintf(sfstdout, 
"[g%d...@%i*d:%-.8s]", __LINE__, n, sizeof(Sfoff_t), sftell(p->file[n].iop), 
u1), u1)
 #endif
 
 /*
@@ -487,7 +481,7 @@
        Sfoff_t                 lo = -1;
        Sfoff_t                 hi = -1;
 
-       if ((cp1 = getrec(jp, 0)) && (cp2 = getrec(jp, 1)) || (cp2 = 0))
+       if ((cp1 = getrec(jp, 0, 0)) && (cp2 = getrec(jp, 1, 0)) || (cp2 = 0))
        {
                n1 = jp->file[0].fieldlen;
                n2 = jp->file[1].fieldlen;
@@ -506,7 +500,7 @@
                        {
                                if (!(jp->outmode & C_COMMON))
                                {
-                                       if (cp1 = getrec(jp, 0))
+                                       if (cp1 = getrec(jp, 0, 1))
                                        {
                                                n1 = jp->file[0].fieldlen;
                                                same = 1;
@@ -514,7 +508,7 @@
                                        }
                                        if ((jp->ooutmode & (C_FILE1|C_FILE2)) 
!= C_FILE2)
                                                break;
-                                       if (sfseek(jp->file[0].iop, 
(Sfoff_t)-jp->file[0].reclen, SEEK_CUR) < 0 || !(cp1 = getrec(jp, 0)))
+                                       if (sfseek(jp->file[0].iop, 
(Sfoff_t)-jp->file[0].reclen, SEEK_CUR) < 0 || !(cp1 = getrec(jp, 0, 0)))
                                        {
                                                error(ERROR_SYSTEM|2, "%s: seek 
error", jp->file[0].name);
                                                return -1;
@@ -531,7 +525,7 @@
                                        }
                                        lo -= jp->file[1].reclen;
                                }
-                               if (cp2 = getrec(jp, 1))
+                               if (cp2 = getrec(jp, 1, lo < 0))
                                {
                                        n2 = jp->file[1].fieldlen;
                                        continue;
@@ -556,7 +550,7 @@
                                                }
                                        }
                                        memcpy(jp->same, cp2, o2 = n2);
-                                       if (!(cp2 = getrec(jp, 1)))
+                                       if (!(cp2 = getrec(jp, 1, 0)))
                                                break;
                                        n2 = jp->file[1].fieldlen;
                                        if (n2 == o2 && *cp2 == *jp->same && 
!memcmp(cp2, jp->same, n2))
@@ -575,7 +569,7 @@
                                else if ((jp->outmode & C_FILE2) && outrec(jp, 
1) < 0)
                                        return -1;
                                lo = -1;
-                               if (cp2 = getrec(jp, 1))
+                               if (cp2 = getrec(jp, 1, 1))
                                {
                                        n2 = jp->file[1].fieldlen;
                                        continue;
@@ -587,28 +581,31 @@
                        else if (same)
                        {
                                same = 0;
-                               if (!(cp1 = getrec(jp, 0)))
+                               if (!(cp1 = getrec(jp, 0, 0)))
                                        break;
                                n1 = jp->file[0].fieldlen;
                                continue;
                        }
                        if (lo >= 0)
                        {
-                               hi = sfseek(jp->file[1].iop, (Sfoff_t)0, 
SEEK_CUR) - jp->file[1].reclen;
-                               if (sfseek(jp->file[1].iop, lo, SEEK_SET) != lo 
|| !(cp2 = getrec(jp, 1)))
+                               if ((hi = sfseek(jp->file[1].iop, (Sfoff_t)0, 
SEEK_CUR)) < 0 ||
+                                   (hi -= jp->file[1].reclen) < 0 ||
+                                   sfseek(jp->file[1].iop, lo, SEEK_SET) != lo 
||
+                                   !(cp2 = getrec(jp, 1, 0)))
                                {
                                        error(ERROR_SYSTEM|2, "%s: seek error", 
jp->file[1].name);
                                        return -1;
                                }
-                               else
-                                       n2 = jp->file[1].fieldlen;
+                               n2 = jp->file[1].fieldlen;
                                lo = -1;
+                               if (jp->file[1].discard)
+                                       sfseek(jp->file[1].iop, (Sfoff_t)-1, 
SEEK_SET);
                        }
                        else if (!cp2)
                                break;
                        else if ((jp->outmode & C_FILE1) && outrec(jp, -1) < 0)
                                return -1;
-                       if (!(cp1 = getrec(jp, 0)))
+                       if (!(cp1 = getrec(jp, 0, 1)))
                                break;
                        n1 = jp->file[0].fieldlen;
                }
@@ -628,7 +625,7 @@
 #if DEBUG_TRACE
 sfprintf(sfstdout, "[O#%d:%02o:%02o]", __LINE__, jp->ooutmode, jp->outmode);
 #endif
-               cp1 = (!cp1 && cmp && hi < 0 && !jp->file[1].hit && 
((jp->ooutmode ^ C_ALL) <= 1 || jp->outmode == 2)) ? cp2 : getrec(jp, 1);
+               cp1 = (!cp1 && cmp && hi < 0 && !jp->file[1].hit && 
((jp->ooutmode ^ C_ALL) <= 1 || jp->outmode == 2)) ? cp2 : getrec(jp, 1, 0);
                cmp = 1;
                n = 1;
        }
@@ -643,14 +640,14 @@
        if (!cp1 || !(jp->outmode & (1<<n)))
        {
                if (cp1 && jp->file[n].iop == sfstdin)
-                       sfseek(sfstdin, 0L, SEEK_END);
+                       sfseek(sfstdin, (Sfoff_t)0, SEEK_END);
                return 0;
        }
        if (outrec(jp, cmp) < 0)
                return -1;
        do
        {
-               if (!getrec(jp, n))
+               if (!getrec(jp, n, 1))
                        return 0;
        } while (outrec(jp, cmp) >= 0);
        return -1;
@@ -661,16 +658,12 @@
 {
        register int            n;
        register char*          cp;
-       register Join_t*        jp = init();
+       register Join_t*        jp;
        char*                   e;
 
-       if (argc < 0)
-       {
-               state.interrupt = 1;
-               return 1;
-       }
-       state.interrupt = 0;
-       cmdinit(argv, context, ERROR_CATALOG, ERROR_NOTIFY);
+#if !DEBUG_TRACE
+       cmdinit(argc, argv, context, ERROR_CATALOG, ERROR_NOTIFY);
+#endif
        if (!(jp = init()))
                error(ERROR_system(1),"out of space");
        for (;;)
@@ -771,8 +764,13 @@
        jp->file[0].name = cp = *argv++;
        if (streq(cp,"-"))
        {
-               if (sfdcseekable(sfstdin))
-                       error(ERROR_warn(0),"%s: seek may fail",cp);
+               if (sfseek(sfstdin,(Sfoff_t)0,SEEK_CUR) < 0)
+               {
+                       if (sfdcseekable(sfstdin))
+                               error(ERROR_warn(0),"%s: seek may fail",cp);
+                       else
+                               jp->file[0].discard = 1;
+               }
                jp->file[0].iop = sfstdin;
        }
        else if (!(jp->file[0].iop = sfopen(NiL, cp, "r")))
@@ -783,8 +781,13 @@
        jp->file[1].name = cp = *argv;
        if (streq(cp,"-"))
        {
-               if (sfdcseekable(sfstdin))
-                       error(ERROR_warn(0),"%s: seek may fail",cp);
+               if (sfseek(sfstdin,(Sfoff_t)0,SEEK_CUR) < 0)
+               {
+                       if (sfdcseekable(sfstdin))
+                               error(ERROR_warn(0),"%s: seek may fail",cp);
+                       else
+                               jp->file[1].discard = 1;
+               }
                jp->file[1].iop = sfstdin;
        }
        else if (!(jp->file[1].iop = sfopen(NiL, cp, "r")))
@@ -807,7 +810,7 @@
                error(ERROR_system(1),"write error");
        }
        else if (jp->file[0].iop==sfstdin || jp->file[1].iop==sfstdin)
-               sfseek(sfstdin,0L,SEEK_END);
+               sfseek(sfstdin,(Sfoff_t)0,SEEK_END);
        done(jp);
        return error_info.errors;
 }
diff -r -N -u ksh93_2006_09_12/src/lib/libcmd/logname.c 
ksh93_2006_10_31/src/lib/libcmd/logname.c
--- ksh93_2006_09_12/src/lib/libcmd/logname.c   2002-11-14 22:32:16.000000000 
+0100
+++ ksh93_2006_10_31/src/lib/libcmd/logname.c   2006-11-01 21:16:46.000000000 
+0100
@@ -27,7 +27,7 @@
  */
 
 static const char usage[] =
-"[-?\n@(#)$Id: logname (AT&T Labs Research) 1999-04-30 $\n]"
+"[-?\n@(#)$Id: logname (AT&T Research) 1999-04-30 $\n]"
 USAGE_LICENSE
 "[+NAME?logname - return the user's login name]"
 "[+DESCRIPTION?\blogname\b writes the users's login name to standard "
@@ -47,15 +47,14 @@
 ;
 
 
-#include <cmdlib.h>
+#include <cmd.h>
 
 int
 b_logname(int argc, char** argv, void* context)
 {
        register char*  logname;
 
-       NoP(argc);
-       cmdinit(argv, context, ERROR_CATALOG, 0);
+       cmdinit(argc, argv, context, ERROR_CATALOG, 0);
        for (;;)
        {
                switch (optget(argv, usage))
diff -r -N -u ksh93_2006_09_12/src/lib/libcmd/Makefile 
ksh93_2006_10_31/src/lib/libcmd/Makefile
--- ksh93_2006_09_12/src/lib/libcmd/Makefile    2005-04-11 17:04:17.000000000 
+0200
+++ ksh93_2006_10_31/src/lib/libcmd/Makefile    2006-11-01 21:25:14.000000000 
+0100
@@ -13,14 +13,14 @@
 
 HOSTTYPE == "$(CC.HOSTTYPE)"
 
-cmd 1.2 :LIBRARY: RELEASE cmdinit.c cmdrecurse.c \
-       cmd.h cmdlib.h wc.h \
+cmd 1.2 :LIBRARY: RELEASE cmdinit.c \
+       cmd.h rev.h wc.h \
        basename.c cat.c chgrp.c chmod.c chown.c cmp.c comm.c \
        cp.c cut.c dirname.c date.c expr.c fds.c fmt.c fold.c \
        getconf.c head.c id.c join.c ln.c logname.c mkdir.c \
        mkfifo.c mv.c paste.c pathchk.c rev.c rm.c rmdir.c \
-       stty.c tail.c tee.c tty.c uname.c uniq.c wc.c revlib.c \
-       wclib.c \
+       stty.c sync.c tail.c tee.c tty.c uname.c uniq.c wc.c \
+       revlib.c wclib.c \
        -lfsg
 
 $(INCLUDEDIR) :INSTALLPROTO: cmd.h cmdext.h cmdlist.h
diff -r -N -u ksh93_2006_09_12/src/lib/libcmd/Mamfile 
ksh93_2006_10_31/src/lib/libcmd/Mamfile
--- ksh93_2006_09_12/src/lib/libcmd/Mamfile     2006-09-13 06:39:09.000000000 
+0200
+++ ksh93_2006_10_31/src/lib/libcmd/Mamfile     2006-11-03 03:05:45.000000000 
+0100
@@ -69,154 +69,124 @@
 done cmd.req generated
 make cmdinit.o
 make cmdinit.c
-make cmdlib.h implicit
-make ${PACKAGE_ast_INCLUDE}/stak.h implicit
-make ${PACKAGE_ast_INCLUDE}/stk.h implicit
-make ${PACKAGE_ast_INCLUDE}/sfio.h implicit
-make ${PACKAGE_ast_INCLUDE}/sfio_s.h implicit
-done ${PACKAGE_ast_INCLUDE}/sfio_s.h dontcare
+make cmd.h implicit
+make ${PACKAGE_ast_INCLUDE}/dlldefs.h implicit
+done ${PACKAGE_ast_INCLUDE}/dlldefs.h dontcare ignore
+make cmdext.h implicit
+prev cmdinit.c
+make basename.c
+prev cmd.h implicit
+done basename.c
+make cat.c
+prev cmd.h implicit
+done cat.c
+make chgrp.c
+make FEATURE/symlink implicit
+meta FEATURE/symlink features/%>FEATURE/% features/symlink symlink
+make features/symlink
+done features/symlink
+prev cmd.req
+bind -last
+exec - iffe -v -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '  ref 
${mam_cc_L+-L${INSTALLROOT}/lib} -I${PACKAGE_ast_INCLUDE} 
-I${INSTALLROOT}/include ${mam_libast} ${mam_libast}  : run features/symlink
+done FEATURE/symlink generated
+make ${PACKAGE_ast_INCLUDE}/fts.h implicit
+make ${PACKAGE_ast_INCLUDE}/ls.h implicit
+make ${PACKAGE_ast_INCLUDE}/ast_mode.h implicit
+done ${PACKAGE_ast_INCLUDE}/ast_mode.h dontcare
+make ${PACKAGE_ast_INCLUDE}/ast_fs.h implicit
+make error?--?old?ethernet?address?at?wrong?offset implicit
+done error?--?old?ethernet?address?at?wrong?offset dontcare virtual
+done ${PACKAGE_ast_INCLUDE}/ast_fs.h dontcare
+make ${PACKAGE_ast_INCLUDE}/ast_std.h implicit
+make ${PACKAGE_ast_INCLUDE}/regex.h implicit
 make ${PACKAGE_ast_INCLUDE}/ast_common.h implicit
 make ${PACKAGE_ast_INCLUDE}/ast_map.h implicit
 done ${PACKAGE_ast_INCLUDE}/ast_map.h dontcare
 done ${PACKAGE_ast_INCLUDE}/ast_common.h dontcare
-make ${PACKAGE_ast_INCLUDE}/ast_std.h implicit
-make ${PACKAGE_ast_INCLUDE}/ast_botch.h implicit
-done ${PACKAGE_ast_INCLUDE}/ast_botch.h dontcare
-make ${PACKAGE_ast_INCLUDE}/ast_unistd.h implicit
-done ${PACKAGE_ast_INCLUDE}/ast_unistd.h dontcare
-make ${PACKAGE_ast_INCLUDE}/re_comp.h implicit
 make ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
 make ${INSTALLROOT}/include/prototyped.h implicit
 done ${INSTALLROOT}/include/prototyped.h dontcare
 done ${PACKAGE_ast_INCLUDE}/prototyped.h dontcare
-done ${PACKAGE_ast_INCLUDE}/re_comp.h dontcare
-make ${PACKAGE_ast_INCLUDE}/getopt.h implicit
+done ${PACKAGE_ast_INCLUDE}/regex.h dontcare
+prev ${PACKAGE_ast_INCLUDE}/ast_map.h implicit
+make ${PACKAGE_ast_INCLUDE}/ast_botch.h implicit
+done ${PACKAGE_ast_INCLUDE}/ast_botch.h dontcare
+make ${PACKAGE_ast_INCLUDE}/ast_limits.h implicit
+done ${PACKAGE_ast_INCLUDE}/ast_limits.h dontcare
+make ${PACKAGE_ast_INCLUDE}/ast_fcntl.h implicit
+prev ${PACKAGE_ast_INCLUDE}/ast_fs.h implicit
+done ${PACKAGE_ast_INCLUDE}/ast_fcntl.h dontcare
 make ${PACKAGE_ast_INCLUDE}/ast_getopt.h implicit
 prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
 done ${PACKAGE_ast_INCLUDE}/ast_getopt.h dontcare
+make ${PACKAGE_ast_INCLUDE}/ast_sys.h implicit
+make ${PACKAGE_ast_INCLUDE}/re_comp.h implicit
 prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
-done ${PACKAGE_ast_INCLUDE}/getopt.h dontcare
-make ${PACKAGE_ast_INCLUDE}/ast_fcntl.h implicit
-make ${PACKAGE_ast_INCLUDE}/ls.h implicit
-make ${PACKAGE_ast_INCLUDE}/ast_mode.h implicit
-done ${PACKAGE_ast_INCLUDE}/ast_mode.h dontcare
-make ${PACKAGE_ast_INCLUDE}/ast_fs.h implicit
-make error?--?old?ethernet?address?at?wrong?offset implicit
-done error?--?old?ethernet?address?at?wrong?offset dontcare virtual
-done ${PACKAGE_ast_INCLUDE}/ast_fs.h dontcare
-prev ${PACKAGE_ast_INCLUDE}/ast_std.h implicit
+done ${PACKAGE_ast_INCLUDE}/re_comp.h dontcare
+make ${PACKAGE_ast_INCLUDE}/getopt.h implicit
+prev ${PACKAGE_ast_INCLUDE}/ast_getopt.h implicit
 prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
-done ${PACKAGE_ast_INCLUDE}/ls.h dontcare
-prev ${PACKAGE_ast_INCLUDE}/ast_fs.h implicit
-done ${PACKAGE_ast_INCLUDE}/ast_fcntl.h dontcare
-make ${PACKAGE_ast_INCLUDE}/ast_types.h implicit
-done ${PACKAGE_ast_INCLUDE}/ast_types.h dontcare
-prev ${PACKAGE_ast_INCLUDE}/ast_map.h implicit
+done ${PACKAGE_ast_INCLUDE}/getopt.h dontcare
 make ${PACKAGE_ast_INCLUDE}/stdio.h implicit
 make ${PACKAGE_ast_INCLUDE}/ast_stdio.h implicit
-prev ${PACKAGE_ast_INCLUDE}/sfio_s.h implicit
-prev ${PACKAGE_ast_INCLUDE}/ast_common.h implicit
+make ${PACKAGE_ast_INCLUDE}/sfio_s.h implicit
+done ${PACKAGE_ast_INCLUDE}/sfio_s.h dontcare
+prev ${PACKAGE_ast_INCLUDE}/ast_std.h implicit
 done ${PACKAGE_ast_INCLUDE}/ast_stdio.h dontcare
 done ${PACKAGE_ast_INCLUDE}/stdio.h dontcare
 prev ${PACKAGE_ast_INCLUDE}/getopt.h implicit
-make ${PACKAGE_ast_INCLUDE}/limits.h implicit
-make ${PACKAGE_ast_INCLUDE}/ast_limits.h implicit
-done ${PACKAGE_ast_INCLUDE}/ast_limits.h dontcare
-done ${PACKAGE_ast_INCLUDE}/limits.h dontcare
-make ${PACKAGE_ast_INCLUDE}/ast_hdr.h implicit
-done ${PACKAGE_ast_INCLUDE}/ast_hdr.h dontcare
-prev ${PACKAGE_ast_INCLUDE}/ast_getopt.h implicit
+done ${PACKAGE_ast_INCLUDE}/ast_sys.h dontcare
 make ${PACKAGE_ast_INCLUDE}/ast_lib.h implicit
 done ${PACKAGE_ast_INCLUDE}/ast_lib.h dontcare
 prev ${PACKAGE_ast_INCLUDE}/ast_common.h implicit
 prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
 done ${PACKAGE_ast_INCLUDE}/ast_std.h dontcare
-done ${PACKAGE_ast_INCLUDE}/sfio.h dontcare
-prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
-done ${PACKAGE_ast_INCLUDE}/stk.h dontcare
-prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
-done ${PACKAGE_ast_INCLUDE}/stak.h dontcare
-make ${PACKAGE_ast_INCLUDE}/error.h implicit
-make ${PACKAGE_ast_INCLUDE}/option.h implicit
-make ${PACKAGE_ast_INCLUDE}/ast.h implicit
-make ${PACKAGE_ast_INCLUDE}/vmalloc.h implicit
-prev ${PACKAGE_ast_INCLUDE}/ast_common.h implicit
-prev ${PACKAGE_ast_INCLUDE}/ast_std.h implicit
-done ${PACKAGE_ast_INCLUDE}/vmalloc.h dontcare
-prev ${PACKAGE_ast_INCLUDE}/sfio.h implicit
-prev ${PACKAGE_ast_INCLUDE}/ast_std.h implicit
-make ${PACKAGE_ast_INCLUDE}/ast_version.h implicit
-prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
-done ${PACKAGE_ast_INCLUDE}/ast_version.h dontcare
-prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
-done ${PACKAGE_ast_INCLUDE}/ast.h dontcare
-prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
-done ${PACKAGE_ast_INCLUDE}/option.h dontcare
-prev ${PACKAGE_ast_INCLUDE}/ast.h implicit
-prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
-done ${PACKAGE_ast_INCLUDE}/error.h dontcare
-make cmd.h implicit
-make ${PACKAGE_ast_INCLUDE}/dlldefs.h implicit
-done ${PACKAGE_ast_INCLUDE}/dlldefs.h dontcare ignore
-make cmdext.h implicit
-prev cmdinit.c
-make cmdrecurse.c
-make ${PACKAGE_ast_INCLUDE}/ftwalk.h implicit
-make ${PACKAGE_ast_INCLUDE}/fts.h implicit
-prev ${PACKAGE_ast_INCLUDE}/ls.h implicit
 prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
-done ${PACKAGE_ast_INCLUDE}/fts.h dontcare
-prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
-done ${PACKAGE_ast_INCLUDE}/ftwalk.h
-make ${PACKAGE_ast_INCLUDE}/proc.h implicit
-prev ${PACKAGE_ast_INCLUDE}/ast.h implicit
+done ${PACKAGE_ast_INCLUDE}/ls.h dontcare
 prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
-done ${PACKAGE_ast_INCLUDE}/proc.h
-prev cmdlib.h implicit
-done cmdrecurse.c
-make basename.c
-prev cmdlib.h implicit
-done basename.c
-make cat.c
-prev cmdlib.h implicit
-done cat.c
-make chgrp.c
-make FEATURE/symlink implicit
-meta FEATURE/symlink features/%>FEATURE/% features/symlink symlink
-make features/symlink
-done features/symlink
-prev cmd.req
-bind -last
-exec - iffe -v -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '  ref 
${mam_cc_L+-L${INSTALLROOT}/lib} -I${PACKAGE_ast_INCLUDE} 
-I${INSTALLROOT}/include ${mam_libast} ${mam_libast} : run features/symlink
-done FEATURE/symlink generated
-prev ${PACKAGE_ast_INCLUDE}/fts.h implicit
+done ${PACKAGE_ast_INCLUDE}/fts.h
 prev ${PACKAGE_ast_INCLUDE}/ls.h implicit
 make ${PACKAGE_ast_INCLUDE}/cdt.h implicit
 prev ${PACKAGE_ast_INCLUDE}/ast_common.h implicit
 prev ${PACKAGE_ast_INCLUDE}/ast_std.h implicit
 done ${PACKAGE_ast_INCLUDE}/cdt.h
-prev cmdlib.h implicit
+prev cmd.h implicit
 done chgrp.c
 make chmod.c
 prev FEATURE/symlink implicit
 prev ${PACKAGE_ast_INCLUDE}/fts.h implicit
 prev ${PACKAGE_ast_INCLUDE}/ls.h implicit
-prev cmdlib.h implicit
+prev cmd.h implicit
 done chmod.c
 make chown.c
-prev cmdlib.h implicit
+prev cmd.h implicit
 done chown.c
 make cmp.c
 prev ${PACKAGE_ast_INCLUDE}/ls.h implicit
-prev cmdlib.h implicit
+prev cmd.h implicit
 done cmp.c
 make comm.c
-prev cmdlib.h implicit
+prev cmd.h implicit
 done comm.c
 make cp.c
 make ${PACKAGE_ast_INCLUDE}/tmx.h implicit
 make ${PACKAGE_ast_INCLUDE}/tv.h implicit
-prev ${PACKAGE_ast_INCLUDE}/ast.h implicit
+make ${PACKAGE_ast_INCLUDE}/ast.h implicit
+make ${PACKAGE_ast_INCLUDE}/vmalloc.h implicit
+prev ${PACKAGE_ast_INCLUDE}/ast_common.h implicit
+prev ${PACKAGE_ast_INCLUDE}/ast_std.h implicit
+done ${PACKAGE_ast_INCLUDE}/vmalloc.h dontcare
+make ${PACKAGE_ast_INCLUDE}/sfio.h implicit
+prev ${PACKAGE_ast_INCLUDE}/sfio_s.h implicit
+prev ${PACKAGE_ast_INCLUDE}/ast_common.h implicit
+prev ${PACKAGE_ast_INCLUDE}/ast_std.h implicit
+done ${PACKAGE_ast_INCLUDE}/sfio.h dontcare
+prev ${PACKAGE_ast_INCLUDE}/ast_std.h implicit
+make ${PACKAGE_ast_INCLUDE}/ast_version.h implicit
+prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
+done ${PACKAGE_ast_INCLUDE}/ast_version.h dontcare
+prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
+done ${PACKAGE_ast_INCLUDE}/ast.h dontcare
 done ${PACKAGE_ast_INCLUDE}/tv.h dontcare
 make ${PACKAGE_ast_INCLUDE}/tm.h implicit
 make ${PACKAGE_ast_INCLUDE}/times.h implicit
@@ -229,7 +199,10 @@
 prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
 done ${PACKAGE_ast_INCLUDE}/tm.h dontcare
 done ${PACKAGE_ast_INCLUDE}/tmx.h
-prev ${PACKAGE_ast_INCLUDE}/stk.h implicit
+make ${PACKAGE_ast_INCLUDE}/stk.h implicit
+prev ${PACKAGE_ast_INCLUDE}/sfio.h implicit
+prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
+done ${PACKAGE_ast_INCLUDE}/stk.h
 make ${PACKAGE_ast_INCLUDE}/hashkey.h implicit
 prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
 done ${PACKAGE_ast_INCLUDE}/hashkey.h
@@ -237,29 +210,29 @@
 prev ${PACKAGE_ast_INCLUDE}/ast_fs.h implicit
 prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
 done ${PACKAGE_ast_INCLUDE}/fs3d.h
-prev ${PACKAGE_ast_INCLUDE}/ftwalk.h implicit
+prev ${PACKAGE_ast_INCLUDE}/fts.h implicit
 prev ${PACKAGE_ast_INCLUDE}/times.h implicit
 prev ${PACKAGE_ast_INCLUDE}/ls.h implicit
 prev cmd.h implicit
 done cp.c
 make cut.c
-prev cmdlib.h implicit
+prev cmd.h implicit
 done cut.c
 make dirname.c
-prev cmdlib.h implicit
+prev cmd.h implicit
 done dirname.c
 make date.c
 prev ${PACKAGE_ast_INCLUDE}/times.h implicit
 prev ${PACKAGE_ast_INCLUDE}/tmx.h implicit
-prev ${PACKAGE_ast_INCLUDE}/proc.h implicit
+make ${PACKAGE_ast_INCLUDE}/proc.h implicit
+prev ${PACKAGE_ast_INCLUDE}/ast.h implicit
+prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
+done ${PACKAGE_ast_INCLUDE}/proc.h
 prev ${PACKAGE_ast_INCLUDE}/ls.h implicit
-prev cmdlib.h implicit
+prev cmd.h implicit
 done date.c
 make expr.c
-make ${PACKAGE_ast_INCLUDE}/regex.h implicit
-prev ${PACKAGE_ast_INCLUDE}/ast_common.h implicit
-prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
-done ${PACKAGE_ast_INCLUDE}/regex.h
+prev ${PACKAGE_ast_INCLUDE}/regex.h implicit
 prev cmd.h implicit
 done expr.c
 make fds.c
@@ -268,22 +241,23 @@
 make features/sockets
 done features/sockets
 prev cmd.req
-exec - iffe -v -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '  ref 
${mam_cc_L+-L${INSTALLROOT}/lib} -I${PACKAGE_ast_INCLUDE} 
-I${INSTALLROOT}/include ${mam_libast} ${mam_libast} : run features/sockets
+exec - iffe -v -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '  ref 
${mam_cc_L+-L${INSTALLROOT}/lib} -I${PACKAGE_ast_INCLUDE} 
-I${INSTALLROOT}/include ${mam_libast} ${mam_libast}  : run features/sockets
 done FEATURE/sockets generated
 prev ${PACKAGE_ast_INCLUDE}/ls.h implicit
-prev cmdlib.h implicit
+prev cmd.h implicit
 done fds.c
 make fmt.c
-prev cmdlib.h implicit
+prev cmd.h implicit
 done fmt.c
 make fold.c
-prev cmdlib.h implicit
+prev cmd.h implicit
 done fold.c
 make getconf.c
-prev cmdlib.h implicit
+prev ${PACKAGE_ast_INCLUDE}/proc.h implicit
+prev cmd.h implicit
 done getconf.c
 make head.c
-prev cmdlib.h implicit
+prev cmd.h implicit
 done head.c
 make id.c
 make fsg.h implicit
@@ -295,52 +269,54 @@
 make features/ids
 done features/ids
 prev cmd.req
-exec - iffe -v -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '  ref 
${mam_cc_L+-L${INSTALLROOT}/lib} -I${PACKAGE_ast_INCLUDE} 
-I${INSTALLROOT}/include ${mam_libast} ${mam_libast} : run features/ids
+exec - iffe -v -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '  ref 
${mam_cc_L+-L${INSTALLROOT}/lib} -I${PACKAGE_ast_INCLUDE} 
-I${INSTALLROOT}/include ${mam_libast} ${mam_libast}  : run features/ids
 done FEATURE/ids generated
-prev cmdlib.h implicit
+prev cmd.h implicit
 done id.c
 make join.c
 make ${PACKAGE_ast_INCLUDE}/sfdisc.h implicit
 prev ${PACKAGE_ast_INCLUDE}/ast.h implicit
 prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
 done ${PACKAGE_ast_INCLUDE}/sfdisc.h
-prev cmdlib.h implicit
+prev cmd.h implicit
 done join.c
 make ln.c
 prev cmd.h implicit
 done ln.c
 make logname.c
-prev cmdlib.h implicit
+prev cmd.h implicit
 done logname.c
 make mkdir.c
 prev ${PACKAGE_ast_INCLUDE}/ls.h implicit
-prev cmdlib.h implicit
+prev cmd.h implicit
 done mkdir.c
 make mkfifo.c
 prev ${PACKAGE_ast_INCLUDE}/ls.h implicit
-prev cmdlib.h implicit
+prev cmd.h implicit
 done mkfifo.c
 make mv.c
 prev cmd.h implicit
 done mv.c
 make paste.c
-prev cmdlib.h implicit
+prev cmd.h implicit
 done paste.c
 make pathchk.c
 prev ${PACKAGE_ast_INCLUDE}/ls.h implicit
-prev cmdlib.h implicit
+prev cmd.h implicit
 done pathchk.c
 make rev.c
-prev cmdlib.h implicit
+make rev.h implicit
+done rev.h
+prev cmd.h implicit
 done rev.c
 make rm.c
 prev ${PACKAGE_ast_INCLUDE}/fs3d.h implicit
-prev ${PACKAGE_ast_INCLUDE}/ftwalk.h implicit
+prev ${PACKAGE_ast_INCLUDE}/fts.h implicit
 prev ${PACKAGE_ast_INCLUDE}/ls.h implicit
-prev cmdlib.h implicit
+prev cmd.h implicit
 done rm.c
 make rmdir.c
-prev cmdlib.h implicit
+prev cmd.h implicit
 done rmdir.c
 make stty.c
 make ${PACKAGE_ast_INCLUDE}/ast_tty.h implicit
@@ -351,23 +327,26 @@
 prev ${PACKAGE_ast_INCLUDE}/ast.h implicit
 prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
 done ${PACKAGE_ast_INCLUDE}/ccode.h
-prev ${PACKAGE_ast_INCLUDE}/error.h implicit
-prev ${PACKAGE_ast_INCLUDE}/ast.h implicit
 prev cmd.h implicit
 done stty.c
+make sync.c
+prev ${PACKAGE_ast_INCLUDE}/ls.h implicit
+prev cmd.h implicit
+done sync.c
 make tail.c
+prev rev.h implicit
 prev ${PACKAGE_ast_INCLUDE}/tm.h implicit
 prev ${PACKAGE_ast_INCLUDE}/ls.h implicit
-prev cmdlib.h implicit
+prev cmd.h implicit
 done tail.c
 make tee.c
 make ${PACKAGE_ast_INCLUDE}/sig.h implicit
 done ${PACKAGE_ast_INCLUDE}/sig.h
 prev ${PACKAGE_ast_INCLUDE}/ls.h implicit
-prev cmdlib.h implicit
+prev cmd.h implicit
 done tee.c
 make tty.c
-prev cmdlib.h implicit
+prev cmd.h implicit
 done tty.c
 make uname.c
 make FEATURE/utsname implicit
@@ -375,23 +354,24 @@
 make features/utsname
 done features/utsname
 prev cmd.req
-exec - iffe -v -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '  ref 
${mam_cc_L+-L${INSTALLROOT}/lib} -I${PACKAGE_ast_INCLUDE} 
-I${INSTALLROOT}/include ${mam_libast} ${mam_libast} : run features/utsname
+exec - iffe -v -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '  ref 
${mam_cc_L+-L${INSTALLROOT}/lib} -I${PACKAGE_ast_INCLUDE} 
-I${INSTALLROOT}/include ${mam_libast} ${mam_libast}  : run features/utsname
 done FEATURE/utsname generated
 prev ${PACKAGE_ast_INCLUDE}/proc.h implicit
-prev cmdlib.h implicit
+prev cmd.h implicit
 done uname.c
 make uniq.c
-prev cmdlib.h implicit
+prev cmd.h implicit
 done uniq.c
 make wc.c
 prev ${PACKAGE_ast_INCLUDE}/ls.h implicit
 make wc.h implicit
 prev ${PACKAGE_ast_INCLUDE}/ast.h implicit
 done wc.h
-prev cmdlib.h implicit
+prev cmd.h implicit
 done wc.c
 make revlib.c
-prev cmdlib.h implicit
+prev rev.h implicit
+prev cmd.h implicit
 done revlib.c
 make wclib.c
 make ${PACKAGE_ast_INCLUDE}/wchar.h implicit
@@ -402,7 +382,7 @@
 done ${PACKAGE_ast_INCLUDE}/ast_wchar.h dontcare
 done ${PACKAGE_ast_INCLUDE}/wchar.h dontcare
 prev wc.h implicit
-prev cmdlib.h implicit
+prev cmd.h implicit
 done wclib.c
 exec - {
 exec - cat <<!
@@ -417,7 +397,7 @@
 exec -         -e 's/^b_//' \
 exec -         -e 's/(.*//' \
 exec -         -e 's/.*/extern int     b_&(int, char**, void*);/' \
-exec -         cmdinit.c cmdrecurse.c basename.c cat.c chgrp.c chmod.c chown.c 
cmp.c comm.c cp.c cut.c dirname.c date.c expr.c fds.c fmt.c fold.c getconf.c 
head.c id.c join.c ln.c logname.c mkdir.c mkfifo.c mv.c paste.c pathchk.c rev.c 
rm.c rmdir.c stty.c tail.c tee.c tty.c uname.c uniq.c wc.c revlib.c wclib.c |
+exec -         cmdinit.c basename.c cat.c chgrp.c chmod.c chown.c cmp.c comm.c 
cp.c cut.c dirname.c date.c expr.c fds.c fmt.c fold.c getconf.c head.c id.c 
join.c ln.c logname.c mkdir.c mkfifo.c mv.c paste.c pathchk.c rev.c rm.c 
rmdir.c stty.c sync.c tail.c tee.c tty.c uname.c uniq.c wc.c revlib.c wclib.c |
 exec - sort -u
 exec - } > 1.${COTEMP}.h
 exec - if      cmp 2>/dev/null -s 1.${COTEMP}.h cmdext.h
@@ -425,34 +405,36 @@
 exec - else    mv 1.${COTEMP}.h cmdext.h
 exec - fi
 done cmdext.h dontcare generated
-prev ${PACKAGE_ast_INCLUDE}/stak.h implicit
-prev ${PACKAGE_ast_INCLUDE}/error.h implicit
+make ${PACKAGE_ast_INCLUDE}/stak.h implicit
+prev ${PACKAGE_ast_INCLUDE}/stk.h implicit
+prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
+done ${PACKAGE_ast_INCLUDE}/stak.h dontcare
+make ${PACKAGE_ast_INCLUDE}/error.h implicit
+make ${PACKAGE_ast_INCLUDE}/option.h implicit
 prev ${PACKAGE_ast_INCLUDE}/ast.h implicit
-done cmd.h
+prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
+done ${PACKAGE_ast_INCLUDE}/option.h dontcare
+prev ${PACKAGE_ast_INCLUDE}/ast.h implicit
+prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
+done ${PACKAGE_ast_INCLUDE}/error.h dontcare
 prev ${PACKAGE_ast_INCLUDE}/ast.h implicit
-done cmdlib.h
+done cmd.h
 done cmdinit.c
 meta cmdinit.o %.c>%.o cmdinit.c cmdinit
 prev cmdinit.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-D_PACKAGE_ast -D_BLD_cmd -c cmdinit.c
+exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-D_BLD_cmd -D_PACKAGE_ast -c cmdinit.c
 done cmdinit.o generated
-make cmdrecurse.o
-prev cmdrecurse.c
-meta cmdrecurse.o %.c>%.o cmdrecurse.c cmdrecurse
-prev cmdrecurse.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-D_PACKAGE_ast -D_BLD_cmd -c cmdrecurse.c
-done cmdrecurse.o generated
 make basename.o
 prev basename.c
 meta basename.o %.c>%.o basename.c basename
 prev basename.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-DERROR_CATALOG=\""libcmd"\" -D_PACKAGE_ast -D_BLD_cmd 
-DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf at 
research.att.com>][-author?David Korn <dgk at 
research.att.com>][-copyright?Copyright (c) 1992-2006 AT&T Knowledge 
Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libcmd]"\";
 -c basename.c
+exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-DERROR_CATALOG=\""libcmd"\" -D_BLD_cmd -D_PACKAGE_ast 
-DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf at 
research.att.com>][-author?David Korn <dgk at 
research.att.com>][-copyright?Copyright (c) 1992-2006 AT&T Knowledge 
Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libcmd]"\";
 -c basename.c
 done basename.o generated
 make cat.o
 prev cat.c
 meta cat.o %.c>%.o cat.c cat
 prev cat.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-DERROR_CATALOG=\""libcmd"\" -DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf at 
research.att.com>][-author?David Korn <dgk at 
research.att.com>][-copyright?Copyright (c) 1992-2006 AT&T Knowledge 
Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libcmd]"\";
 -D_PACKAGE_ast -D_BLD_cmd -c cat.c
+exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-DERROR_CATALOG=\""libcmd"\" -DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf at 
research.att.com>][-author?David Korn <dgk at 
research.att.com>][-copyright?Copyright (c) 1992-2006 AT&T Knowledge 
Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libcmd]"\";
 -D_BLD_cmd -D_PACKAGE_ast -c cat.c
 done cat.o generated
 make chgrp.o
 prev chgrp.c
@@ -464,25 +446,25 @@
 prev chmod.c
 meta chmod.o %.c>%.o chmod.c chmod
 prev chmod.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-DERROR_CATALOG=\""libcmd"\" -D_PACKAGE_ast -D_BLD_cmd 
-DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf at 
research.att.com>][-author?David Korn <dgk at 
research.att.com>][-copyright?Copyright (c) 1992-2006 AT&T Knowledge 
Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libcmd]"\";
 -c chmod.c
+exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-DERROR_CATALOG=\""libcmd"\" -D_BLD_cmd -D_PACKAGE_ast 
-DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf at 
research.att.com>][-author?David Korn <dgk at 
research.att.com>][-copyright?Copyright (c) 1992-2006 AT&T Knowledge 
Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libcmd]"\";
 -c chmod.c
 done chmod.o generated
 make chown.o
 prev chown.c
 meta chown.o %.c>%.o chown.c chown
 prev chown.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-D_PACKAGE_ast -D_BLD_cmd -c chown.c
+exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-D_BLD_cmd -D_PACKAGE_ast -c chown.c
 done chown.o generated
 make cmp.o
 prev cmp.c
 meta cmp.o %.c>%.o cmp.c cmp
 prev cmp.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-DERROR_CATALOG=\""libcmd"\" -D_PACKAGE_ast -D_BLD_cmd 
-DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf at 
research.att.com>][-author?David Korn <dgk at 
research.att.com>][-copyright?Copyright (c) 1992-2006 AT&T Knowledge 
Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libcmd]"\";
 -c cmp.c
+exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-DERROR_CATALOG=\""libcmd"\" -D_BLD_cmd -D_PACKAGE_ast 
-DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf at 
research.att.com>][-author?David Korn <dgk at 
research.att.com>][-copyright?Copyright (c) 1992-2006 AT&T Knowledge 
Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libcmd]"\";
 -c cmp.c
 done cmp.o generated
 make comm.o
 prev comm.c
 meta comm.o %.c>%.o comm.c comm
 prev comm.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-DERROR_CATALOG=\""libcmd"\" -D_PACKAGE_ast -D_BLD_cmd 
-DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf at 
research.att.com>][-author?David Korn <dgk at 
research.att.com>][-copyright?Copyright (c) 1992-2006 AT&T Knowledge 
Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libcmd]"\";
 -c comm.c
+exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-DERROR_CATALOG=\""libcmd"\" -D_BLD_cmd -D_PACKAGE_ast 
-DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf at 
research.att.com>][-author?David Korn <dgk at 
research.att.com>][-copyright?Copyright (c) 1992-2006 AT&T Knowledge 
Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libcmd]"\";
 -c comm.c
 done comm.o generated
 make cp.o
 prev cp.c
@@ -494,13 +476,13 @@
 prev cut.c
 meta cut.o %.c>%.o cut.c cut
 prev cut.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-DERROR_CATALOG=\""libcmd"\" -D_PACKAGE_ast -D_BLD_cmd 
-DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf at 
research.att.com>][-author?David Korn <dgk at 
research.att.com>][-copyright?Copyright (c) 1992-2006 AT&T Knowledge 
Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libcmd]"\";
 -c cut.c
+exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-DERROR_CATALOG=\""libcmd"\" -D_BLD_cmd -D_PACKAGE_ast 
-DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf at 
research.att.com>][-author?David Korn <dgk at 
research.att.com>][-copyright?Copyright (c) 1992-2006 AT&T Knowledge 
Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libcmd]"\";
 -c cut.c
 done cut.o generated
 make dirname.o
 prev dirname.c
 meta dirname.o %.c>%.o dirname.c dirname
 prev dirname.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-DERROR_CATALOG=\""libcmd"\" -D_PACKAGE_ast -D_BLD_cmd 
-DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf at 
research.att.com>][-author?David Korn <dgk at 
research.att.com>][-copyright?Copyright (c) 1992-2006 AT&T Knowledge 
Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libcmd]"\";
 -c dirname.c
+exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-DERROR_CATALOG=\""libcmd"\" -D_BLD_cmd -D_PACKAGE_ast 
-DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf at 
research.att.com>][-author?David Korn <dgk at 
research.att.com>][-copyright?Copyright (c) 1992-2006 AT&T Knowledge 
Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libcmd]"\";
 -c dirname.c
 done dirname.o generated
 make date.o
 prev date.c
@@ -518,19 +500,19 @@
 prev fds.c
 meta fds.o %.c>%.o fds.c fds
 prev fds.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-DERROR_CATALOG=\""libcmd"\" -D_PACKAGE_ast -D_BLD_cmd 
-DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf at 
research.att.com>][-author?David Korn <dgk at 
research.att.com>][-copyright?Copyright (c) 1992-2006 AT&T Knowledge 
Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libcmd]"\";
 -c fds.c
+exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-DERROR_CATALOG=\""libcmd"\" -D_BLD_cmd -D_PACKAGE_ast 
-DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf at 
research.att.com>][-author?David Korn <dgk at 
research.att.com>][-copyright?Copyright (c) 1992-2006 AT&T Knowledge 
Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libcmd]"\";
 -c fds.c
 done fds.o generated
 make fmt.o
 prev fmt.c
 meta fmt.o %.c>%.o fmt.c fmt
 prev fmt.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-DERROR_CATALOG=\""libcmd"\" -D_PACKAGE_ast -D_BLD_cmd 
-DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf at 
research.att.com>][-author?David Korn <dgk at 
research.att.com>][-copyright?Copyright (c) 1992-2006 AT&T Knowledge 
Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libcmd]"\";
 -c fmt.c
+exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-DERROR_CATALOG=\""libcmd"\" -D_BLD_cmd -D_PACKAGE_ast 
-DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf at 
research.att.com>][-author?David Korn <dgk at 
research.att.com>][-copyright?Copyright (c) 1992-2006 AT&T Knowledge 
Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libcmd]"\";
 -c fmt.c
 done fmt.o generated
 make fold.o
 prev fold.c
 meta fold.o %.c>%.o fold.c fold
 prev fold.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-DERROR_CATALOG=\""libcmd"\" -D_PACKAGE_ast -D_BLD_cmd 
-DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf at 
research.att.com>][-author?David Korn <dgk at 
research.att.com>][-copyright?Copyright (c) 1992-2006 AT&T Knowledge 
Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libcmd]"\";
 -c fold.c
+exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-DERROR_CATALOG=\""libcmd"\" -D_BLD_cmd -D_PACKAGE_ast 
-DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf at 
research.att.com>][-author?David Korn <dgk at 
research.att.com>][-copyright?Copyright (c) 1992-2006 AT&T Knowledge 
Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libcmd]"\";
 -c fold.c
 done fold.o generated
 make getconf.o
 prev getconf.c
@@ -542,13 +524,13 @@
 prev head.c
 meta head.o %.c>%.o head.c head
 prev head.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-DERROR_CATALOG=\""libcmd"\" -D_PACKAGE_ast -D_BLD_cmd 
-DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf at 
research.att.com>][-author?David Korn <dgk at 
research.att.com>][-copyright?Copyright (c) 1992-2006 AT&T Knowledge 
Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libcmd]"\";
 -c head.c
+exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-DERROR_CATALOG=\""libcmd"\" -D_BLD_cmd -D_PACKAGE_ast 
-DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf at 
research.att.com>][-author?David Korn <dgk at 
research.att.com>][-copyright?Copyright (c) 1992-2006 AT&T Knowledge 
Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libcmd]"\";
 -c head.c
 done head.o generated
 make id.o
 prev id.c
 meta id.o %.c>%.o id.c id
 prev id.c
-exec - ${CC} ${mam_cc_FLAGS} ${-debug-symbols?1?${mam_cc_DEBUG} 
-D_BLD_DEBUG?${CCFLAGS.FORCE}?} -I. -I${PACKAGE_ast_INCLUDE} 
-DERROR_CATALOG=\""libcmd"\" -D_PACKAGE_ast -D_BLD_cmd 
-DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf at 
research.att.com>][-author?David Korn <dgk at 
research.att.com>][-copyright?Copyright (c) 1992-2006 AT&T Knowledge 
Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libcmd]"\";
 -c id.c
+exec - ${CC} ${mam_cc_FLAGS} ${-debug-symbols?1?${mam_cc_DEBUG} 
-D_BLD_DEBUG?${CCFLAGS.FORCE}?} -I. -I${PACKAGE_ast_INCLUDE} 
-DERROR_CATALOG=\""libcmd"\" -D_BLD_cmd -D_PACKAGE_ast 
-DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf at 
research.att.com>][-author?David Korn <dgk at 
research.att.com>][-copyright?Copyright (c) 1992-2006 AT&T Knowledge 
Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libcmd]"\";
 -c id.c
 done id.o generated
 make join.o
 prev join.c
@@ -566,19 +548,19 @@
 prev logname.c
 meta logname.o %.c>%.o logname.c logname
 prev logname.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-DERROR_CATALOG=\""libcmd"\" -D_PACKAGE_ast -D_BLD_cmd 
-DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf at 
research.att.com>][-author?David Korn <dgk at 
research.att.com>][-copyright?Copyright (c) 1992-2006 AT&T Knowledge 
Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libcmd]"\";
 -c logname.c
+exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-DERROR_CATALOG=\""libcmd"\" -D_BLD_cmd -D_PACKAGE_ast 
-DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf at 
research.att.com>][-author?David Korn <dgk at 
research.att.com>][-copyright?Copyright (c) 1992-2006 AT&T Knowledge 
Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libcmd]"\";
 -c logname.c
 done logname.o generated
 make mkdir.o
 prev mkdir.c
 meta mkdir.o %.c>%.o mkdir.c mkdir
 prev mkdir.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-DERROR_CATALOG=\""libcmd"\" -D_PACKAGE_ast -D_BLD_cmd 
-DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf at 
research.att.com>][-author?David Korn <dgk at 
research.att.com>][-copyright?Copyright (c) 1992-2006 AT&T Knowledge 
Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libcmd]"\";
 -c mkdir.c
+exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-DERROR_CATALOG=\""libcmd"\" -D_BLD_cmd -D_PACKAGE_ast 
-DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf at 
research.att.com>][-author?David Korn <dgk at 
research.att.com>][-copyright?Copyright (c) 1992-2006 AT&T Knowledge 
Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libcmd]"\";
 -c mkdir.c
 done mkdir.o generated
 make mkfifo.o
 prev mkfifo.c
 meta mkfifo.o %.c>%.o mkfifo.c mkfifo
 prev mkfifo.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-DERROR_CATALOG=\""libcmd"\" -D_PACKAGE_ast -D_BLD_cmd 
-DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf at 
research.att.com>][-author?David Korn <dgk at 
research.att.com>][-copyright?Copyright (c) 1992-2006 AT&T Knowledge 
Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libcmd]"\";
 -c mkfifo.c
+exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-DERROR_CATALOG=\""libcmd"\" -D_BLD_cmd -D_PACKAGE_ast 
-DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf at 
research.att.com>][-author?David Korn <dgk at 
research.att.com>][-copyright?Copyright (c) 1992-2006 AT&T Knowledge 
Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libcmd]"\";
 -c mkfifo.c
 done mkfifo.o generated
 make mv.o
 prev mv.c
@@ -590,31 +572,31 @@
 prev paste.c
 meta paste.o %.c>%.o paste.c paste
 prev paste.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-DERROR_CATALOG=\""libcmd"\" -D_PACKAGE_ast -D_BLD_cmd 
-DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf at 
research.att.com>][-author?David Korn <dgk at 
research.att.com>][-copyright?Copyright (c) 1992-2006 AT&T Knowledge 
Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libcmd]"\";
 -c paste.c
+exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-DERROR_CATALOG=\""libcmd"\" -D_BLD_cmd -D_PACKAGE_ast 
-DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf at 
research.att.com>][-author?David Korn <dgk at 
research.att.com>][-copyright?Copyright (c) 1992-2006 AT&T Knowledge 
Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libcmd]"\";
 -c paste.c
 done paste.o generated
 make pathchk.o
 prev pathchk.c
 meta pathchk.o %.c>%.o pathchk.c pathchk
 prev pathchk.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-DERROR_CATALOG=\""libcmd"\" -D_PACKAGE_ast -D_BLD_cmd 
-DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf at 
research.att.com>][-author?David Korn <dgk at 
research.att.com>][-copyright?Copyright (c) 1992-2006 AT&T Knowledge 
Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libcmd]"\";
 -c pathchk.c
+exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-DERROR_CATALOG=\""libcmd"\" -D_BLD_cmd -D_PACKAGE_ast 
-DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf at 
research.att.com>][-author?David Korn <dgk at 
research.att.com>][-copyright?Copyright (c) 1992-2006 AT&T Knowledge 
Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libcmd]"\";
 -c pathchk.c
 done pathchk.o generated
 make rev.o
 prev rev.c
 meta rev.o %.c>%.o rev.c rev
 prev rev.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-DERROR_CATALOG=\""libcmd"\" -D_PACKAGE_ast -D_BLD_cmd 
-DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf at 
research.att.com>][-author?David Korn <dgk at 
research.att.com>][-copyright?Copyright (c) 1992-2006 AT&T Knowledge 
Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libcmd]"\";
 -c rev.c
+exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-DERROR_CATALOG=\""libcmd"\" -D_BLD_cmd -D_PACKAGE_ast 
-DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf at 
research.att.com>][-author?David Korn <dgk at 
research.att.com>][-copyright?Copyright (c) 1992-2006 AT&T Knowledge 
Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libcmd]"\";
 -c rev.c
 done rev.o generated
 make rm.o
 prev rm.c
 meta rm.o %.c>%.o rm.c rm
 prev rm.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-DERROR_CATALOG=\""libcmd"\" -D_PACKAGE_ast -D_BLD_cmd 
-DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf at 
research.att.com>][-author?David Korn <dgk at 
research.att.com>][-copyright?Copyright (c) 1992-2006 AT&T Knowledge 
Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libcmd]"\";
 -c rm.c
+exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-DERROR_CATALOG=\""libcmd"\" -D_BLD_cmd -D_PACKAGE_ast 
-DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf at 
research.att.com>][-author?David Korn <dgk at 
research.att.com>][-copyright?Copyright (c) 1992-2006 AT&T Knowledge 
Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libcmd]"\";
 -c rm.c
 done rm.o generated
 make rmdir.o
 prev rmdir.c
 meta rmdir.o %.c>%.o rmdir.c rmdir
 prev rmdir.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-DERROR_CATALOG=\""libcmd"\" -D_PACKAGE_ast -D_BLD_cmd 
-DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf at 
research.att.com>][-author?David Korn <dgk at 
research.att.com>][-copyright?Copyright (c) 1992-2006 AT&T Knowledge 
Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libcmd]"\";
 -c rmdir.c
+exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-DERROR_CATALOG=\""libcmd"\" -D_BLD_cmd -D_PACKAGE_ast 
-DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf at 
research.att.com>][-author?David Korn <dgk at 
research.att.com>][-copyright?Copyright (c) 1992-2006 AT&T Knowledge 
Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libcmd]"\";
 -c rmdir.c
 done rmdir.o generated
 make stty.o
 prev stty.c
@@ -622,6 +604,12 @@
 prev stty.c
 exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-DERROR_CATALOG=\""libcmd"\" -D_PACKAGE_ast -D_BLD_cmd 
-DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf at 
research.att.com>][-author?David Korn <dgk at 
research.att.com>][-copyright?Copyright (c) 1992-2006 AT&T Knowledge 
Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libcmd]"\";
 -c stty.c
 done stty.o generated
+make sync.o
+prev sync.c
+meta sync.o %.c>%.o sync.c sync
+prev sync.c
+exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-DERROR_CATALOG=\""libcmd"\" -D_BLD_cmd -D_PACKAGE_ast 
-DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf at 
research.att.com>][-author?David Korn <dgk at 
research.att.com>][-copyright?Copyright (c) 1992-2006 AT&T Knowledge 
Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libcmd]"\";
 -c sync.c
+done sync.o generated
 make tail.o
 prev tail.c
 meta tail.o %.c>%.o tail.c tail
@@ -632,13 +620,13 @@
 prev tee.c
 meta tee.o %.c>%.o tee.c tee
 prev tee.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-DERROR_CATALOG=\""libcmd"\" -D_PACKAGE_ast -D_BLD_cmd 
-DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf at 
research.att.com>][-author?David Korn <dgk at 
research.att.com>][-copyright?Copyright (c) 1992-2006 AT&T Knowledge 
Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libcmd]"\";
 -c tee.c
+exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-DERROR_CATALOG=\""libcmd"\" -D_BLD_cmd -D_PACKAGE_ast 
-DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf at 
research.att.com>][-author?David Korn <dgk at 
research.att.com>][-copyright?Copyright (c) 1992-2006 AT&T Knowledge 
Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libcmd]"\";
 -c tee.c
 done tee.o generated
 make tty.o
 prev tty.c
 meta tty.o %.c>%.o tty.c tty
 prev tty.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-DERROR_CATALOG=\""libcmd"\" -D_PACKAGE_ast -D_BLD_cmd 
-DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf at 
research.att.com>][-author?David Korn <dgk at 
research.att.com>][-copyright?Copyright (c) 1992-2006 AT&T Knowledge 
Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libcmd]"\";
 -c tty.c
+exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-DERROR_CATALOG=\""libcmd"\" -D_BLD_cmd -D_PACKAGE_ast 
-DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf at 
research.att.com>][-author?David Korn <dgk at 
research.att.com>][-copyright?Copyright (c) 1992-2006 AT&T Knowledge 
Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libcmd]"\";
 -c tty.c
 done tty.o generated
 make uname.o
 prev uname.c
@@ -650,7 +638,7 @@
 prev uniq.c
 meta uniq.o %.c>%.o uniq.c uniq
 prev uniq.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-DERROR_CATALOG=\""libcmd"\" -D_PACKAGE_ast -D_BLD_cmd 
-DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf at 
research.att.com>][-author?David Korn <dgk at 
research.att.com>][-copyright?Copyright (c) 1992-2006 AT&T Knowledge 
Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libcmd]"\";
 -c uniq.c
+exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-DERROR_CATALOG=\""libcmd"\" -D_BLD_cmd -D_PACKAGE_ast 
-DUSAGE_LICENSE=\""[-author?Glenn Fowler <gsf at 
research.att.com>][-author?David Korn <dgk at 
research.att.com>][-copyright?Copyright (c) 1992-2006 AT&T Knowledge 
Ventures][-license?http://www.opensource.org/licenses/cpl1.0.txt][--catalog?libcmd]"\";
 -c uniq.c
 done uniq.o generated
 make wc.o
 prev wc.c
@@ -662,7 +650,7 @@
 prev revlib.c
 meta revlib.o %.c>%.o revlib.c revlib
 prev revlib.c
-exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-D_PACKAGE_ast -D_BLD_cmd -c revlib.c
+exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-D_BLD_cmd -D_PACKAGE_ast -c revlib.c
 done revlib.o generated
 make wclib.o
 prev wclib.c
@@ -670,8 +658,8 @@
 prev wclib.c
 exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -I${PACKAGE_ast_INCLUDE} 
-D_PACKAGE_ast -D_BLD_cmd -c wclib.c
 done wclib.o generated
-exec - ${AR} cr libcmd.a cmdinit.o cmdrecurse.o basename.o cat.o chgrp.o 
chmod.o chown.o cmp.o comm.o cp.o cut.o dirname.o date.o expr.o fds.o fmt.o 
fold.o getconf.o head.o id.o join.o ln.o logname.o mkdir.o mkfifo.o mv.o 
paste.o pathchk.o rev.o rm.o
-exec - ${AR} cr libcmd.a rmdir.o stty.o tail.o tee.o tty.o uname.o uniq.o wc.o 
revlib.o wclib.o
+exec - ${AR} cr libcmd.a cmdinit.o basename.o cat.o chgrp.o chmod.o chown.o 
cmp.o comm.o cp.o cut.o dirname.o date.o expr.o fds.o fmt.o fold.o getconf.o 
head.o id.o join.o ln.o logname.o mkdir.o mkfifo.o mv.o paste.o pathchk.o rev.o 
rm.o rmdir.o
+exec - ${AR} cr libcmd.a stty.o sync.o tail.o tee.o tty.o uname.o uniq.o wc.o 
revlib.o wclib.o
 exec - (ranlib libcmd.a) >/dev/null 2>&1 || true
 done libcmd.a generated
 done cmd virtual
@@ -705,7 +693,7 @@
 make ${PACKAGE_ast_INCLUDE}/cmd.h
 prev ${PACKAGE_ast_INCLUDE}
 prev cmd.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1992,author=gsf+dgk'  cmd.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1992,author=gsf+dgk'  cmd.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${PACKAGE_ast_INCLUDE}/cmd.h 1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${PACKAGE_ast_INCLUDE}/cmd.h
@@ -713,7 +701,7 @@
 done ${PACKAGE_ast_INCLUDE}/cmd.h generated
 make ${PACKAGE_ast_INCLUDE}/cmdext.h
 prev cmdext.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1992,author=gsf+dgk'  cmdext.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1992,author=gsf+dgk'  cmdext.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${PACKAGE_ast_INCLUDE}/cmdext.h 1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${PACKAGE_ast_INCLUDE}/cmdext.h
@@ -722,7 +710,6 @@
 make ${PACKAGE_ast_INCLUDE}/cmdlist.h
 make cmdlist.h
 prev cmdinit.c
-prev cmdrecurse.c
 prev basename.c
 prev cat.c
 prev chgrp.c
@@ -753,6 +740,7 @@
 prev rm.c
 prev rmdir.c
 prev stty.c
+prev sync.c
 prev tail.c
 prev tee.c
 prev tty.c
@@ -774,7 +762,7 @@
 exec -         -e 's/^b_//' \
 exec -         -e 's/(.*//' \
 exec -         -e 's/.*/CMDLIST(&)/' \
-exec -         cmdinit.c cmdrecurse.c basename.c cat.c chgrp.c chmod.c chown.c 
cmp.c comm.c cp.c cut.c dirname.c date.c expr.c fds.c fmt.c fold.c getconf.c 
head.c id.c join.c ln.c logname.c mkdir.c mkfifo.c mv.c paste.c pathchk.c rev.c 
rm.c rmdir.c stty.c tail.c tee.c tty.c uname.c uniq.c wc.c revlib.c wclib.c |
+exec -         cmdinit.c basename.c cat.c chgrp.c chmod.c chown.c cmp.c comm.c 
cp.c cut.c dirname.c date.c expr.c fds.c fmt.c fold.c getconf.c head.c id.c 
join.c ln.c logname.c mkdir.c mkfifo.c mv.c paste.c pathchk.c rev.c rm.c 
rmdir.c stty.c sync.c tail.c tee.c tty.c uname.c uniq.c wc.c revlib.c wclib.c |
 exec - sort -u
 exec - } > 1.${COTEMP}.h
 exec - if      cmp 2>/dev/null -s 1.${COTEMP}.h cmdlist.h
@@ -782,7 +770,7 @@
 exec - else    mv 1.${COTEMP}.h cmdlist.h
 exec - fi
 done cmdlist.h generated
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1992,author=gsf+dgk'  cmdlist.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1992,author=gsf+dgk'  cmdlist.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${PACKAGE_ast_INCLUDE}/cmdlist.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${PACKAGE_ast_INCLUDE}/cmdlist.h
diff -r -N -u ksh93_2006_09_12/src/lib/libcmd/mkdir.c 
ksh93_2006_10_31/src/lib/libcmd/mkdir.c
--- ksh93_2006_09_12/src/lib/libcmd/mkdir.c     2006-08-27 17:37:23.000000000 
+0200
+++ ksh93_2006_10_31/src/lib/libcmd/mkdir.c     2006-11-01 21:16:49.000000000 
+0100
@@ -27,7 +27,7 @@
  */
 
 static const char usage[] =
-"[-?\n@(#)$Id: mkdir (AT&T Labs Research) 2006-08-27 $\n]"
+"[-?\n@(#)$Id: mkdir (AT&T Research) 2006-08-27 $\n]"
 USAGE_LICENSE
 "[+NAME?mkdir - make directories]"
 "[+DESCRIPTION?\bmkdir\b creates one or more directories.  By "
@@ -54,7 +54,7 @@
 "[+SEE ALSO?\bchmod\b(1), \brmdir\b(1), \bumask\b(1)]"
 ;
 
-#include <cmdlib.h>
+#include <cmd.h>
 #include <ls.h>
 
 #define DIRMODE        (S_IRWXU|S_IRWXG|S_IRWXO)
@@ -71,8 +71,7 @@
        char*           name;
        mode_t          dmode;
 
-       NoP(argc);
-       cmdinit(argv, context, ERROR_CATALOG, 0);
+       cmdinit(argc, argv, context, ERROR_CATALOG, 0);
        while (n = optget(argv, usage)) switch (n)
        {
        case 'p':
diff -r -N -u ksh93_2006_09_12/src/lib/libcmd/mkfifo.c 
ksh93_2006_10_31/src/lib/libcmd/mkfifo.c
--- ksh93_2006_09_12/src/lib/libcmd/mkfifo.c    2002-11-14 22:32:21.000000000 
+0100
+++ ksh93_2006_10_31/src/lib/libcmd/mkfifo.c    2006-11-01 21:16:51.000000000 
+0100
@@ -28,7 +28,7 @@
 
 
 static const char usage[] =
-"[-?\n@(#)$Id: mkfifo (AT&T Labs Research) 1999-04-20 $\n]"
+"[-?\n@(#)$Id: mkfifo (AT&T Research) 1999-04-20 $\n]"
 USAGE_LICENSE
 "[+NAME?mkfifo - make FIFOs (named pipes)]"
 "[+DESCRIPTION?\bmkfifo\b creates one or more FIFO's.  By "
@@ -47,7 +47,7 @@
 "[+SEE ALSO?\bchmod\b(1), \bumask\b(1)]"
 ;
 
-#include <cmdlib.h>
+#include <cmd.h>
 #include <ls.h>
 
 #define RWALL  (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
@@ -59,8 +59,7 @@
        register mode_t mode=RWALL, mask=0;
        register int n;
 
-       NoP(argc);
-       cmdinit(argv, context, ERROR_CATALOG, 0);
+       cmdinit(argc, argv, context, ERROR_CATALOG, 0);
        while (n = optget(argv, usage)) switch (n)
        {
          case 'm':
diff -r -N -u ksh93_2006_09_12/src/lib/libcmd/paste.c 
ksh93_2006_10_31/src/lib/libcmd/paste.c
--- ksh93_2006_09_12/src/lib/libcmd/paste.c     2002-11-14 22:32:23.000000000 
+0100
+++ ksh93_2006_10_31/src/lib/libcmd/paste.c     2006-11-01 21:16:55.000000000 
+0100
@@ -29,7 +29,7 @@
  */
 
 static const char usage[] =
-"[-?\n@(#)$Id: paste (AT&T Labs Research) 1999-06-22 $\n]"
+"[-?\n@(#)$Id: paste (AT&T Research) 1999-06-22 $\n]"
 USAGE_LICENSE
 "[+NAME?paste - merge lines of files]"
 "[+DESCRIPTION?\bpaste\b concatenates the corresponding lines of a "
@@ -70,7 +70,7 @@
 ;
 
 
-#include <cmdlib.h>
+#include <cmd.h>
 
 /*
  * paste the lines of the <nstreams> defined in <streams> and put results
@@ -161,14 +161,13 @@
 b_paste(int argc,register char *argv[], void* context)
 {
        register int            n, sflag=0;
-       register Sfio_t *fp, **streams;
+       register Sfio_t         *fp, **streams;
        register char           *cp, *delim;
        int                     dlen;
+       char                    defdelim[2];
 
-       static char             defdelim[] = "\t";
-
-       cmdinit(argv, context, ERROR_CATALOG, 0);
-       delim = defdelim;
+       cmdinit(argc, argv, context, ERROR_CATALOG, 0);
+       delim = 0;
        while (n = optget(argv, usage)) switch (n)
        {
            case 'd':
@@ -187,7 +186,13 @@
        argv += opt_info.index;
        if(error_info.errors)
                error(ERROR_usage(2),"%s", optusage(NiL));
-       dlen = stresc(delim);
+       if(delim)
+               dlen = stresc(delim);
+       else
+       {
+               *(delim = defdelim) = '\t';
+               dlen = 1;
+       }
        if(cp = *argv)
        {
                n = argc - opt_info.index;
diff -r -N -u ksh93_2006_09_12/src/lib/libcmd/pathchk.c 
ksh93_2006_10_31/src/lib/libcmd/pathchk.c
--- ksh93_2006_09_12/src/lib/libcmd/pathchk.c   2004-10-08 23:35:09.000000000 
+0200
+++ ksh93_2006_10_31/src/lib/libcmd/pathchk.c   2006-11-01 21:16:58.000000000 
+0100
@@ -26,7 +26,7 @@
  */
 
 static const char usage[] =
-"[-?\n@(#)$Id: pathchk (AT&T Labs Research) 2004-10-08 $\n]"
+"[-?\n@(#)$Id: pathchk (AT&T Research) 2006-09-19 $\n]"
 USAGE_LICENSE
 "[+NAME?pathchk - check pathnames for portability]"
 "[+DESCRIPTION?\bpathchk\b checks each \apathname\a to see if it "
@@ -68,7 +68,7 @@
 ;
 
 
-#include       <cmdlib.h>
+#include       <cmd.h>
 #include       <ls.h>
 
 #define isport(c)      (((c)>='a' && (c)<='z') || ((c)>='A' && (c)<='Z') || 
((c)>='0' && (c)<='9') || (strchr("._-",(c))!=0) )
@@ -79,8 +79,11 @@
 static long mypathconf(const char *path, int op)
 {
        register long r;
+
+       static const char*      ops[] = { "NAME_MAX", "PATH_MAX" };
+
        errno=0;
-       if((r=pathconf(path, op))<0 && errno==0)
+       if((r=strtol(astconf(ops[op], path, NiL), NiL, 0))<0 && errno==0)
                return(LONG_MAX);
        return(r);
 }
@@ -107,12 +110,13 @@
        }
        else
        {
-               static char buff[2];
+               char tmp[2];
                name_max = path_max = 0;
-               buff[0] = (*cp=='/'? '/': '.');
-               if((r=mypathconf(buff, _PC_NAME_MAX)) > _POSIX_NAME_MAX)
+               tmp[0] = (*cp=='/'? '/': '.');
+               tmp[1] = 0;
+               if((r=mypathconf(tmp, 0)) > _POSIX_NAME_MAX)
                        name_max = r;
-               if((r=mypathconf(buff, _PC_PATH_MAX)) > _POSIX_PATH_MAX)
+               if((r=mypathconf(tmp, 1)) > _POSIX_PATH_MAX)
                        path_max = r;
                if(*cp!='/')
                {
@@ -131,9 +135,9 @@
                                                if(cp>cpold)
                                                        while(--cp>cpold && 
*cp=='/');
                                                *++cp = 0;
-                                               if(name_max==0 && 
(r=mypathconf(cpold, _PC_NAME_MAX)) > _POSIX_NAME_MAX)
+                                               if(name_max==0 && 
(r=mypathconf(cpold, 0)) > _POSIX_NAME_MAX)
                                                        name_max = r;
-                                               if(path_max==0 && 
(r=mypathconf(cpold, _PC_PATH_MAX)) > _POSIX_PATH_MAX)
+                                               if(path_max==0 && 
(r=mypathconf(cpold, 1)) > _POSIX_PATH_MAX)
                                                        path_max=r;
                                                if(--cp==cpold)
                                                {
@@ -160,7 +164,7 @@
                                goto err;
                        errno=0;
                        cp[-1] = 0;
-                       r = mypathconf(path, _PC_NAME_MAX);
+                       r = mypathconf(path, 0);
                        if((cp[-1]=c)==0)
                                cp--;
                        else while(*cp=='/')
@@ -219,7 +223,7 @@
        register int n, mode=0;
        register char *cp;
 
-       cmdinit(argv, context, ERROR_CATALOG, 0);
+       cmdinit(argc, argv, context, ERROR_CATALOG, 0);
        while (n = optget(argv, usage)) switch (n)
        {
            case 'p':
diff -r -N -u ksh93_2006_09_12/src/lib/libcmd/RELEASE 
ksh93_2006_10_31/src/lib/libcmd/RELEASE
--- ksh93_2006_09_12/src/lib/libcmd/RELEASE     2006-09-12 18:13:51.000000000 
+0200
+++ ksh93_2006_10_31/src/lib/libcmd/RELEASE     2006-11-02 16:41:03.000000000 
+0100
@@ -1,3 +1,19 @@
+06-10-31 global edit to eliminate most non-const static data0
+06-10-31 use <cmd.h> for all b_*() implementations; drop <cmdlib.h> 
+06-10-31 cmd.h: add CMD_ prefix to { BUILTIN DYNAMIC STANDALONE } 
+06-10-31 join.c: tone down /tmp usage vi SFSK_DISCARD
+06-10-31 cp.c,rm.c: update to <fts.h> to accomodate non-static data
+06-10-29 date.c: "...%H%..." => "...%H" "%..." to avoid SCCS conflict
+06-10-26 fds.c: handle sctp
+06-10-18 tail.c: fix invalid suffix infinite loop
+06-10-11 chgrp.c,cp.c: add sfstruse() error checks
+06-10-10 tee.c: add --linebuffer, -l
+06-10-06 getconf.c: preserve native getconf(1) known variable behavior
+06-10-04 sync.c: add (thanks to Roland Mainz)
+06-10-04 getconf.c: add -v specification => run native getconf(1)
+06-09-28 stty.c: static setmode() => set() for darwin.i386
+06-09-27 head.c: handle -1c => -c1
+06-09-19 pathchk.c: pathconf() => astconf()
 06-09-11 tail.c: handle compatibility corner cases
 06-09-08 date.c: add output write error diagnostic
 06-09-04 tail.c: fix initial position for -n0, no args => no -f
diff -r -N -u ksh93_2006_09_12/src/lib/libcmd/rev.c 
ksh93_2006_10_31/src/lib/libcmd/rev.c
--- ksh93_2006_09_12/src/lib/libcmd/rev.c       2002-11-14 22:32:29.000000000 
+0100
+++ ksh93_2006_10_31/src/lib/libcmd/rev.c       2006-11-01 21:25:30.000000000 
+0100
@@ -31,7 +31,7 @@
  */
 
 static const char usage[] =
-"[-?\n@(#)$Id: rev (AT&T Labs Research) 1999-04-10 $\n]"
+"[-?\n@(#)$Id: rev (AT&T Research) 1999-04-10 $\n]"
 USAGE_LICENSE
 "[+NAME?rev - reverse the characters or lines of one or more files]"
 "[+DESCRIPTION?\brev\b copies one or more files to standard output "
@@ -51,7 +51,8 @@
 "[+SEE ALSO?\bcat\b(1), \btail\b(1)]"
 ;
 
-#include       <cmdlib.h>
+#include       <cmd.h>
+#include       <rev.h>
 
 /*
  * reverse the characters within a line
@@ -84,8 +85,7 @@
        register int n, line=0;
        NOT_USED(argc);
 
-       NoP(argc);
-       cmdinit(argv, context, ERROR_CATALOG, 0);
+       cmdinit(argc, argv, context, ERROR_CATALOG, 0);
        while (n = optget(argv, usage)) switch (n)
        {
            case 'l':
diff -r -N -u ksh93_2006_09_12/src/lib/libcmd/rev.h 
ksh93_2006_10_31/src/lib/libcmd/rev.h
--- ksh93_2006_09_12/src/lib/libcmd/rev.h       1970-01-01 01:00:00.000000000 
+0100
+++ ksh93_2006_10_31/src/lib/libcmd/rev.h       2006-11-01 21:22:53.000000000 
+0100
@@ -0,0 +1,34 @@
+/***********************************************************************
+*                                                                      *
+*               This software is part of the ast package               *
+*           Copyright (c) 1992-2006 AT&T Knowledge Ventures            *
+*                      and is licensed under the                       *
+*                  Common Public License, Version 1.0                  *
+*                      by AT&T Knowledge Ventures                      *
+*                                                                      *
+*                A copy of the License is available at                 *
+*            http://www.opensource.org/licenses/cpl1.0.txt             *
+*         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
+*                                                                      *
+*              Information and Software Systems Research               *
+*                            AT&T Research                             *
+*                           Florham Park NJ                            *
+*                                                                      *
+*                 Glenn Fowler <gsf at research.att.com>                  *
+*                  David Korn <dgk at research.att.com>                   *
+*                                                                      *
+***********************************************************************/
+#pragma prototyped
+
+/*
+ * rev common definitions
+ */
+
+#ifndef _REVLIB_H
+#define _REVLIB_H
+
+#define rev_line       _cmd_revline
+
+extern int             rev_line(Sfio_t*, Sfio_t*, off_t);
+
+#endif
diff -r -N -u ksh93_2006_09_12/src/lib/libcmd/revlib.c 
ksh93_2006_10_31/src/lib/libcmd/revlib.c
--- ksh93_2006_09_12/src/lib/libcmd/revlib.c    1998-03-13 21:50:19.000000000 
+0100
+++ ksh93_2006_10_31/src/lib/libcmd/revlib.c    2006-11-01 21:25:33.000000000 
+0100
@@ -23,7 +23,8 @@
  * common support for tail and rev
  */
 
-#include       <cmdlib.h>
+#include       <cmd.h>
+#include       <rev.h>
 
 #define BUFSIZE                        SF_BUFSIZE
 #define rounddown(n,size)      (((n)-1)&~((size)-1))
diff -r -N -u ksh93_2006_09_12/src/lib/libcmd/rm.c 
ksh93_2006_10_31/src/lib/libcmd/rm.c
--- ksh93_2006_09_12/src/lib/libcmd/rm.c        2006-01-29 04:52:19.000000000 
+0100
+++ ksh93_2006_10_31/src/lib/libcmd/rm.c        2006-11-01 22:55:17.000000000 
+0100
@@ -27,7 +27,7 @@
  */
 
 static const char usage[] =
-"[-?\n@(#)$Id: rm (AT&T Labs Research) 2006-01-28 $\n]"
+"[-?\n@(#)$Id: rm (AT&T Research) 2006-10-31 $\n]"
 USAGE_LICENSE
 "[+NAME?rm - remove files]"
 "[+DESCRIPTION?\brm\b removes the named \afile\a arguments. By default it"
@@ -66,200 +66,202 @@
 "[+SEE ALSO?\bmv\b(1), \brmdir\b(2), \bunlink\b(2), \bremove\b(3)]"
 ;
 
-#include <cmdlib.h>
+#include <cmd.h>
 #include <ls.h>
-#include <ftwalk.h>
+#include <fts.h>
 #include <fs3d.h>
 
 #define RM_ENTRY       1
 
-#define beenhere(f)    (((f)->local.number>>1)==(f)->statb.st_nlink)
-#define isempty(f)     (!((f)->local.number&RM_ENTRY))
-#define nonempty(f)    ((f)->parent->local.number|=RM_ENTRY)
+#define beenhere(f)    (((f)->fts_number>>1)==(f)->fts_statp->st_nlink)
+#define isempty(f)     (!((f)->fts_number&RM_ENTRY))
+#define nonempty(f)    ((f)->fts_parent->fts_number|=RM_ENTRY)
 #define pathchunk(n)   roundof(n,1024)
-#define retry(f)       ((f)->local.number=((f)->statb.st_nlink<<1))
+#define retry(f)       ((f)->fts_number=((f)->fts_statp->st_nlink<<1))
 
-static struct                          /* program state                */
+typedef struct State_s                 /* program state                */
 {
        int             clobber;        /* clear out file data first    */
        int             directory;      /* remove(dir) not rmdir(dir)   */
        int             force;          /* force actions                */
        int             fs3d;           /* 3d enabled                   */
        int             interactive;    /* prompt for approval          */
-       int             interrupt;      /* interrupt -- unwind          */
        int             recursive;      /* remove subtrees too          */
        int             terminal;       /* attached to terminal         */
        int             uid;            /* caller uid                   */
        int             unconditional;  /* enable dir rwx on preorder   */
        int             verbose;        /* display each file            */
-} state;
+#if _lib_fsync
+       char            buf[SF_BUFSIZE];/* clobber buffer               */
+#endif
+} State_t;
 
 /*
  * remove a single file
  */
 
 static int
-rm(register Ftw_t* ftw)
+rm(State_t* state, register FTSENT* ent)
 {
        register char*  path;
        register int    n;
        int             v;
        struct stat     st;
 
-       if (state.interrupt)
+       if (cmdquit())
                return -1;
-       if (ftw->info == FTW_NS)
+       if (ent->fts_info == FTS_NS || ent->fts_info == FTS_ERR || 
ent->fts_info == FTS_SLNONE)
        {
-               if (!state.force)
-                       error(2, "%s: not found", ftw->path);
+               if (!state->force)
+                       error(2, "%s: not found", ent->fts_path);
        }
-       else if (state.fs3d && iview(&ftw->statb))
-               ftw->status = FTW_SKIP;
-       else switch (ftw->info)
+       else if (state->fs3d && iview(ent->fts_statp))
+               fts_set(NiL, ent, FTS_SKIP);
+       else switch (ent->fts_info)
        {
-       case FTW_DNR:
-       case FTW_DNX:
-               if (state.unconditional)
+       case FTS_DNR:
+       case FTS_DNX:
+               if (state->unconditional)
                {
-                       if (!chmod(ftw->name, (ftw->statb.st_mode & 
S_IPERM)|S_IRWXU))
+                       if (!chmod(ent->fts_name, (ent->fts_statp->st_mode & 
S_IPERM)|S_IRWXU))
                        {
-                               ftw->status = FTW_AGAIN;
+                               fts_set(NiL, ent, FTS_AGAIN);
                                break;
                        }
                        error_info.errors++;
                }
-               else if (!state.force)
-                       error(2, "%s: cannot %s directory", ftw->path, 
(ftw->info & FTW_NR) ? "read" : "search");
+               else if (!state->force)
+                       error(2, "%s: cannot %s directory", ent->fts_path, 
(ent->fts_info & FTS_NR) ? "read" : "search");
                else
                        error_info.errors++;
-               ftw->status = FTW_SKIP;
-               nonempty(ftw);
+               fts_set(NiL, ent, FTS_SKIP);
+               nonempty(ent);
                break;
-       case FTW_D:
-       case FTW_DC:
-               path = ftw->name;
-               if (path[0] == '.' && (!path[1] || path[1] == '.' && !path[2]) 
&& (ftw->level > 0 || path[1]))
-               {
-                       ftw->status = FTW_SKIP;
-                       if (!state.force)
-                               error(2, "%s: cannot remove", ftw->path);
+       case FTS_D:
+       case FTS_DC:
+               path = ent->fts_name;
+               if (path[0] == '.' && (!path[1] || path[1] == '.' && !path[2]) 
&& (ent->fts_level > 0 || path[1]))
+               {
+                       fts_set(NiL, ent, FTS_SKIP);
+                       if (!state->force)
+                               error(2, "%s: cannot remove", ent->fts_path);
                        else
                                error_info.errors++;
                        break;
                }
-               if (!state.recursive)
+               if (!state->recursive)
                {
-                       ftw->status = FTW_SKIP;
-                       error(2, "%s: directory", ftw->path);
+                       fts_set(NiL, ent, FTS_SKIP);
+                       error(2, "%s: directory", ent->fts_path);
                        break;
                }
-               if (!beenhere(ftw))
+               if (!beenhere(ent))
                {
-                       if (state.unconditional && (ftw->statb.st_mode ^ 
S_IRWXU))
-                               chmod(path, (ftw->statb.st_mode & 
S_IPERM)|S_IRWXU);
-                       if (ftw->level > 0)
+                       if (state->unconditional && (ent->fts_statp->st_mode ^ 
S_IRWXU))
+                               chmod(path, (ent->fts_statp->st_mode & 
S_IPERM)|S_IRWXU);
+                       if (ent->fts_level > 0)
                        {
                                char*   s;
 
-                               if (ftw->status == FTW_NAME || !(s = 
strrchr(ftw->path, '/')))
+                               if (ent->fts_accpath == ent->fts_name || !(s = 
strrchr(ent->fts_accpath, '/')))
                                        v = !stat(".", &st);
                                else
                                {
-                                       path = ftw->path;
+                                       path = ent->fts_accpath;
                                        *s = 0;
                                        v = !stat(path, &st);
                                        *s = '/';
                                }
                                if (v)
-                                       v = st.st_nlink <= 2 || st.st_ino == 
ftw->parent->statb.st_ino && st.st_dev == ftw->parent->statb.st_dev || 
strchr(astconf("PATH_ATTRIBUTES", path, NiL), 'l');
+                                       v = st.st_nlink <= 2 || st.st_ino == 
ent->fts_parent->fts_statp->st_ino && st.st_dev == 
ent->fts_parent->fts_statp->st_dev || strchr(astconf("PATH_ATTRIBUTES", path, 
NiL), 'l');
                        }
                        else
                                v = 1;
                        if (v)
                        {
-                               if (state.interactive)
+                               if (state->interactive)
                                {
-                                       if ((v = astquery(-1, "remove directory 
%s? ", ftw->path)) < 0)
+                                       if ((v = astquery(-1, "remove directory 
%s? ", ent->fts_path)) < 0)
                                                return -1;
                                        if (v > 0)
                                        {
-                                               ftw->status = FTW_SKIP;
-                                               nonempty(ftw);
+                                               fts_set(NiL, ent, FTS_SKIP);
+                                               nonempty(ent);
                                        }
                                }
-                               if (ftw->info == FTW_D)
+                               if (ent->fts_info == FTS_D)
                                        break;
                        }
                        else
                        {
-                               ftw->info = FTW_DC;
-                               error(1, "%s: hard link to directory", 
ftw->path);
+                               ent->fts_info = FTS_DC;
+                               error(1, "%s: hard link to directory", 
ent->fts_path);
                        }
                }
-               else if (ftw->info == FTW_D)
+               else if (ent->fts_info == FTS_D)
                        break;
                /*FALLTHROUGH*/
-       case FTW_DP:
-               if (isempty(ftw) || state.directory)
+       case FTS_DP:
+               if (isempty(ent) || state->directory)
                {
-                       path = ftw->name;
+                       path = ent->fts_name;
                        if (path[0] != '.' || path[1])
                        {
-                               if (ftw->status != FTW_NAME)
-                                       path = ftw->path;
-                               if (state.verbose)
-                                       sfputr(sfstdout, ftw->path, '\n');
-                               if ((ftw->info == FTW_DC || state.directory) ? 
remove(path) : rmdir(path)) switch (errno)
-                               {
-                               case EEXIST:
+                               path = ent->fts_accpath;
+                               if (state->verbose)
+                                       sfputr(sfstdout, ent->fts_path, '\n');
+                               if ((ent->fts_info == FTS_DC || 
state->directory) ? remove(path) : rmdir(path))
+                                       switch (errno)
+                                       {
+                                       case EEXIST:
 #if defined(ENOTEMPTY) && (ENOTEMPTY) != (EEXIST)
-                               case ENOTEMPTY:
+                                       case ENOTEMPTY:
 #endif
-                                       if (ftw->info == FTW_DP && 
!beenhere(ftw))
-                                       {
-                                               retry(ftw);
-                                               ftw->status = FTW_AGAIN;
+                                               if (ent->fts_info == FTS_DP && 
!beenhere(ent))
+                                               {
+                                                       retry(ent);
+                                                       fts_set(NiL, ent, 
FTS_AGAIN);
+                                                       break;
+                                               }
+                                               /*FALLTHROUGH*/
+                                       default:
+                                               nonempty(ent);
+                                               if (!state->force)
+                                                       error(ERROR_SYSTEM|2, 
"%s: directory not removed", ent->fts_path);
+                                               else
+                                                       error_info.errors++;
                                                break;
                                        }
-                                       /*FALLTHROUGH*/
-                               default:
-                                       nonempty(ftw);
-                                       if (!state.force)
-                                               error(ERROR_SYSTEM|2, "%s: 
directory not removed", ftw->path);
-                                       else
-                                               error_info.errors++;
-                                       break;
-                               }
                        }
-                       else if (!state.force)
-                               error(2, "%s: cannot remove", ftw->path);
+                       else if (!state->force)
+                               error(2, "%s: cannot remove", ent->fts_path);
                        else
                                error_info.errors++;
                }
                else
                {
-                       nonempty(ftw);
-                       if (!state.force)
-                               error(2, "%s: directory not removed", 
ftw->path);
+                       nonempty(ent);
+                       if (!state->force)
+                               error(2, "%s: directory not removed", 
ent->fts_path);
                        else
                                error_info.errors++;
                }
                break;
        default:
-               path = ftw->status == FTW_NAME ? ftw->name : ftw->path;
-               if (state.verbose)
-                       sfputr(sfstdout, ftw->path, '\n');
-               if (state.interactive)
+               path = ent->fts_accpath;
+               if (state->verbose)
+                       sfputr(sfstdout, ent->fts_path, '\n');
+               if (state->interactive)
                {
-                       if ((v = astquery(-1, "remove %s? ", ftw->path)) < 0)
+                       if ((v = astquery(-1, "remove %s? ", ent->fts_path)) < 
0)
                                return -1;
                        if (v > 0)
                        {
-                               nonempty(ftw);
+                               nonempty(ent);
                                break;
                        }
                }
-               else if (!state.force && state.terminal && 
S_ISREG(ftw->statb.st_mode))
+               else if (!state->force && state->terminal && 
S_ISREG(ent->fts_statp->st_mode))
                {
                        if ((n = open(path, O_RDWR)) < 0)
                        {
@@ -274,12 +276,12 @@
 #ifdef ETXTBSY
                                        errno == ETXTBSY ? "``running 
program''" : 
 #endif
-                                       ftw->statb.st_uid != state.uid ? "``not 
owner''" :
-                                       fmtmode(ftw->statb.st_mode & S_IPERM, 
0) + 1, ftw->path)) < 0)
+                                       ent->fts_statp->st_uid != state->uid ? 
"``not owner''" :
+                                       fmtmode(ent->fts_statp->st_mode & 
S_IPERM, 0) + 1, ent->fts_path)) < 0)
                                                return -1;
                                        if (v > 0)
                                        {
-                                               nonempty(ftw);
+                                               nonempty(ent);
                                                break;
                                        }
                        }
@@ -287,26 +289,24 @@
                                close(n);
                }
 #if _lib_fsync
-               if (state.clobber && S_ISREG(ftw->statb.st_mode) && 
ftw->statb.st_size > 0)
+               if (state->clobber && S_ISREG(ent->fts_statp->st_mode) && 
ent->fts_statp->st_size > 0)
                {
                        if ((n = open(path, O_WRONLY)) < 0)
-                               error(ERROR_SYSTEM|2, "%s: cannot clear data", 
ftw->path);
+                               error(ERROR_SYSTEM|2, "%s: cannot clear data", 
ent->fts_path);
                        else
                        {
-                               off_t           c = ftw->statb.st_size;
-
-                               static char     buf[SF_BUFSIZE];
+                               off_t           c = ent->fts_statp->st_size;
 
                                for (;;)
                                {
-                                       if (write(n, buf, sizeof(buf)) != 
sizeof(buf))
+                                       if (write(n, state->buf, 
sizeof(state->buf)) != sizeof(state->buf))
                                        {
-                                               error(ERROR_SYSTEM|2, "%s: data 
clear error", ftw->path);
+                                               error(ERROR_SYSTEM|2, "%s: data 
clear error", ent->fts_path);
                                                break;
                                        }
-                                       if (c <= sizeof(buf))
+                                       if (c <= sizeof(state->buf))
                                                break;
-                                       c -= sizeof(buf);
+                                       c -= sizeof(state->buf);
                                }
                                fsync(n);
                                close(n);
@@ -315,9 +315,9 @@
 #endif
                if (remove(path))
                {
-                       nonempty(ftw);
-                       if (!state.force || state.interactive)
-                               error(ERROR_SYSTEM|2, "%s: not removed", 
ftw->path);
+                       nonempty(ent);
+                       if (!state->force || state->interactive)
+                               error(ERROR_SYSTEM|2, "%s: not removed", 
ent->fts_path);
                        else
                                error_info.errors++;
                }
@@ -329,15 +329,13 @@
 int
 b_rm(int argc, register char** argv, void* context)
 {
-       int     set3d;
+       State_t         state;
+       FTS*            fts;
+       FTSENT*         ent;
+       int             set3d;
 
-       if (argc < 0)
-       {
-               state.interrupt = 1;
-               return -1;
-       }
+       cmdinit(argc, argv, context, ERROR_CATALOG, ERROR_NOTIFY);
        memset(&state, 0, sizeof(state));
-       cmdinit(argv, context, ERROR_CATALOG, ERROR_NOTIFY);
        state.fs3d = fs3d(FS3D_TEST);
        state.terminal = isatty(0);
        for (;;)
@@ -403,7 +401,13 @@
        }
        else
                set3d = 0;
-       ftwalk((char*)argv, rm, FTW_MULTIPLE|FTW_PHYSICAL|FTW_TWICE, NiL);
+       if (fts = fts_open(argv, FTS_PHYSICAL, NiL))
+       {
+               while ((ent = fts_read(fts)) && !rm(&state, ent));
+               fts_close(fts);
+       }
+       else if (!state.force)
+               error(ERROR_SYSTEM|2, "%s: error", argv[0]);
        if (set3d)
                fs3d(set3d);
        return error_info.errors != 0;
diff -r -N -u ksh93_2006_09_12/src/lib/libcmd/rmdir.c 
ksh93_2006_10_31/src/lib/libcmd/rmdir.c
--- ksh93_2006_09_12/src/lib/libcmd/rmdir.c     2006-08-25 05:25:19.000000000 
+0200
+++ ksh93_2006_10_31/src/lib/libcmd/rmdir.c     2006-11-01 21:17:06.000000000 
+0100
@@ -27,7 +27,7 @@
  */
 
 static const char usage[] =
-"[-?\n@(#)$Id: rmdir (AT&T Labs Research) 2006-08-24 $\n]"
+"[-?\n@(#)$Id: rmdir (AT&T Research) 2006-08-24 $\n]"
 USAGE_LICENSE
 "[+NAME?rmdir - remove empty directories]"
 "[+DESCRIPTION?\brmdir\b deletes each given directory.  The directory "
@@ -51,7 +51,7 @@
 "[+SEE ALSO?\bmkdir\b(1), \brm\b(1), \brmdir\b(2), \bunlink\b(2)]"
 ;
 
-#include <cmdlib.h>
+#include <cmd.h>
 
 int
 b_rmdir(int argc, char** argv, void* context)
@@ -63,8 +63,7 @@
        int             pflag = 0;
        int             sflag = 0;
 
-       NoP(argc);
-       cmdinit(argv, context, ERROR_CATALOG, 0);
+       cmdinit(argc, argv, context, ERROR_CATALOG, 0);
        while (n = optget(argv, usage)) switch (n)
        {
        case 'e':
diff -r -N -u ksh93_2006_09_12/src/lib/libcmd/stty.c 
ksh93_2006_10_31/src/lib/libcmd/stty.c
--- ksh93_2006_09_12/src/lib/libcmd/stty.c      2006-08-30 16:28:45.000000000 
+0200
+++ ksh93_2006_10_31/src/lib/libcmd/stty.c      2006-11-02 07:50:43.000000000 
+0100
@@ -26,7 +26,7 @@
  */
 
 static const char usage[] =
-"[-?@(#)$Id: stty (AT&T Labs Research) 2003-06-04 $\n]"
+"[-?@(#)$Id: stty (AT&T Research) 2006-10-31 $\n]"
 USAGE_LICENSE
 "[+NAME?stty - set or get terminal modes]"
 "[+DESCRIPTION?\bstty\b sets certain terminal I/O modes for the device "
@@ -59,8 +59,6 @@
 
 
 #include       <cmd.h>
-#include       <ast.h>
-#include       <error.h>
 #include       <ccode.h>
 #include       <ctype.h>
 #include       <ast_tty.h>
@@ -118,19 +116,19 @@
 
 typedef struct tty_s
 {
-       const char      *name;
+       const char      name[8];
        unsigned char   type;
        unsigned char   field;
        short           flags;
        unsigned long   mask;
        unsigned long   val;
-       const char      *description;
+       const char      description[76];
 } Tty_t; 
 
 static const Tty_t Ttable[] =
 {
 #ifdef CBAUD
-{ "ispeed",    NUM,    C_SPEED,0,      CBAUD, 0, C("\an\a is the input baud 
rate")},
+{ "ispeed",    NUM,    C_SPEED,0,      CBAUD, 0, C("\an\a is the input baud 
rate") },
 { "ospeed",    NUM,    C_SPEED,0,      CBAUD, 0, C("\an\a is the output baud 
rate") },
 { "speed",     NUM,    C_SPEED,IG,     CBAUD },
 #endif
@@ -175,7 +173,7 @@
 { "stop",      CHAR,   T_CHAR, SS,     VSTOP, 'S', C("Stop the output") },
 #endif /* VSTOP */
 #ifdef VDSUSP
-{ "dsusp",     CHAR,   T_CHAR, SS,     VDSUSP, 'Y', C("Send a terminal stop 
signal  after flushing the input.") },
+{ "dsusp",     CHAR,   T_CHAR, SS,     VDSUSP, 'Y', C("Send a terminal stop 
signal after flushing the input") },
 #endif /* VDSUSP */
 #ifdef VSUSP
 { "susp",      CHAR,   T_CHAR, NL|SS,  VSUSP, 'Z', C("Send a terminal stop 
signal") },
@@ -184,33 +182,33 @@
 { "rprnt",     CHAR,   T_CHAR, SS,     VREPRINT, 'R', C("Redraw the current 
line") },
 #endif /* VREPRINT */
 #ifdef VDISCARD
-{ "flush",     CHAR,   T_CHAR, SS,     VDISCARD, 'O', C("Discard output.") },
+{ "flush",     CHAR,   T_CHAR, SS,     VDISCARD, 'O', C("Discard output") },
 #endif /* VDISCARD */
 #ifdef VWERASE
 { "werase",    CHAR,   T_CHAR, SS,     VWERASE, 'W', C("Erase the last word 
entered") },
 #endif /* VWERASE */
 #ifdef VLNEXT
-{ "lnext",     CHAR,   T_CHAR, NL|SS,  VLNEXT, 'V', C("Enter the next 
character typed literally, even  if it is a special character") },
+{ "lnext",     CHAR,   T_CHAR, NL|SS,  VLNEXT, 'V', C("Enter the next input 
character literally") },
 #endif /* VLNEXT */
        
 #if _mem_c_line_termios
-{ "line",      NUM,    C_LINE, 0,      0, 0, C("Line discipline number")},
+{ "line",      NUM,    C_LINE, 0,      0, 0, C("Line discipline number") },
 #endif
-{ "min",       NUM,    T_CHAR, 0,      VMIN, 0, C("Mininmum number of 
characters to read in raw mode")},
-{ "time",      NUM,    T_CHAR, 0,      VTIME, 0, C("Number of .1 second 
intervals with raw mode")},
+{ "min",       NUM,    T_CHAR, 0,      VMIN, 0, C("Mininmum number of 
characters to read in raw mode") },
+{ "time",      NUM,    T_CHAR, 0,      VTIME, 0, C("Number of .1 second 
intervals with raw mode") },
 
 { "parenb",    BIT,    C_FLAG, 0,      PARENB, PARENB, C("Enable (disable) 
parity generation and detection") },
-{ "parodd",    BIT,    C_FLAG, 0,      PARODD, PARODD,  "Use odd (even) 
parity" },
+{ "parodd",    BIT,    C_FLAG, 0,      PARODD, PARODD, C("Use odd (even) 
parity") },
 #ifdef PAREXT
 { "parext",    BIT,    C_FLAG, 0,      PAREXT, PAREXT },
 #endif /* PAREXT */
 #ifdef CREAD
 { "cread",     BIT,    C_FLAG, SS,     CREAD, CREAD, C("Enable (disable) 
input") },
 #endif /* CREAD */
-{ "cs5",       SIZE,   C_FLAG, 0,      CSIZE,  CS5 , C("Char size 5")},
-{ "cs6",       SIZE,   C_FLAG, 0,      CSIZE,  CS6 , C("Char size 6")},
-{ "cs7",       SIZE,   C_FLAG, 0,      CSIZE,  CS7 , C("Char size 7")},
-{ "cs8",       SIZE,   C_FLAG, 0,      CSIZE,  CS8 , C("Char size 8")},
+{ "cs5",       SIZE,   C_FLAG, 0,      CSIZE,  CS5 , C("Char size 5") },
+{ "cs6",       SIZE,   C_FLAG, 0,      CSIZE,  CS6 , C("Char size 6") },
+{ "cs7",       SIZE,   C_FLAG, 0,      CSIZE,  CS7 , C("Char size 7") },
+{ "cs8",       SIZE,   C_FLAG, 0,      CSIZE,  CS8 , C("Char size 8") },
 { "hupcl",     BIT,    C_FLAG, 0,      HUPCL, HUPCL, C("Hangup (do not hangup) 
connection on last close") },
 { "hup",       BIT,    C_FLAG, IG,     HUPCL, HUPCL, C("Same as \bhupcl\b") },
 { "cstopb",    BIT,    C_FLAG, 0,      CSTOPB, CSTOPB, C("Use two (one) stop 
bits") },
@@ -221,8 +219,8 @@
        
 { "ignbrk",    BIT,    I_FLAG, US,     IGNBRK, IGNBRK, C("Ignore (do not 
ignore) break characters") },
 { "brkint",    BIT,    I_FLAG, SS,     BRKINT, BRKINT, C("Generate (do not 
generate) INTR signal on break") },
-{ "ignpar",    BIT,    I_FLAG, 0,      IGNPAR, IGNPAR, C("Ignore (do not 
ignore) characters with parity errors")},
-{ "parmrk",    BIT,    I_FLAG, 0,      PARMRK, PARMRK, C("Mark (do not mark) 
parity errors")},
+{ "ignpar",    BIT,    I_FLAG, 0,      IGNPAR, IGNPAR, C("Ignore (do not 
ignore) characters with parity errors") },
+{ "parmrk",    BIT,    I_FLAG, 0,      PARMRK, PARMRK, C("Mark (do not mark) 
parity errors") },
 { "inpck",     BIT,    I_FLAG, 0,      INPCK, INPCK, C("Enable (disable) input 
parity checking") },
 { "istrip",    BIT,    I_FLAG, 0,      ISTRIP, ISTRIP, C("Clear (do not clear) 
high bit of input characters") },
 { "inlcr",     BIT,    I_FLAG, US,     INLCR, INLCR, C("Translate (do not 
translate) carriage return to newline") },
@@ -230,14 +228,14 @@
 #ifdef IUCLC
 { "iuclc",     BIT,    I_FLAG, US,     IUCLC, IUCLC, C("Map (do not map) 
upper-case to lower case") },
 #endif /* IUCLC */
-{ "ixon",      BIT,    I_FLAG, 0,      IXON, IXON, C("Enable (disable) 
XON/XOFF flow control.  Output is stopped with \bstop\b character") },
+{ "ixon",      BIT,    I_FLAG, 0,      IXON, IXON, C("Enable (disable) 
XON/XOFF flow control. \bstop\b character stops output") },
 #ifdef IXANY
-{ "ixany",     BIT,    I_FLAG, US,     IXANY, IXANY, C("Any character (only 
start character) can restart output.  Otherwise, only \bstart\b character can 
restart output") },
+{ "ixany",     BIT,    I_FLAG, US,     IXANY, IXANY, C("Any character (only 
start character) can restart output.") },
 { "decctlq",   BIT,    I_FLAG, IG,     IXANY, 0, C("Same as \b-ixany\b") },
 #endif /* IXANY */
 { "ixoff",     BIT,    I_FLAG, US,     IXOFF, IXOFF, C("Disable (enable) 
XON/XOFF flow control") },
 #ifdef IMAXBEL
-{ "imaxbel",   BIT,    I_FLAG, SS,     IMAXBEL, IMAXBEL, C("Beep (do not beep) 
if a character arrives with full input buffer")},
+{ "imaxbel",   BIT,    I_FLAG, SS,     IMAXBEL, IMAXBEL, C("Beep (do not beep) 
if a character arrives with full input buffer") },
 #endif /* IMAXBEL */
 { "icrnl",     BIT,    I_FLAG, NL|SS,  ICRNL, ICRNL, C("Translate (do not 
translate) carriage return to newline") },
        
@@ -254,32 +252,32 @@
 { "echoke",    BIT,    L_FLAG, SS,     ECHOKE, ECHOKE, C("Echo (do not echo) a 
newline after a kill character") },
 #endif
 { "lfkc",      BIT,    L_FLAG, IG,     ECHOK, ECHOK, C("Same as \bechok\b 
(\b-echok\b); obsolete") },
-{ "echonl",    BIT,    L_FLAG, SS,     ECHONL, ECHONL,"Echo (do not echo) 
newline even if not echoing other  character" },
+{ "echonl",    BIT,    L_FLAG, SS,     ECHONL, ECHONL,"Echo (do not echo) 
newline even if not echoing other character" },
 #ifdef ECHOCTL
-{ "echoctl",   BIT,    L_FLAG, SS,     ECHOCTL, ECHOCTL, C("Echo (do not echo) 
control  characters as \b^\b\ac\a") },
+{ "echoctl",   BIT,    L_FLAG, SS,     ECHOCTL, ECHOCTL, C("Echo (do not echo) 
control characters as \b^\b\ac\a") },
 #else
 #define ECHOCTL                0
 #endif /* ECHOCTL */
 #ifdef ECHOPRT
-{ "echoprt",   BIT,    L_FLAG, US,     ECHOPRT, ECHOPRT, C("Echo  (do not 
echo) erased  characters  backward, between '\\' and '/'") },
+{ "echoprt",   BIT,    L_FLAG, US,     ECHOPRT, ECHOPRT, C("Echo (do not echo) 
erased characters backward, between '\\' and '/'") },
 #else
 #define ECHOPRT                0
 #endif /* ECHOPRT */
 #ifdef XCASE
-{ "xcase",     BIT,    L_FLAG, US,     XCASE, XCASE,"Enable (disable) input 
and output of uppercase characters  by preceding  their  lowercase  equivalents 
 with'\\' when \bicanon\b is set" },
+{ "xcase",     BIT,    L_FLAG, US,     XCASE, XCASE, C("Enable (disable) 
\bicanon\b uppercase as lowercase with '\\' prefix") },
 #endif /* XCASE */
 #ifdef DEFECHO
 { "defecho",   BIT,    L_FLAG, 0,      DEFECHO, DEFECHO },
 #endif /* DEFECHO */
 #ifdef FLUSHO
-{ "flusho",    BIT,    L_FLAG, 0,      FLUSHO, FLUSHO, C("Discard (do not 
discard) data written to the terminal.  Cleared by subsequent input to the 
terminal") },
+{ "flusho",    BIT,    L_FLAG, 0,      FLUSHO, FLUSHO, C("Discard (do not 
discard) written data. Cleared by subsequent input") },
 #endif /* FLUSHO */
 #ifdef PENDIN
 { "pendin",    BIT,    L_FLAG, 0,      PENDIN, PENDIN, C("Redisplay pending 
input at next read and then automatically clear \bpendin\b") },
 #endif /* PENDIN */
-{ "noflsh",    BIT,    L_FLAG, US,     NOFLSH, NOFLSH, C("Disable  (enable) 
flushing  after \bintr\b and \bquit\b special characters") },
+{ "noflsh",    BIT,    L_FLAG, US,     NOFLSH, NOFLSH, C("Disable (enable) 
flushing after \bintr\b and \bquit\b special characters") },
 #ifdef TOSTOP
-{ "tostop",    BIT,    L_FLAG, NL|US,  TOSTOP, TOSTOP, C("Stop (do not stop) 
background jobs that try to write to the  terminal") },
+{ "tostop",    BIT,    L_FLAG, NL|US,  TOSTOP, TOSTOP, C("Stop (do not stop) 
background jobs that try to write to the terminal") },
 #endif /* TOSTOP */
 #ifdef OLCUC
 { "olcuc",     BIT,    O_FLAG, US,     OLCUC, OLCUC, C("Translate (do not 
translate) lowercase characters to uppercase") },
@@ -297,10 +295,10 @@
 { "onocr",     BIT,    O_FLAG, US,     ONOCR, ONOCR, C("Do not (do) print 
carriage returns in the first column") },
 #endif /* ONOCR */
 #ifdef OFILL
-{ "ofill",     BIT,    O_FLAG, US,     OFILL, OFILL, C("Use fill characters 
(use timing) for delays")},
+{ "ofill",     BIT,    O_FLAG, US,     OFILL, OFILL, C("Use fill characters 
(use timing) for delays") },
 #endif /* OFILL */
 #ifdef OFDEL
-{ "ofdel",     BIT,    O_FLAG, US,     OFDEL, OFDEL, C("Use DEL (NUL) as fill 
characters for delays")},
+{ "ofdel",     BIT,    O_FLAG, US,     OFDEL, OFDEL, C("Use DEL (NUL) as fill 
characters for delays") },
 #endif /* OFDEL */
 { "opost",     BIT,    O_FLAG, SS,     OPOST, OPOST, C(" Postprocess (do not 
postprocess) output") },
 #ifdef CRDLY
@@ -334,15 +332,15 @@
 #endif
 { "",          MIXED,  O_FLAG, NL|IG },
        
-{ "evenp",     MIXED,  C_FLAG, IG,     PARENB, 0, C("Same as \bparenb -parodd 
cs7\b")},
-{ "oddp",      MIXED,  C_FLAG, IG,     PARODD, 0, C("Same  as  \bparenb parodd 
 cs7\b") },
+{ "evenp",     MIXED,  C_FLAG, IG,     PARENB, 0, C("Same as \bparenb -parodd 
cs7\b") },
+{ "oddp",      MIXED,  C_FLAG, IG,     PARODD, 0, C("Same as \bparenb parodd 
cs7\b") },
 { "parity",    MIXED,  C_FLAG, IG,     0, 0, C("Same as parenb \b-parodd 
cs7\b") },
-{ "ek",                MIXED,  C_FLAG, IG,     0, 0, C("Reset the \berase\b 
and \bkill\b  special characters to their default values") },
+{ "ek",                MIXED,  C_FLAG, IG,     0, 0, C("Reset the \berase\b 
and \bkill\b special characters to their default values") },
 { "sane",      SANE,   C_FLAG, IG,     0, 0, C("Reset all modes to some 
reasonable values") },
 { "cooked",    COOKED, C_FLAG, IG,     0, 0, C("Disable raw input and output") 
},
-{ "raw",       COOKED, C_FLAG, IG,     0, 0, C("Enable raw input and output")  
},
-{ "lcase",     CASE,   C_FLAG, IG,     0 , 0, C("Set \bxcase\b, \biuclc\b, and 
\bolcuc\b")},
-{ "LCASE",     CASE,   C_FLAG, IG,     0 , 0, C("Same as \blcase\b")}
+{ "raw",       COOKED, C_FLAG, IG,     0, 0, C("Enable raw input and output") 
},
+{ "lcase",     CASE,   C_FLAG, IG,     0 , 0, C("Set \bxcase\b, \biuclc\b, and 
\bolcuc\b") },
+{ "LCASE",     CASE,   C_FLAG, IG,     0 , 0, C("Same as \blcase\b") }
 };
 
 #if CC_NATIVE == CC_ASCII
@@ -462,7 +460,7 @@
        struct termios tty;
        register int delim = ' ';
        register int i,off,off2;
-       static char schar[2];
+       char schar[2];
        unsigned int ispeed = cfgetispeed(sp);
        unsigned int ospeed = cfgetospeed(sp);
        if(flags&G_FLAG)
@@ -554,14 +552,15 @@
                        if(tp->mask==ispeed)
                        {
                                if(ispeed!=ospeed)
-                                       *schar='i';
+                                       schar[0]='i';
                                else
-                                       *schar=0;
+                                       schar[0]=0;
                        }
                        else if(tp->mask==ospeed)
-                               *schar='o';
+                               schar[0]='o';
                        else
                                continue;
+                       schar[1] = 0;
 #ifdef TIOCSWINSZ
                        {
                                struct winsize win;
@@ -622,7 +621,7 @@
        return(*((unsigned char*)cp));
 }
 
-static void setmode(char *argv[], struct termios *sp)
+static void set(char *argv[], struct termios *sp)
 {
        const Tty_t *tp;
        register int c,off;
@@ -783,7 +782,7 @@
        c = (type==CHAR?'c':'n');
        for(i=0; i < elementsof(Ttable); i++)
        {
-               if(Ttable[i].type==type && Ttable[i].description)
+               if(Ttable[i].type==type && *Ttable[i].description)
                        sfprintf(sp,"[+%s 
\a%c\a?%s.]",Ttable[i].name,c,Ttable[i].description);
        }
 }
@@ -817,7 +816,7 @@
        int i;
        for(i=0; i < elementsof(Ttable); i++)
        {
-               if(Ttable[i].field==field &&  Ttable[i].type==BIT && 
Ttable[i].description)
+               if(Ttable[i].field==field &&  Ttable[i].type==BIT && 
*Ttable[i].description)
                        sfprintf(sp,"[+%s 
(-%s)?%s.]",Ttable[i].name,Ttable[i].name,Ttable[i].description);
        }
 }
@@ -887,8 +886,7 @@
        const Tty_t*            tp;
        Optdisc_t               disc;
 
-       NoP(argc);
-       cmdinit(argv, context, ERROR_CATALOG, ERROR_INTERACTIVE);
+       cmdinit(argc, argv, context, ERROR_CATALOG, ERROR_INTERACTIVE);
        if (tcgetattr(0, &tty) < 0)
                error(ERROR_system(1),"not a tty");
        memset(&disc, 0, sizeof(disc));
@@ -935,7 +933,7 @@
                if (!argv[1] && **argv == ':')
                        gin(*argv, &tty);
                else
-                       setmode(argv, &tty);
+                       set(argv, &tty);
                if (tcsetattr(0, TCSANOW, &tty) < 0)
                        error(ERROR_system(1), "cannot set tty");
        }
diff -r -N -u ksh93_2006_09_12/src/lib/libcmd/sync.c 
ksh93_2006_10_31/src/lib/libcmd/sync.c
--- ksh93_2006_09_12/src/lib/libcmd/sync.c      1970-01-01 01:00:00.000000000 
+0100
+++ ksh93_2006_10_31/src/lib/libcmd/sync.c      2006-11-01 21:17:11.000000000 
+0100
@@ -0,0 +1,79 @@
+/***********************************************************************
+*                                                                      *
+*               This software is part of the ast package               *
+*           Copyright (c) 1992-2006 AT&T Knowledge Ventures            *
+*                      and is licensed under the                       *
+*                  Common Public License, Version 1.0                  *
+*                      by AT&T Knowledge Ventures                      *
+*                                                                      *
+*                A copy of the License is available at                 *
+*            http://www.opensource.org/licenses/cpl1.0.txt             *
+*         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
+*                                                                      *
+*              Information and Software Systems Research               *
+*                            AT&T Research                             *
+*                           Florham Park NJ                            *
+*                                                                      *
+*                 Glenn Fowler <gsf at research.att.com>                  *
+*                  David Korn <dgk at research.att.com>                   *
+*                                                                      *
+***********************************************************************/
+#pragma prototyped
+/*
+ * David Korn
+ * Glenn Fowler
+ * AT&T Research
+ */
+
+static const char usage[] =
+"[-?\n@(#)$Id: sync (AT&T Research) 2006-10-04 $\n]"
+USAGE_LICENSE
+"[+NAME?sync - schedule file system updates]"
+"[+DESCRIPTION?\bsync\b calls \bsync\b(2), which causes all information "
+    "in memory that updates file systems to be scheduled for writing out to "
+    "all file systems. The writing, although scheduled, is not necessarily "
+    "complete upon return from \bsync\b.]"
+"[+?Since \bsync\b(2) has no failure indication, \bsync\b only fails for "
+    "option/operand syntax errors, or when \bsync\b(2) does not return, in "
+    "which case \bsync\b also does not return.]"
+"[+?At minimum \bsync\b should be called before halting the system. Most "
+    "systems provide graceful shutdown procedures that include \bsync\b -- "
+    "use them if possible.]"
+"[+EXIT STATUS?]"
+    "{"
+        "[+0?\bsync\b(2) returned.]"
+        "[+>0?Option/operand syntax error.]"
+    "}"
+"[+SEE ALSO?\bsync\b(2), \bshutdown\b(8)]"
+;
+
+#include <cmd.h>
+#include <ls.h>
+
+int
+b_sync(int argc, char** argv, void* context)
+{
+       cmdinit(argc, argv, context, ERROR_CATALOG, 0);
+       for (;;)
+       {
+               switch (optget(argv, usage))
+               {
+               case ':':
+                       error(2, "%s", opt_info.arg);
+                       break;
+               case '?':
+                       error(ERROR_usage(2), "%s", opt_info.arg);
+                       break;
+               }
+               break;
+       }
+       argv += opt_info.index;
+       if (error_info.errors || *argv)
+               error(ERROR_usage(2), "%s", optusage(NiL));
+#if _lib_sync
+       sync();
+#else
+       error(ERROR_usage(2), "failed -- the native system does not provide a 
sync(2) call");
+#endif
+       return 0;
+}
diff -r -N -u ksh93_2006_09_12/src/lib/libcmd/tail.c 
ksh93_2006_10_31/src/lib/libcmd/tail.c
--- ksh93_2006_09_12/src/lib/libcmd/tail.c      2006-09-13 04:33:23.000000000 
+0200
+++ ksh93_2006_10_31/src/lib/libcmd/tail.c      2006-11-01 21:25:35.000000000 
+0100
@@ -28,7 +28,7 @@
  */
 
 static const char usage[] =
-"+[-?\n@(#)$Id: tail (AT&T Labs Research) 2006-09-11 $\n]"
+"+[-?\n@(#)$Id: tail (AT&T Research) 2006-10-18 $\n]"
 USAGE_LICENSE
 "[+NAME?tail - output trailing portion of one or more files ]"
 "[+DESCRIPTION?\btail\b copies one or more input files to standard output "
@@ -93,10 +93,11 @@
 "[+SEE ALSO?\bcat\b(1), \bhead\b(1), \brev\b(1)]"
 ;
 
-#include <cmdlib.h>
+#include <cmd.h>
 #include <ctype.h>
 #include <ls.h>
 #include <tm.h>
+#include <rev.h>
 
 #define COUNT          (1<<0)
 #define ERROR          (1<<1)
@@ -303,7 +304,7 @@
  */
 
 static _ast_intmax_t
-strtonum(register const char* s, char** e, int* f, int o)
+num(register const char* s, char** e, int* f, int o)
 {
        _ast_intmax_t   number;
        char*           t;
@@ -380,7 +381,7 @@
        register Tail_t*        hp;
        Tail_t*                 files;
 
-       cmdinit(argv, context, ERROR_CATALOG, 0);
+       cmdinit(argc, argv, context, ERROR_CATALOG, 0);
        for (;;)
        {
                switch (n = optget(argv, usage))
@@ -397,7 +398,7 @@
                case 'N':
                        flags |= COUNT;
                        if (s = opt_info.arg)
-                               number = strtonum(s, &s, &flags, n);
+                               number = num(s, &s, &flags, n);
                        else
                        {
                                number = LINES;
@@ -449,7 +450,7 @@
                case ':':
                        /* handle old style arguments */
                        r = s = argv[opt_info.index];
-                       number = strtonum(s, &t, &flags, 0);
+                       number = num(s, &t, &flags, 0);
                        for (;;)
                        {
                                switch (*t++)
@@ -473,7 +474,7 @@
                                        continue;
                                default:
                                        error(2, "%s: invalid suffix", t - 1);
-                                       opt_info.offset = t - r;
+                                       opt_info.offset = strlen(r);
                                        break;
                                }
                                break;
diff -r -N -u ksh93_2006_09_12/src/lib/libcmd/tee.c 
ksh93_2006_10_31/src/lib/libcmd/tee.c
--- ksh93_2006_09_12/src/lib/libcmd/tee.c       2002-11-14 22:32:41.000000000 
+0100
+++ ksh93_2006_10_31/src/lib/libcmd/tee.c       2006-11-01 21:17:18.000000000 
+0100
@@ -27,7 +27,7 @@
  */
 
 static const char usage[] =
-"[-?\n@(#)$Id: tee (AT&T Labs Research) 1999-04-28 $\n]"
+"[-?\n@(#)$Id: tee (AT&T Research) 2006-10-10 $\n]"
 USAGE_LICENSE
 "[+NAME?tee - duplicate standard input]"
 "[+DESCRIPTION?\btee\b copies standard input to standard output "
@@ -41,6 +41,7 @@
 "[a:append?Append the standard input to the given files rather "
        "than overwriting them.]"
 "[i:ignore-interrupts?Ignore SIGINT signal.]"
+"[l:linebuffer?Set the standard output to be line buffered.]"
 "\n"
 "\n[file ...]\n"
 "\n"
@@ -52,16 +53,15 @@
 ;
 
 
-#include <cmdlib.h>
-
+#include <cmd.h>
 #include <ls.h>
 #include <sig.h>
 
-struct tee
+typedef struct Tee_s
 {
        Sfdisc_t        disc;
        int             fd[1];
-};
+} Tee_t;
 
 /*
  * This discipline writes to each file in the list given in handle
@@ -71,7 +71,7 @@
 {
        register const char*    bp;
        register const char*    ep;
-       register int*           hp = ((struct tee*)handle)->fd;
+       register int*           hp = ((Tee_t*)handle)->fd;
        register int            fd = sffileno(fp);
        register ssize_t        r;
 
@@ -89,18 +89,19 @@
        return(n);
 }
 
-static Sfdisc_t tee_disc = { 0, tee_write, 0, 0, 0 };
-
 int
 b_tee(int argc, register char** argv, void* context)
 {
-       register struct tee*    tp = 0;
+       register Tee_t*         tp = 0;
        register int            oflag = O_WRONLY|O_TRUNC|O_CREAT|O_BINARY;
        register int            n;
        register int*           hp;
        register char*          cp;
+       int                     line;
+       Sfdisc_t                tee_disc;
 
-       cmdinit(argv, context, ERROR_CATALOG, 0);
+       cmdinit(argc, argv, context, ERROR_CATALOG, 0);
+       line = -1;
        while (n = optget(argv, usage)) switch (n)
        {
        case 'a':
@@ -110,6 +111,13 @@
        case 'i':
                signal(SIGINT, SIG_IGN);
                break;
+       case 'l':
+               line = sfset(sfstdout, 0, 0) & SF_LINE;
+               if ((line == 0) == (opt_info.num == 0))
+                       line = -1;
+               else
+                       sfset(sfstdout, SF_LINE, !!opt_info.num);
+               break;
        case ':':
                error(2, "%s", opt_info.arg);
                break;
@@ -134,8 +142,10 @@
        }
        if (argc > 0)
        {
-               if (!(tp = (struct tee*)stakalloc(sizeof(struct tee) + argc * 
sizeof(int))))
+               if (!(tp = (Tee_t*)stakalloc(sizeof(Tee_t) + argc * 
sizeof(int))))
                        error(ERROR_exit(1), "no space");
+               memset(&tee_disc, 0, sizeof(tee_disc));
+               tee_disc.writef = tee_write;
                tp->disc = tee_disc;
                hp = tp->fd;
                while (cp = *argv++)
@@ -144,7 +154,8 @@
                                error(ERROR_system(0), "%s: cannot create", cp);
                        else hp++;
                }
-               if (hp == tp->fd) tp = 0;
+               if (hp == tp->fd)
+                       tp = 0;
                else
                {
                        *hp = -1;
@@ -161,6 +172,8 @@
        if (tp)
        {
                sfdisc(sfstdout, NiL);
+               if (line >= 0)
+                       sfset(sfstdout, SF_LINE, line);
                for(hp = tp->fd; (n = *hp) >= 0; hp++)
                        close(n);
        }
diff -r -N -u ksh93_2006_09_12/src/lib/libcmd/tty.c 
ksh93_2006_10_31/src/lib/libcmd/tty.c
--- ksh93_2006_09_12/src/lib/libcmd/tty.c       2002-11-14 22:32:44.000000000 
+0100
+++ ksh93_2006_10_31/src/lib/libcmd/tty.c       2006-11-01 21:17:23.000000000 
+0100
@@ -27,7 +27,7 @@
  */
 
 static const char usage[] =
-"[-?\n@(#)$Id: tty (AT&T Labs Research) 1999-04-10 $\n]"
+"[-?\n@(#)$Id: tty (AT&T Research) 1999-04-10 $\n]"
 USAGE_LICENSE
 "[+NAME?tty - write the name of the terminal to standard output]"
 "[+DESCRIPTION?\btty\b writes the name of the terminal that is connected "
@@ -44,7 +44,7 @@
 ;
 
 
-#include <cmdlib.h>
+#include <cmd.h>
 
 int
 b_tty(int argc, char *argv[], void* context)
@@ -52,8 +52,7 @@
        register int n,sflag=0;
        register char *tty;
 
-       NoP(argc);
-       cmdinit(argv, context, ERROR_CATALOG, 0);
+       cmdinit(argc, argv, context, ERROR_CATALOG, 0);
        while (n = optget(argv, usage)) switch (n)
        {
        case 's':
diff -r -N -u ksh93_2006_09_12/src/lib/libcmd/uname.c 
ksh93_2006_10_31/src/lib/libcmd/uname.c
--- ksh93_2006_09_12/src/lib/libcmd/uname.c     2006-05-18 17:10:17.000000000 
+0200
+++ ksh93_2006_10_31/src/lib/libcmd/uname.c     2006-11-01 21:17:27.000000000 
+0100
@@ -28,7 +28,7 @@
  */
 
 static const char usage[] =
-"[-?\n@(#)$Id: uname (AT&T Labs Research) 2006-05-09 $\n]"
+"[-?\n@(#)$Id: uname (AT&T Research) 2006-05-09 $\n]"
 USAGE_LICENSE
 "[+NAME?uname - identify the current system ]"
 "[+DESCRIPTION?By default \buname\b writes the operating system name to"
@@ -51,7 +51,7 @@
 "[v:version|kernel-version?The kernel version level.]"
 "[m:machine?The name of the hardware type the system is running on.]"
 "[p:processor?The name of the processor instruction set architecture.]"
-"[i:implementation|platform|herdware-platform?The hardware implementation;"
+"[i:implementation|platform|hardware-platform?The hardware implementation;"
 "      this is \b--host-id\b on some systems.]"
 "[o:operating-system?The generic operating system name.]"
 "[h:host-id|id?The host id in hex.]"
@@ -75,7 +75,7 @@
 #define sethostname    ______sethostname
 #endif
 
-#include <cmdlib.h>
+#include <cmd.h>
 #include <ctype.h>
 #include <proc.h>
 
@@ -115,7 +115,7 @@
 #define HOSTTYPE       "unknown"
 #endif
 
-static char    hosttype[] = HOSTTYPE;
+static const char      hosttype[] = HOSTTYPE;
 
 #if !_lib_uname || !_sys_utsname
 
@@ -149,7 +149,10 @@
 
        if (*hosttype)
        {
-               sys = hosttype;
+               static char     buf[sizeof(hosttype)];
+
+               strcpy(buf, hosttype);
+               sys = buf;
                if (arch = strchr(sys, '.'))
                {
                        *arch++ = 0;
@@ -257,8 +260,7 @@
        struct utsname  ut;
        char            buf[257];
 
-       NoP(argc);
-       cmdinit(argv, context, ERROR_CATALOG, 0);
+       cmdinit(argc, argv, context, ERROR_CATALOG, 0);
        for (;;)
        {
                switch (optget(argv, usage))
@@ -401,7 +403,7 @@
                                if (t = strchr(hosttype, '.'))
                                        t++;
                                else
-                                       t = hosttype;
+                                       t = (char*)hosttype;
                                strncpy(s = buf, t, sizeof(buf) - 1);
                        }
                        output(OPT_implementation, s, "implementation");
diff -r -N -u ksh93_2006_09_12/src/lib/libcmd/uniq.c 
ksh93_2006_10_31/src/lib/libcmd/uniq.c
--- ksh93_2006_09_12/src/lib/libcmd/uniq.c      2006-08-28 09:40:43.000000000 
+0200
+++ ksh93_2006_10_31/src/lib/libcmd/uniq.c      2006-11-01 21:17:29.000000000 
+0100
@@ -26,7 +26,7 @@
  */
 
 static const char usage[] =
-"[-?\n@(#)$Id: uniq (AT&T Labs Research) 2006-08-28 $\n]"
+"[-?\n@(#)$Id: uniq (AT&T Research) 2006-08-28 $\n]"
 USAGE_LICENSE
 "[+NAME?uniq - Report or filter out repeated lines in a file]"
 "[+DESCRIPTION?\buniq\b reads an input, comparing adjacent lines, and "
@@ -69,7 +69,7 @@
 "[+SEE ALSO?\bsort\b(1), \bgrep\b(1)]"
 ;
 
-#include <cmdlib.h>
+#include <cmd.h>
 
 #define C_FLAG 1
 #define D_FLAG 2
@@ -217,8 +217,7 @@
        int sep;
        Compare_f compare = (Compare_f)memcmp;
 
-       NoP(argc);
-       cmdinit(argv, context, ERROR_CATALOG, 0);
+       cmdinit(argc, argv, context, ERROR_CATALOG, 0);
        while (n = optget(argv, usage)) switch (n)
        {
            case 'c':
diff -r -N -u ksh93_2006_09_12/src/lib/libcmd/wc.c 
ksh93_2006_10_31/src/lib/libcmd/wc.c
--- ksh93_2006_09_12/src/lib/libcmd/wc.c        2006-08-25 18:35:57.000000000 
+0200
+++ ksh93_2006_10_31/src/lib/libcmd/wc.c        2006-11-01 21:17:31.000000000 
+0100
@@ -27,7 +27,7 @@
  */
 
 static const char usage[] =
-"[-?\n@(#)$Id: wc (AT&T Labs Research) 2006-08-25 $\n]"
+"[-?\n@(#)$Id: wc (AT&T Research) 2006-08-25 $\n]"
 USAGE_LICENSE
 "[+NAME?wc - print the number of bytes, words, and lines in files]"
 "[+DESCRIPTION?\bwc\b reads one or more input files and, by default, "
@@ -62,7 +62,7 @@
 ;
 
 
-#include <cmdlib.h>
+#include <cmd.h>
 #include <wc.h>
 #include <ls.h>
 
@@ -93,8 +93,7 @@
        Sfoff_t         tlines=0, twords=0, tchars=0;
        struct stat     statb;
 
-       NoP(argc);
-       cmdinit(argv, context, ERROR_CATALOG, 0);
+       cmdinit(argc, argv, context, ERROR_CATALOG, 0);
        while (n = optget(argv,usage)) switch (n)
        {
        case 'c':
diff -r -N -u ksh93_2006_09_12/src/lib/libcmd/wclib.c 
ksh93_2006_10_31/src/lib/libcmd/wclib.c
--- ksh93_2006_09_12/src/lib/libcmd/wclib.c     2006-08-25 18:30:58.000000000 
+0200
+++ ksh93_2006_10_31/src/lib/libcmd/wclib.c     2006-11-01 21:17:33.000000000 
+0100
@@ -26,7 +26,7 @@
  * library interface for word count
  */
 
-#include <cmdlib.h>
+#include <cmd.h>
 #include <wc.h>
 #include <ctype.h>
 
diff -r -N -u ksh93_2006_09_12/src/lib/libdll/dlfcn.c 
ksh93_2006_10_31/src/lib/libdll/dlfcn.c
--- ksh93_2006_09_12/src/lib/libdll/dlfcn.c     2005-02-16 06:00:02.000000000 
+0100
+++ ksh93_2006_10_31/src/lib/libdll/dlfcn.c     2006-10-13 05:46:55.000000000 
+0200
@@ -23,10 +23,10 @@
  *
  * David Korn
  * Glenn Fowler
- * AT&T Labs Research
+ * AT&T Research
  */
 
-static const char id[] = "\n@(#)$Id: dll library (AT&T Labs Research) 
2005-02-14 $\0\n";
+static const char id[] = "\n@(#)$Id: dll library (AT&T Research) 2005-02-14 
$\0\n";
 
 #include <ast.h>
 #include <dlldefs.h>
diff -r -N -u ksh93_2006_09_12/src/lib/libdll/dllfind.c 
ksh93_2006_10_31/src/lib/libdll/dllfind.c
--- ksh93_2006_09_12/src/lib/libdll/dllfind.c   2004-10-05 05:36:32.000000000 
+0200
+++ ksh93_2006_10_31/src/lib/libdll/dllfind.c   2006-10-13 05:46:50.000000000 
+0200
@@ -20,7 +20,7 @@
 #pragma prototyped
 /*
  * Glenn Fowler
- * AT&T Labs Research
+ * AT&T Research
  */
 
 #include <ast.h>
diff -r -N -u ksh93_2006_09_12/src/lib/libdll/dlllook.c 
ksh93_2006_10_31/src/lib/libdll/dlllook.c
--- ksh93_2006_09_12/src/lib/libdll/dlllook.c   2000-01-26 22:31:53.000000000 
+0100
+++ ksh93_2006_10_31/src/lib/libdll/dlllook.c   2006-10-13 05:46:58.000000000 
+0200
@@ -20,7 +20,7 @@
 #pragma prototyped
 /*
  * Glenn Fowler
- * AT&T Labs Research
+ * AT&T Research
  */
 
 #include <ast.h>
diff -r -N -u ksh93_2006_09_12/src/lib/libdll/dllnext.c 
ksh93_2006_10_31/src/lib/libdll/dllnext.c
--- ksh93_2006_09_12/src/lib/libdll/dllnext.c   2002-06-27 14:55:04.000000000 
+0200
+++ ksh93_2006_10_31/src/lib/libdll/dllnext.c   2006-10-23 22:11:09.000000000 
+0200
@@ -20,12 +20,15 @@
 #pragma prototyped
 /*
  * Glenn Fowler
- * AT&T Labs Research
+ * AT&T Research
  */
 
 #ifndef _GNU_SOURCE
 #define _GNU_SOURCE    1
 #endif
+#ifndef __EXTENSIONS__
+#define __EXTENSIONS__ 1
+#endif
 
 #include <ast.h>
 #include <dlldefs.h>
@@ -77,7 +80,7 @@
        {
                do
                {
-                       if (!streq(vp, "MAIN") && (lp = dlopen(vp, flags)))
+                       if (strcmp(vp, "MAIN") && (lp = dlopen(vp, flags)))
                        {
                                if (xr = (Write_f)dlsym(lp, "write"))
                                        wr = xr;
@@ -89,7 +92,7 @@
        {
                do
                {
-                       if (lp = dlopen(streq(vp, "MAIN") ? (char*)0 : vp, 
flags))
+                       if (lp = dlopen(strcmp(vp, "MAIN") ? vp : (char*)0, 
flags))
                        {
                                if (found)
                                {
diff -r -N -u ksh93_2006_09_12/src/lib/libdll/dllplug.c 
ksh93_2006_10_31/src/lib/libdll/dllplug.c
--- ksh93_2006_09_12/src/lib/libdll/dllplug.c   2006-01-25 22:06:57.000000000 
+0100
+++ ksh93_2006_10_31/src/lib/libdll/dllplug.c   2006-10-13 05:47:04.000000000 
+0200
@@ -20,7 +20,7 @@
 #pragma prototyped
 /*
  * Glenn Fowler
- * AT&T Labs Research
+ * AT&T Research
  */
 
 #include <ast.h>
diff -r -N -u ksh93_2006_09_12/src/lib/libdll/dllscan.c 
ksh93_2006_10_31/src/lib/libdll/dllscan.c
--- ksh93_2006_09_12/src/lib/libdll/dllscan.c   2005-02-16 05:56:04.000000000 
+0100
+++ ksh93_2006_10_31/src/lib/libdll/dllscan.c   2006-10-13 06:49:50.000000000 
+0200
@@ -20,7 +20,7 @@
 #pragma prototyped
 /*
  * Glenn Fowler
- * AT&T Labs Research
+ * AT&T Research
  */
 
 #define _DLLINFO_PRIVATE_ \
@@ -258,11 +258,7 @@
        else if (t = strrchr(name, '/'))
        {
                if (!(scan->pb = vmnewof(vm, 0, char, t - (char*)name, 2)))
-               {
-                       sfstrclose(scan->tmp);
-                       vmclose(vm);
-                       return 0;
-               }
+                       goto bad;
                memcpy(scan->pb, name, t - (char*)name);
                name = (const char*)(t + 1);
        }
@@ -279,7 +275,9 @@
                        if (isdigit(*s))
                                sfputc(scan->tmp, *s);
                sfprintf(scan->tmp, "%s", info->suffix);
-               sfsprintf(scan->nam, sizeof(scan->nam), "%s", 
sfstruse(scan->tmp));
+               if (!(s = sfstruse(scan->tmp)))
+                       goto bad;
+               sfsprintf(scan->nam, sizeof(scan->nam), "%s", s);
        }
        else
        {
@@ -315,6 +313,9 @@
        scan->prelen = strlen(info->prefix);
        scan->suflen = strlen(info->suffix);
        return scan;
+ bad:
+       dllsclose(scan);
+       return 0;
 }
 
 /*
@@ -384,7 +385,8 @@
                        if (!(scan->flags & DLL_MATCH_NAME))
                        {
                                sfprintf(scan->tmp, "/%s", scan->nam);
-                               p = sfstruse(scan->tmp);
+                               if (!(p = sfstruse(scan->tmp)))
+                                       return 0;
                                if (!eaccess(p, R_OK))
                                {
                                        b = scan->nam;
@@ -396,7 +398,9 @@
                        if (scan->flags & (DLL_MATCH_NAME|DLL_MATCH_VERSION))
                        {
                                sfstrseek(scan->tmp, scan->off, SEEK_SET);
-                               if ((scan->fts = 
fts_open((char**)sfstruse(scan->tmp), FTS_LOGICAL|FTS_NOPOSTORDER|FTS_ONEPATH, 
vercmp)) && (scan->ent = fts_read(scan->fts)) && (scan->ent = 
fts_children(scan->fts, FTS_NOSTAT)))
+                               if (!(t = sfstruse(scan->tmp)))
+                                       return 0;
+                               if ((scan->fts = fts_open((char**)t, 
FTS_LOGICAL|FTS_NOPOSTORDER|FTS_ONEPATH, vercmp)) && (scan->ent = 
fts_read(scan->fts)) && (scan->ent = fts_children(scan->fts, FTS_NOSTAT)))
                                        break;
                        }
                }
@@ -404,7 +408,8 @@
        b = scan->ent->fts_name;
        sfstrseek(scan->tmp, scan->off, SEEK_SET);
        sfprintf(scan->tmp, "/%s", b);
-       p = sfstruse(scan->tmp);
+       if (!(p = sfstruse(scan->tmp)))
+               return 0;
  found:
        b = scan->buf + sfsprintf(scan->buf, sizeof(scan->buf), "%s", b + 
scan->prelen);
        if (!(scan->flags & DLL_INFO_PREVER))
diff -r -N -u ksh93_2006_09_12/src/lib/libdll/Mamfile 
ksh93_2006_10_31/src/lib/libdll/Mamfile
--- ksh93_2006_09_12/src/lib/libdll/Mamfile     2006-09-13 06:39:12.000000000 
+0200
+++ ksh93_2006_10_31/src/lib/libdll/Mamfile     2006-11-03 03:05:49.000000000 
+0100
@@ -84,53 +84,44 @@
 done ${PACKAGE_ast_INCLUDE}/ast_map.h dontcare
 done ${PACKAGE_ast_INCLUDE}/ast_common.h dontcare
 make ${PACKAGE_ast_INCLUDE}/ast_std.h implicit
-make ${PACKAGE_ast_INCLUDE}/ast_botch.h implicit
-done ${PACKAGE_ast_INCLUDE}/ast_botch.h dontcare
-make ${PACKAGE_ast_INCLUDE}/ast_unistd.h implicit
-done ${PACKAGE_ast_INCLUDE}/ast_unistd.h dontcare
-make ${PACKAGE_ast_INCLUDE}/re_comp.h implicit
+make ${PACKAGE_ast_INCLUDE}/regex.h implicit
+prev ${PACKAGE_ast_INCLUDE}/ast_common.h implicit
 make ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
 make ${INSTALLROOT}/include/prototyped.h implicit
 done ${INSTALLROOT}/include/prototyped.h dontcare
 done ${PACKAGE_ast_INCLUDE}/prototyped.h dontcare
-done ${PACKAGE_ast_INCLUDE}/re_comp.h dontcare
-make ${PACKAGE_ast_INCLUDE}/getopt.h implicit
-make ${PACKAGE_ast_INCLUDE}/ast_getopt.h implicit
-prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
-done ${PACKAGE_ast_INCLUDE}/ast_getopt.h dontcare
-prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
-done ${PACKAGE_ast_INCLUDE}/getopt.h dontcare
+done ${PACKAGE_ast_INCLUDE}/regex.h dontcare
+prev ${PACKAGE_ast_INCLUDE}/ast_map.h implicit
+make ${PACKAGE_ast_INCLUDE}/ast_botch.h implicit
+done ${PACKAGE_ast_INCLUDE}/ast_botch.h dontcare
+make ${PACKAGE_ast_INCLUDE}/ast_limits.h implicit
+done ${PACKAGE_ast_INCLUDE}/ast_limits.h dontcare
 make ${PACKAGE_ast_INCLUDE}/ast_fcntl.h implicit
-make ${PACKAGE_ast_INCLUDE}/ls.h implicit
-make ${PACKAGE_ast_INCLUDE}/ast_mode.h implicit
-done ${PACKAGE_ast_INCLUDE}/ast_mode.h dontcare
 make ${PACKAGE_ast_INCLUDE}/ast_fs.h implicit
 make error?--?old?ethernet?address?at?wrong?offset implicit
 done error?--?old?ethernet?address?at?wrong?offset dontcare virtual
 done ${PACKAGE_ast_INCLUDE}/ast_fs.h dontcare
-prev ${PACKAGE_ast_INCLUDE}/ast_std.h implicit
-prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
-done ${PACKAGE_ast_INCLUDE}/ls.h dontcare
-prev ${PACKAGE_ast_INCLUDE}/ast_fs.h implicit
 done ${PACKAGE_ast_INCLUDE}/ast_fcntl.h dontcare
-make ${PACKAGE_ast_INCLUDE}/ast_types.h implicit
-done ${PACKAGE_ast_INCLUDE}/ast_types.h dontcare
-prev ${PACKAGE_ast_INCLUDE}/ast_map.h implicit
+make ${PACKAGE_ast_INCLUDE}/ast_getopt.h implicit
+prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
+done ${PACKAGE_ast_INCLUDE}/ast_getopt.h dontcare
+make ${PACKAGE_ast_INCLUDE}/ast_sys.h implicit
+make ${PACKAGE_ast_INCLUDE}/re_comp.h implicit
+prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
+done ${PACKAGE_ast_INCLUDE}/re_comp.h dontcare
+make ${PACKAGE_ast_INCLUDE}/getopt.h implicit
+prev ${PACKAGE_ast_INCLUDE}/ast_getopt.h implicit
+prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
+done ${PACKAGE_ast_INCLUDE}/getopt.h dontcare
 make ${PACKAGE_ast_INCLUDE}/stdio.h implicit
 make ${PACKAGE_ast_INCLUDE}/ast_stdio.h implicit
 make ${PACKAGE_ast_INCLUDE}/sfio_s.h implicit
 done ${PACKAGE_ast_INCLUDE}/sfio_s.h dontcare
-prev ${PACKAGE_ast_INCLUDE}/ast_common.h implicit
+prev ${PACKAGE_ast_INCLUDE}/ast_std.h implicit
 done ${PACKAGE_ast_INCLUDE}/ast_stdio.h dontcare
 done ${PACKAGE_ast_INCLUDE}/stdio.h dontcare
 prev ${PACKAGE_ast_INCLUDE}/getopt.h implicit
-make ${PACKAGE_ast_INCLUDE}/limits.h implicit
-make ${PACKAGE_ast_INCLUDE}/ast_limits.h implicit
-done ${PACKAGE_ast_INCLUDE}/ast_limits.h dontcare
-done ${PACKAGE_ast_INCLUDE}/limits.h dontcare
-make ${PACKAGE_ast_INCLUDE}/ast_hdr.h implicit
-done ${PACKAGE_ast_INCLUDE}/ast_hdr.h dontcare
-prev ${PACKAGE_ast_INCLUDE}/ast_getopt.h implicit
+done ${PACKAGE_ast_INCLUDE}/ast_sys.h dontcare
 make ${PACKAGE_ast_INCLUDE}/ast_lib.h implicit
 done ${PACKAGE_ast_INCLUDE}/ast_lib.h dontcare
 prev ${PACKAGE_ast_INCLUDE}/ast_common.h implicit
@@ -160,7 +151,7 @@
 done features/dll
 prev dll.req
 bind -last
-exec - iffe -v -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '  ref 
${mam_cc_L+-L${INSTALLROOT}/lib} -I${PACKAGE_ast_INCLUDE} 
-I${INSTALLROOT}/include ${mam_libast} ${mam_libast} : run features/dll
+exec - iffe -v -c '${CC} ${mam_cc_FLAGS} ${CCFLAGS}   ${LDFLAGS} '  ref 
${mam_cc_L+-L${INSTALLROOT}/lib} -I${PACKAGE_ast_INCLUDE} 
-I${INSTALLROOT}/include ${mam_libast} ${mam_libast}  : run features/dll
 done FEATURE/dll generated
 exec - cmp 2>/dev/null -s FEATURE/dll dlldefs.h || { rm -f dlldefs.h; silent 
test -d . || mkdir .; cp FEATURE/dll dlldefs.h; }
 done dlldefs.h generated
@@ -215,7 +206,13 @@
 prev dlldefs.h implicit
 prev ${PACKAGE_ast_INCLUDE}/vmalloc.h implicit
 make ${PACKAGE_ast_INCLUDE}/fts.h implicit
-prev ${PACKAGE_ast_INCLUDE}/ls.h implicit
+make ${PACKAGE_ast_INCLUDE}/ls.h implicit
+make ${PACKAGE_ast_INCLUDE}/ast_mode.h implicit
+done ${PACKAGE_ast_INCLUDE}/ast_mode.h dontcare
+prev ${PACKAGE_ast_INCLUDE}/ast_fs.h implicit
+prev ${PACKAGE_ast_INCLUDE}/ast_std.h implicit
+prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
+done ${PACKAGE_ast_INCLUDE}/ls.h dontcare
 prev ${PACKAGE_ast_INCLUDE}/prototyped.h implicit
 done ${PACKAGE_ast_INCLUDE}/fts.h
 prev ${PACKAGE_ast_INCLUDE}/error.h implicit
@@ -263,7 +260,7 @@
 make ${PACKAGE_ast_INCLUDE}/dlldefs.h
 prev ${PACKAGE_ast_INCLUDE}
 prev dlldefs.h
-exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1997,author=gsf'  dlldefs.h > 1.${COTEMP}.x
+exec - proto -p -s -l ${PACKAGEROOT}/lib/package/ast.lic '-o 
since=1997,author=gsf'  dlldefs.h  > 1.${COTEMP}.x
 exec - if      cmp 2>/dev/null -s ${PACKAGE_ast_INCLUDE}/dlldefs.h 
1.${COTEMP}.x
 exec - then    rm -f 1.${COTEMP}.x
 exec - else    mv 1.${COTEMP}.x ${PACKAGE_ast_INCLUDE}/dlldefs.h
diff -r -N -u ksh93_2006_09_12/src/lib/libdll/RELEASE 
ksh93_2006_10_31/src/lib/libdll/RELEASE
--- ksh93_2006_09_12/src/lib/libdll/RELEASE     2006-01-25 22:08:00.000000000 
+0100
+++ ksh93_2006_10_31/src/lib/libdll/RELEASE     2006-10-12 18:38:27.000000000 
+0200
@@ -1,3 +1,4 @@
+06-10-11 dllscan.c: check sfstruse() return values -- doh
 06-01-25 dllplug.c: add errorf() library message for dlopen() error
 05-02-14 dllscan.c: "" || "-" => NiL
 04-10-01 dllfind.c: drop ksh "builtin" workaround

Reply via email to