[ksh93-integration-discuss] ksh alpha source 2006-10-31 update

Felix Schulte felix.schulte at gmail.com
Sat Nov 4 09:37:18 PST 2006


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 array[@] */
+		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 array[@] */
-		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_devnul