mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-13 03:32:24 +00:00
Fix more compiler warnings, typos and other minor issues (#260)
Many of these changes are minor typo fixes. The other changes (which are mostly compiler warning fixes) are: NEWS: - The --globcasedetect shell option works on older Linux kernels when used with FAT32/VFAT file systems, so remove the note about it only working with 5.2+ kernels. src/cmd/ksh93/COMPATIBILITY: - Update the documentation on function scoping with an addition from ksh93v- (this does apply to ksh93u+). src/cmd/ksh93/edit/emacs.c: - Check for '_AST_ksh_release', not 'AST_ksh_release'. src/cmd/INIT/mamake.c, src/cmd/INIT/ratz.c, src/cmd/INIT/release.c, src/cmd/builtin/pty.c: - Add more uses of UNREACHABLE() and noreturn, this time for the build system and pty. src/cmd/builtin/pty.c, src/cmd/builtin/array.c, src/cmd/ksh93/sh/name.c, src/cmd/ksh93/sh/nvtype.c, src/cmd/ksh93/sh/suid_exec.c: - Fix six -Wunused-variable warnings (the name.c nv_arrayptr() fixes are also in ksh93v-). - Remove the unused 'tableval' function to fix a -Wunused-function warning. src/cmd/ksh93/sh/lex.c: - Remove unused 'SHOPT_DOS' code, which isn't enabled anywhere. https://github.com/att/ast/issues/272#issuecomment-354363112 src/cmd/ksh93/bltins/misc.c, src/cmd/ksh93/bltins/trap.c, src/cmd/ksh93/bltins/typeset.c: - Add dictionary generator function declarations for former aliases that are now builtins (re:1fbbeaa1
,ef1621c1
,3ba4900e
). - For consistency with the rest of the codebase, use '(void)' instead of '()' for print_cpu_times. src/cmd/ksh93/sh/init.c, src/lib/libast/path/pathshell.c: - Move the otherwise unused EXE macro to pathshell() and only search for 'sh.exe' on Windows. src/cmd/ksh93/sh/xec.c, src/lib/libast/include/ast.h: - Add an empty definition for inline when compiling with C89. This allows the timeval_to_double() function to be inlined. src/cmd/ksh93/include/shlex.h: - Remove the unused 'PIPESYM2' macro. src/cmd/ksh93/tests/pty.sh: - Add '# err_exit #' to count the regression test added in commit113a9392
. src/lib/libast/disc/sfdcdio.c: - Move diordwr, dioread, diowrite and dioexcept behind '#ifdef F_DIOINFO' to fix one -Wunused-variable warning and multiple -Wunused-function warnings (sfdcdio() only uses these functions when F_DIOINFO is defined). src/lib/libast/string/fmtdev.c: - Fix two -Wimplicit-function-declaration warnings on Linux by including sys/sysmacros.h in fmtdev().
This commit is contained in:
parent
ecf260c282
commit
a065558291
96 changed files with 299 additions and 282 deletions
2
NEWS
2
NEWS
|
@ -72,7 +72,7 @@ Any uppercase BUG_* names are modernish shell bug IDs.
|
|||
|
||||
- A new --globcasedetect shell option is added to ksh on OSs where we can check
|
||||
for a case-insensitive file system (currently macOS, Windows/Cygwin, Linux
|
||||
5.2+, and QNX 7.0+). When this option is turned on, file name generation
|
||||
and QNX 7.0+). When this option is turned on, file name generation
|
||||
(globbing), as well as file name tab completion on interactive shells,
|
||||
automatically become case-insensitive on file systems where the difference
|
||||
between upper- and lowercase is ignored for file names. This is transparently
|
||||
|
|
|
@ -31,7 +31,7 @@ To see what's left to fix, see [the issue tracker](https://github.com/ksh93/ksh/
|
|||
7. Code style varies somewhat in this historic code base.
|
||||
Your changes should match the style of the code surrounding it.
|
||||
Indent with tabs, assuming an 8-space tab width.
|
||||
Opening braces are on a line of their own, at the same identation level
|
||||
Opening braces are on a line of their own, at the same indentation level
|
||||
as their corresponding closing brace.
|
||||
Comments always use `/*`...`*/`.
|
||||
8. Good judgment may override this policy.
|
||||
|
|
|
@ -32,7 +32,7 @@ are Linux, System V Release 4, Solaris, Sun OS, HP-UX Release 8 and above,
|
|||
AIX 3.2 and above, and Microsoft Windows systems.
|
||||
<P>
|
||||
This memo describes how to write and compile programs
|
||||
that can be loaded into <TT>ksh</TT> at run time as built-in
|
||||
that can be loaded into <TT>ksh</TT> at run time as built-in
|
||||
commands.
|
||||
<P>
|
||||
<P><HR><CENTER><FONT color=red><FONT face=courier><H3><A name="INTRODUCTION">INTRODUCTION</A></H3></FONT></FONT></CENTER>
|
||||
|
|
|
@ -771,7 +771,7 @@ or indexed, use ${!var[@]}.
|
|||
<DT>How do I do global substitutions on the contents of shell variables?<DD>
|
||||
|
||||
Use // instead of / for global substitution, ${var//aa/bb} will
|
||||
expand to the value of with each "aa" replace by "bb".
|
||||
expand to the value of var with each "aa" replaced by "bb".
|
||||
|
||||
<DT>How can I convert %XX values to ascii?<DD>
|
||||
|
||||
|
|
|
@ -450,7 +450,7 @@ All recorded changes follow.
|
|||
regress.sh: INPUT and OUTPUT handle -f for printf instead of print
|
||||
04-06-11 package.sh: make sure $INSTALLROOT/bin is in front of $PATH
|
||||
package.sh: skip nmake if older than 2000-10-31
|
||||
04-05-20 package.sh: fix arg vs. package parse with - or '' to disambuguate
|
||||
04-05-20 package.sh: fix arg vs. package parse with - or '' to disambiguate
|
||||
04-05-11 package.sh: package verbose update lists closure for package setup
|
||||
package.sh: add src/lib/libardir to nmake proto bootstrap
|
||||
regress.sh: probe for rm -u vs. chmod -R u+rwx
|
||||
|
@ -518,7 +518,7 @@ All recorded changes follow.
|
|||
03-09-23 ratz.c: fix tar header number parse bug that skipped to next number
|
||||
regress.sh: rm cleanup now handles files matching -*
|
||||
03-09-11 iffe.sh: add unnamed { ... } blocks
|
||||
regress.sh: add COPY from to, like MOVE but comprison still done
|
||||
regress.sh: add COPY from to, like MOVE but comparison still done
|
||||
regress.sh: rm -rfu to handle test dirs w/o u+rwx
|
||||
03-08-14 Makefile: add hello.c to the manifest
|
||||
03-08-11 package.sh: fix `html binary' generation
|
||||
|
@ -617,7 +617,7 @@ All recorded changes follow.
|
|||
make.probe: add CC.LD.STRIP for link time a.out strip
|
||||
package.sh: fix package_use vs. PACKAGE_USE check
|
||||
02-10-24 WWW.mk: fix bug that required a :WWWBIN: assertion to post
|
||||
02-10-23 mamake.c: fix unuinitialized time in make()
|
||||
02-10-23 mamake.c: fix uninitialized time in make()
|
||||
ratz.c: fix meter buffer overflow
|
||||
02-10-20 package.sh: fix lib/probe/C/make/probe update test
|
||||
02-10-18 probe.win32: update for mingw
|
||||
|
@ -699,7 +699,7 @@ All recorded changes follow.
|
|||
package.sh: add check for { cc ar nm yacc/bison } before make
|
||||
ratz.c: fix "rb" vs. "r" macro tests
|
||||
iffe.sh: add nxt, similar to lcl but defines _nxt_foo for #include
|
||||
iffe.sh,package.sh: remove vaibale from sccs,cvs ident strings -- duh
|
||||
iffe.sh,package.sh: remove variable from sccs,cvs ident strings -- duh
|
||||
02-01-24 C+probe: check CC.DYNAMIC to handle cc that accept but ignore -B*
|
||||
iffe.sh: handle 'mem struct.a.b'
|
||||
02-01-22 iffe.sh: cache (internal) `foo vs. struct foo' test results
|
||||
|
@ -950,7 +950,7 @@ All recorded changes follow.
|
|||
98-05-01 regress: fix bug sometimes didn't list last test
|
||||
98-04-01 hostinfo: add cc path arg
|
||||
hostinfo: now works with /bin/sh
|
||||
Makefile: strengthed -lm probe
|
||||
Makefile: strengthen -lm probe
|
||||
98-01-23 Makefile: check for -ldl -lm
|
||||
C.probe: handle gcc -v -E phony include dirs
|
||||
iffe: fix lcl by dropping sort -u -- we need the real first
|
||||
|
|
|
@ -412,7 +412,7 @@ All recorded changes follow.
|
|||
regress.sh: INPUT and OUTPUT handle -f for printf instead of print
|
||||
04-06-11 package.sh: make sure $INSTALLROOT/bin is in front of $PATH
|
||||
package.sh: skip nmake if older than 2000-10-31
|
||||
04-05-20 package.sh: fix arg vs. package parse with - or '' to disambuguate
|
||||
04-05-20 package.sh: fix arg vs. package parse with - or '' to disambiguate
|
||||
04-05-11 package.sh: package verbose update lists closure for package setup
|
||||
package.sh: add src/lib/libardir to nmake proto bootstrap
|
||||
regress.sh: probe for rm -u vs. chmod -R u+rwx
|
||||
|
@ -480,7 +480,7 @@ All recorded changes follow.
|
|||
03-09-23 ratz.c: fix tar header number parse bug that skipped to next number
|
||||
regress.sh: rm cleanup now handles files matching -*
|
||||
03-09-11 iffe.sh: add unnamed { ... } blocks
|
||||
regress.sh: add COPY from to, like MOVE but comprison still done
|
||||
regress.sh: add COPY from to, like MOVE but comparison still done
|
||||
regress.sh: rm -rfu to handle test dirs w/o u+rwx
|
||||
03-08-14 Makefile: add hello.c to the manifest
|
||||
03-08-11 package.sh: fix `html binary' generation
|
||||
|
@ -579,7 +579,7 @@ All recorded changes follow.
|
|||
make.probe: add CC.LD.STRIP for link time a.out strip
|
||||
package.sh: fix package_use vs. PACKAGE_USE check
|
||||
02-10-24 WWW.mk: fix bug that required a :WWWBIN: assertion to post
|
||||
02-10-23 mamake.c: fix unuinitialized time in make()
|
||||
02-10-23 mamake.c: fix uninitialized time in make()
|
||||
ratz.c: fix meter buffer overflow
|
||||
02-10-20 package.sh: fix lib/probe/C/make/probe update test
|
||||
02-10-18 probe.win32: update for mingw
|
||||
|
@ -661,7 +661,7 @@ All recorded changes follow.
|
|||
package.sh: add check for { cc ar nm yacc/bison } before make
|
||||
ratz.c: fix "rb" vs. "r" macro tests
|
||||
iffe.sh: add nxt, similar to lcl but defines _nxt_foo for #include
|
||||
iffe.sh,package.sh: remove vaibale from sccs,cvs ident strings -- duh
|
||||
iffe.sh,package.sh: remove variable from sccs,cvs ident strings -- duh
|
||||
02-01-24 C+probe: check CC.DYNAMIC to handle cc that accept but ignore -B*
|
||||
iffe.sh: handle 'mem struct.a.b'
|
||||
02-01-22 iffe.sh: cache (internal) `foo vs. struct foo' test results
|
||||
|
@ -912,7 +912,7 @@ All recorded changes follow.
|
|||
98-05-01 regress: fix bug sometimes didn't list last test
|
||||
98-04-01 hostinfo: add cc path arg
|
||||
hostinfo: now works with /bin/sh
|
||||
Makefile: strengthed -lm probe
|
||||
Makefile: strengthen -lm probe
|
||||
98-01-23 Makefile: check for -ldl -lm
|
||||
C.probe: handle gcc -v -E phony include dirs
|
||||
iffe: fix lcl by dropping sort -u -- we need the real first
|
||||
|
|
|
@ -20,17 +20,17 @@ ast-ksh :PACKAGE: ksh93 libast libcmd libcoshell libsum libdll
|
|||
these symlinks
|
||||
/bin/ksh.exe => ksh93.exe
|
||||
/usr/share/man/man1/ksh93.1 => ksh.1
|
||||
are created. This allows alternative ksh impelementations,
|
||||
are created. This allows alternative ksh implementations,
|
||||
e.g., /bin/pdksh.exe, to be selected by changing the ksh.exe
|
||||
and ksh.1 symbolic links. In addition, ksh and ksh93 paths are
|
||||
added to /etc/shells if not already present.
|
||||
$()
|
||||
Each builtin or special command accepts the --man and --html
|
||||
options to list the man page on the standard error. The --???
|
||||
options to show the man page on the standard error. The --???
|
||||
option describes the self documenting options available to all
|
||||
builtin and special commands.
|
||||
$()
|
||||
The stanadlone ksh is statically linked with the ast libcmd
|
||||
The standlone ksh is statically linked with the ast libcmd
|
||||
library which provides several builtin versions of /bin
|
||||
commands. "builtin | grep /opt/ast/bin" lists the libcmd
|
||||
builtins on the standard output. /opt/ast/bin/FOO accesses
|
||||
|
@ -55,12 +55,12 @@ ast-ksh :PACKAGE: ksh93 libast libcmd libcoshell libsum libdll
|
|||
variables to convert. PATH is handled by cygwin so it is not
|
||||
converted by the ast library.
|
||||
$()
|
||||
The astksh cygwin source package provides a bootstrap build
|
||||
The ast-ksh cygwin source package provides a bootstrap build
|
||||
environment that is not suited for an edit/build/debug cycle.
|
||||
If you want to explore and modify the source then you should
|
||||
install the (non-cygwinized) ast-base package which includes
|
||||
AT&T nmake. With ast-base you will also be able to regenerate
|
||||
the astksh cygwin source and binary packages.
|
||||
the ast-ksh cygwin source and binary packages.
|
||||
$()
|
||||
For more information on ksh and other AT&T ast tools see
|
||||
http://www.research.att.com/sw/download/
|
||||
|
|
|
@ -423,7 +423,7 @@
|
|||
03-09-23 ratz.c: fix tar header number parse bug that skipped to next number
|
||||
regress.sh: rm cleanup now handles files matching -*
|
||||
03-09-11 iffe.sh: add unnamed { ... } blocks
|
||||
regress.sh: add COPY from to, like MOVE but comprison still done
|
||||
regress.sh: add COPY from to, like MOVE but comparison still done
|
||||
regress.sh: rm -rfu to handle test dirs w/o u+rwx
|
||||
03-08-14 Makefile: add hello.c to the manifest
|
||||
03-08-11 package.sh: fix `html binary' generation
|
||||
|
@ -522,7 +522,7 @@
|
|||
make.probe: add CC.LD.STRIP for link time a.out strip
|
||||
package.sh: fix package_use vs. PACKAGE_USE check
|
||||
02-10-24 WWW.mk: fix bug that required a :WWWBIN: assertion to post
|
||||
02-10-23 mamake.c: fix unuinitialized time in make()
|
||||
02-10-23 mamake.c: fix uninitialized time in make()
|
||||
ratz.c: fix meter buffer overflow
|
||||
02-10-20 package.sh: fix lib/probe/C/make/probe update test
|
||||
02-10-18 probe.win32: update for mingw
|
||||
|
@ -604,7 +604,7 @@
|
|||
package.sh: add check for { cc ar nm yacc/bison } before make
|
||||
ratz.c: fix "rb" vs. "r" macro tests
|
||||
iffe.sh: add nxt, similar to lcl but defines _nxt_foo for #include
|
||||
iffe.sh,package.sh: remove vaibale from sccs,cvs ident strings -- duh
|
||||
iffe.sh,package.sh: remove variable from sccs,cvs ident strings -- duh
|
||||
02-01-24 C+probe: check CC.DYNAMIC to handle cc that accept but ignore -B*
|
||||
iffe.sh: handle 'mem struct.a.b'
|
||||
02-01-22 iffe.sh: cache (internal) `foo vs. struct foo' test results
|
||||
|
@ -855,7 +855,7 @@
|
|||
98-05-01 regress: fix bug sometimes didn't list last test
|
||||
98-04-01 hostinfo: add cc path arg
|
||||
hostinfo: now works with /bin/sh
|
||||
Makefile: strengthed -lm probe
|
||||
Makefile: strengthen -lm probe
|
||||
98-01-23 Makefile: check for -ldl -lm
|
||||
C.probe: handle gcc -v -E phony include dirs
|
||||
iffe: fix lcl by dropping sort -u -- we need the real first
|
||||
|
|
|
@ -2157,8 +2157,8 @@ main(int argc, char** argv)
|
|||
search(state.vars, "-strip-symbols", "1");
|
||||
continue;
|
||||
case '?':
|
||||
error(ERROR_USAGE|4, "%s", opt_info.arg);
|
||||
continue;
|
||||
error(ERROR_usage(2), "%s", opt_info.arg);
|
||||
UNREACHABLE();
|
||||
case ':':
|
||||
error(2, "%s", opt_info.arg);
|
||||
continue;
|
||||
|
@ -2166,7 +2166,10 @@ main(int argc, char** argv)
|
|||
break;
|
||||
}
|
||||
if (error_info.errors)
|
||||
error(ERROR_USAGE|4, "%s", optusage(NiL));
|
||||
{
|
||||
error(ERROR_usage(2), "%s", optusage(NiL));
|
||||
UNREACHABLE();
|
||||
}
|
||||
argv += opt_info.index;
|
||||
#else
|
||||
while ((s = *++argv) && *s == '-')
|
||||
|
|
|
@ -426,8 +426,8 @@ typedef uLong FAR uLongf;
|
|||
# define z_off_t off_t
|
||||
#endif
|
||||
#ifndef SEEK_SET
|
||||
# define SEEK_SET 0 /* Seek from beginning of file. */
|
||||
# define SEEK_CUR 1 /* Seek from current position. */
|
||||
# define SEEK_SET 0 /* Seek from beginning of file. */
|
||||
# define SEEK_CUR 1 /* Seek from current position. */
|
||||
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
|
||||
#endif
|
||||
#ifndef z_off_t
|
||||
|
@ -1391,7 +1391,7 @@ typedef struct internal_state {
|
|||
*/
|
||||
|
||||
int level; /* compression level (1..9) */
|
||||
int strategy; /* favor or force Huffman coding*/
|
||||
int strategy; /* favor or force Huffman coding */
|
||||
|
||||
uInt good_match;
|
||||
/* Use a faster search when the previous match is longer than this */
|
||||
|
@ -2087,7 +2087,7 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
|
|||
unsigned dmask; /* mask for first level of distance codes */
|
||||
code this; /* retrieved table entry */
|
||||
unsigned op; /* code bits, operation, extra bits, or */
|
||||
/* window position, window bytes to copy */
|
||||
/* window position, window bytes to copy */
|
||||
unsigned len; /* match length, unused bytes */
|
||||
unsigned dist; /* match distance */
|
||||
unsigned char FAR *from; /* where to copy match from */
|
||||
|
@ -4813,8 +4813,8 @@ char** argv;
|
|||
sfprintf(sfstdout, "%s\n", id + 10);
|
||||
return 0;
|
||||
case '?':
|
||||
error(ERROR_USAGE|4, "%s", opt_info.arg);
|
||||
continue;
|
||||
error(ERROR_usage(2), "%s", opt_info.arg);
|
||||
UNREACHABLE();
|
||||
case ':':
|
||||
error(2, "%s", opt_info.arg);
|
||||
continue;
|
||||
|
@ -4822,7 +4822,10 @@ char** argv;
|
|||
break;
|
||||
}
|
||||
if (error_info.errors)
|
||||
error(ERROR_USAGE|4, "%s", optusage(NiL));
|
||||
{
|
||||
error(ERROR_usage(2), "%s", optusage(NiL));
|
||||
UNREACHABLE();
|
||||
}
|
||||
argv += opt_info.index;
|
||||
#else
|
||||
while ((s = *++argv) && *s == '-' && *(s + 1))
|
||||
|
|
|
@ -238,8 +238,8 @@ main(int argc, char** argv)
|
|||
sfprintf(sfstdout, "%s\n", id + 10);
|
||||
return 0;
|
||||
case '?':
|
||||
error(ERROR_USAGE|4, "%s", opt_info.arg);
|
||||
continue;
|
||||
error(ERROR_usage(2), "%s", opt_info.arg);
|
||||
UNREACHABLE();
|
||||
case ':':
|
||||
error(2, "%s", opt_info.arg);
|
||||
continue;
|
||||
|
@ -247,7 +247,10 @@ main(int argc, char** argv)
|
|||
break;
|
||||
}
|
||||
if (error_info.errors)
|
||||
error(ERROR_USAGE|4, "%s", optusage(NiL));
|
||||
{
|
||||
error(ERROR_usage(2), "%s", optusage(NiL));
|
||||
UNREACHABLE();
|
||||
}
|
||||
argv += opt_info.index;
|
||||
#else
|
||||
while ((s = *++argv) && *s == '-' && *(s + 1))
|
||||
|
|
|
@ -125,9 +125,10 @@ static const char usage[] =
|
|||
#define CMIN 1
|
||||
#endif
|
||||
|
||||
static void outofmemory(void)
|
||||
static noreturn void outofmemory(void)
|
||||
{
|
||||
error(ERROR_SYSTEM|ERROR_PANIC, "out of memory");
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
#if !_lib_openpty && !_lib__getpty && !defined(_pty_clone)
|
||||
|
@ -221,7 +222,6 @@ static int
|
|||
mkpty(int* master, int* minion)
|
||||
{
|
||||
struct termios tty;
|
||||
struct termios tst;
|
||||
struct termios* ttyp;
|
||||
#ifdef TIOCGWINSZ
|
||||
struct winsize win;
|
||||
|
@ -316,6 +316,7 @@ mkpty(int* master, int* minion)
|
|||
return -1;
|
||||
#endif
|
||||
#ifdef I_PUSH
|
||||
struct termios tst;
|
||||
if (tcgetattr(*minion, &tst) < 0 && (ioctl(*minion, I_PUSH, "ptem") < 0 || ioctl(*minion, I_PUSH, "ldterm") < 0))
|
||||
{
|
||||
close(*minion);
|
||||
|
@ -1057,17 +1058,26 @@ b_pty(int argc, char** argv, Shbltin_t* context)
|
|||
break;
|
||||
case '?':
|
||||
error(ERROR_usage(2), "%s", opt_info.arg);
|
||||
break;
|
||||
UNREACHABLE();
|
||||
}
|
||||
break;
|
||||
}
|
||||
argv += opt_info.index;
|
||||
if (!argv[0])
|
||||
{
|
||||
error(ERROR_exit(1), "command must be specified");
|
||||
UNREACHABLE();
|
||||
}
|
||||
if (mkpty(&master, &minion) < 0)
|
||||
{
|
||||
error(ERROR_system(1), "unable to create pty");
|
||||
UNREACHABLE();
|
||||
}
|
||||
if (!(mp = sfnew(NiL, 0, SF_UNBOUND, master, SF_READ|SF_WRITE)))
|
||||
{
|
||||
error(ERROR_system(1), "cannot open master stream");
|
||||
UNREACHABLE();
|
||||
}
|
||||
if (stty)
|
||||
{
|
||||
n = 2;
|
||||
|
@ -1095,9 +1105,15 @@ b_pty(int argc, char** argv, Shbltin_t* context)
|
|||
if (!log)
|
||||
lp = 0;
|
||||
else if (!(lp = sfopen(NiL, log, "w")))
|
||||
{
|
||||
error(ERROR_system(1), "%s: cannot write", log);
|
||||
UNREACHABLE();
|
||||
}
|
||||
if (!(proc = runcmd(argv, minion, session)))
|
||||
{
|
||||
error(ERROR_system(1), "unable run %s", argv[0]);
|
||||
UNREACHABLE();
|
||||
}
|
||||
close(minion);
|
||||
if (messages)
|
||||
{
|
||||
|
@ -1109,7 +1125,10 @@ b_pty(int argc, char** argv, Shbltin_t* context)
|
|||
else if ((fd = open(messages, O_CREAT|O_WRONLY, MODE_666)) >= 0)
|
||||
drop = 0;
|
||||
else
|
||||
{
|
||||
error(ERROR_system(1), "%s: cannot redirect messages", messages);
|
||||
UNREACHABLE();
|
||||
}
|
||||
close(2);
|
||||
dup(fd);
|
||||
if (drop)
|
||||
|
@ -1118,6 +1137,9 @@ b_pty(int argc, char** argv, Shbltin_t* context)
|
|||
minion = (*fun)(mp, lp, delay, timeout);
|
||||
master = procclose(proc);
|
||||
if (lp && sfclose(lp))
|
||||
{
|
||||
error(ERROR_system(1), "%s: write error", log);
|
||||
UNREACHABLE();
|
||||
}
|
||||
return minion ? minion : master;
|
||||
}
|
||||
|
|
|
@ -128,8 +128,10 @@ omitted features that are completely upward compatible.
|
|||
1. Functions, defined with name() with ksh-93 are compatible with
|
||||
the POSIX standard, not with ksh-88. No local variables are
|
||||
permitted, and there is no separate scope. Functions defined
|
||||
with the function name syntax, maintain compatibility.
|
||||
This also affects function traces.
|
||||
with the function name syntax have local variables as in ksh-88,
|
||||
but are statically scoped as in C so that a function does not
|
||||
automatically have access to local variables of the caller.
|
||||
This change also affects function traces.
|
||||
|
||||
2. ! is now a reserved word. As a result, any command by that
|
||||
name will no longer work with ksh-93.
|
||||
|
|
|
@ -46,7 +46,7 @@ Directory layout:
|
|||
Include directory:
|
||||
1. argnod.h contains the type definitions for command
|
||||
nodes, io nodes, argument nodes, and for positional
|
||||
parameters.a It defines the prototypes for
|
||||
parameters. It defines the prototypes for
|
||||
all the positional parameters functions.
|
||||
2. builtins.h contains prototypes for builtins as well
|
||||
as symbolic constants that refer to the name-pairs
|
||||
|
@ -89,7 +89,7 @@ Include directory:
|
|||
functions.
|
||||
19. terminal.h is a header file that includes the appropriate
|
||||
terminal include.
|
||||
20. test.h contains the definitions for the test and [[...]]
|
||||
20. test.h contains the definitions for the test and [[ ... ]]
|
||||
commands.
|
||||
21. timeout.h contains the define constant for the maximum
|
||||
shell timeout.
|
||||
|
|
|
@ -18,7 +18,7 @@ The Makefile file contains several compilation options that can be set
|
|||
before compiling ksh. Options are of the form SHOPT_option and become
|
||||
#define inside the code. These options are set to their recommended
|
||||
value and some of these may disappear as options in future releases.
|
||||
A value of 0, or no value represents off, 1 represents on.
|
||||
A value of 0, or no value represents off, 1 represents on.
|
||||
Note that == is needed, not =, because these are nmake state variables
|
||||
and changing their value will cause all modules that could be affected
|
||||
by this change to be recompiled.
|
||||
|
|
|
@ -21,9 +21,9 @@
|
|||
12-07-02 A bug in which builtin name did now work for builtins found in a
|
||||
library added by builtin -f lib has been fixed.
|
||||
12-07-02 A bug in the edit modes which <tab> after a directory did not refresh
|
||||
the input line has been fixed.
|
||||
the input line has been fixed.
|
||||
12-07-02 A bug in which an exit status > 256 corresponding to a signal was
|
||||
not returned by a function to indicate a signal exit has been fixed.
|
||||
not returned by a function to indicate a signal exit has been fixed.
|
||||
12-06-28 Fix ulimit -a to list (Kibytes) instead of (kbytes).
|
||||
12-06-27 Fix uninitialized data reference for <CR> as first char in --vi mode.
|
||||
12-06-26 The formatting of printf "%q" for multibyte locales has changed to
|
||||
|
@ -243,7 +243,7 @@
|
|||
that caused a core dump has been fixed.
|
||||
12-02-08 A bug in which .sh.fun disciplines could be cleared after a
|
||||
function completes has been fixed.
|
||||
12-02-08 A bug in job control in which the foregroup process group was not
|
||||
12-02-08 A bug in job control in which the foreground process group was not
|
||||
set correctly after restarting a stopped pipeline has been fixed.
|
||||
12-02-07 A bug in which numbers with leading zeros could be treated as
|
||||
octal constants outside of ((...)) has been fixed.
|
||||
|
@ -297,7 +297,7 @@
|
|||
quote argument in a form suitable for a field in a .csv format file.
|
||||
11-12-02 +A -S option was added to read to be able to read .csv format files.
|
||||
11-11-28 A bug in which redirection of standard error in a function called from
|
||||
command substitution caused standard error to be lost has ben fixed.
|
||||
command substitution caused standard error to be lost has been fixed.
|
||||
11-11-21 [[ (-n foo) ]] no longer requires a space before (.
|
||||
11-11-11 The readonly attribute for a variable now applies to compound
|
||||
assignments to that variable.
|
||||
|
@ -355,7 +355,7 @@
|
|||
Linux has been fixed. The bug could also have affected other systems.
|
||||
11-06-07 +A number of changes to support the still undocumented namespace option
|
||||
have been added.
|
||||
11-06-06 A bug in which command substitution of eval would hang when it had
|
||||
11-06-06 A bug in which command substitution of eval would hang when it had
|
||||
standard error redirected to standard output has been fixed.
|
||||
11-06-01 A bug in case statement fall through (;&) ignoring set -e was fixed.
|
||||
11-06-01 A bug in which creating a left or right justified upper or lowercase
|
||||
|
@ -711,7 +711,7 @@
|
|||
was invoked on a two dimensional array, i.e., arr[5][9].discipline.
|
||||
10-07-19 Fixed a buffering problem which occurred when running a script with
|
||||
ssh and the parent ssh process is killed.
|
||||
10-07-14 Modified the parser to treat ((...)) inside [[...]] as ( (...) ) to
|
||||
10-07-14 Modified the parser to treat ((...)) inside [[ ... ]] as ( (...) ) so
|
||||
that it is a nested (...).
|
||||
10-07-09 A bug in the handling of process substitution inside command
|
||||
substitution as part of a pipeline has been fixed.
|
||||
|
@ -1142,9 +1142,9 @@
|
|||
has been fixed.
|
||||
09-01-19 A bug in which sending SIGWINCH to a process that reads from a pipe
|
||||
could cause a memory fault has been fixed.
|
||||
09-01-16 +The -R unary operator was added to [[...]] and test to check whether
|
||||
a variable is a name reference.
|
||||
09-01-16 +The -v unary operator was added to [[...]] and test to check whether
|
||||
09-01-16 +The -R unary operator was added to [[ ... ]] and test to check whether
|
||||
a variable is a name reference.
|
||||
09-01-16 +The -v unary operator was added to [[ ... ]] and test to check whether
|
||||
a variable is set.
|
||||
09-01-14 The unset built-in was modified to return 0 exit status when
|
||||
unsetting a variable that was unset to conform with the POSIX
|
||||
|
@ -1261,7 +1261,7 @@
|
|||
cases where the command caused the shell to fork has been fixed.
|
||||
08-09-19 type, whence -v, and command -v were fixed to comply with POSIX
|
||||
by writing 'not found' diagnostics to the standard error.
|
||||
08-09-18 test and [...] were fixed to comply with POSIX in the case
|
||||
08-09-18 test and [ ... ] were fixed to comply with POSIX in the case
|
||||
of test '(' binop ')' where binop is a valid binary test operator.
|
||||
08-09-16 +If a method discipline named create is specified when defining a
|
||||
type, this function will be called when an instance is created.
|
||||
|
@ -1468,7 +1468,7 @@
|
|||
08-03-04 A bug in multiline mode in emacs and vi mode which could cause the
|
||||
cursor to be on the wrong line when interrupt was hit has been fixed.
|
||||
08-03-03 The change made in ksh93s+ on 07-06-18 in which braces became
|
||||
optional for ${a[i]} inside [[...]] was restored in the case
|
||||
optional for ${a[i]} inside [[ ... ]] was restored in the case
|
||||
where the argument can be a pattern.
|
||||
08-03-03 A bug in which creating a name reference to an associative array
|
||||
instance would fail when the subscript contained characters [ or
|
||||
|
@ -1580,7 +1580,7 @@
|
|||
name+=([sub]=value) could cause the array to become an associative
|
||||
array has been fixed.
|
||||
07-11-14 A bug in which typeset without arguments could coredump if a
|
||||
variable is declared as in indexed array and has no elements has
|
||||
variable is declared as an indexed array and has no elements has
|
||||
been fixed.
|
||||
07-11-14 A bug in which creating a local SECONDS variable with typeset in
|
||||
a function could corrupt memory has been fixed.
|
||||
|
@ -1636,13 +1636,13 @@
|
|||
07-06-25 A bug in the expansion of ${var/pattern/rep} when pattern or rep
|
||||
contained a left parenthesis in single quotes has been fixed.
|
||||
07-06-18 The braces for a subscripted variable with ${var[sub]} are now
|
||||
optional when inside [[...]], ((...)) or as a subscript.
|
||||
optional when inside [[ ... ]], ((...)) or as a subscript.
|
||||
07-05-28 A bug in brace expansion in which single and double quotes did
|
||||
not treat the comma as a literal character has been fixed.
|
||||
07-05-24 The -p option of whence now disables -v.
|
||||
07-05-23 Several bug fixes in compound variables and arrays of arrays
|
||||
have been made.
|
||||
07-05-15 A bug in which the %B format of printf was affected by the
|
||||
07-05-15 A bug in which the %B format of printf was affected by the
|
||||
locale has been fixed.
|
||||
07-05-14 A bug in which \ was not removed in the replacement pattern with
|
||||
${var/pattern/rep} when it was not followed by \ or a digit has
|
||||
|
@ -1788,7 +1788,7 @@
|
|||
06-05-19 +Modified arithmetic so that conversions to strings default to
|
||||
the maximum number of precision digits.
|
||||
06-05-16 Bug fixes for multibyte locales.
|
||||
06-05-10 The =~ operator was added to [[...]] and [[ string ~= ERE ]]
|
||||
06-05-10 The =~ operator was added to [[ ... ]] and [[ string ~= ERE ]]
|
||||
is equivalent to [[ string == ~(E)ERE ]].
|
||||
06-04-25 A bug in the vi edit mode which could cause the shell to core dump
|
||||
when switching from emacs mode.
|
||||
|
@ -1880,7 +1880,7 @@
|
|||
05-05-18 A bug in which the line number for errors was not correct for
|
||||
functions loaded from FPATH has been fixed.
|
||||
05-04-18 A bug in which the exit status $? is not set when a trap triggered
|
||||
by the [[...]] command is executed has been fixed.
|
||||
by the [[ ... ]] command is executed has been fixed.
|
||||
05-04-08 +Redirection operators can be directly preceded with {varname}
|
||||
with no intervening space, where varname is a variable name which
|
||||
allows the shell to select a file descriptor > 10 and store it
|
||||
|
@ -2144,7 +2144,7 @@
|
|||
did not follow x has been fixed.
|
||||
|
||||
03-03-18 --- Release ksh93o ---
|
||||
03-03-18 +A -N unary operator was added to test and [[...]] which returns
|
||||
03-03-18 +A -N unary operator was added to test and [[ ... ]] which returns
|
||||
true if the file exists and the file has been modified since it
|
||||
was last read.
|
||||
03-03-18 +The TIMEFORMAT variable was added to control the format for
|
||||
|
@ -2639,7 +2639,7 @@
|
|||
jobs have completed has been fixed.
|
||||
00-06-21 A bug in which backspace did not work correctly during the
|
||||
R replace directive in vi-mode has been fixed.
|
||||
00-06-12 +Added variable name completion/expansion/listing to the set of
|
||||
00-06-12 +Added variable name completion/expansion/listing to the set of
|
||||
completions. Variable name completions begin with $ or "$ followed
|
||||
by a letter.
|
||||
00-05-09 --- Release ksh93j ---
|
||||
|
@ -2660,7 +2660,7 @@
|
|||
00-03-30 +Code was modified in several places to support automatic
|
||||
generation of C locale dictionaries.
|
||||
00-03-28 A bug in which the set and trap commands invoked with --name
|
||||
type arguments would terminate the invoking script has
|
||||
type arguments would terminate the invoking script has
|
||||
been fixed.
|
||||
00-03-27 A bug in which the library path variable was not updated
|
||||
correctly on some systems as described in the 'g' point
|
||||
|
@ -2703,7 +2703,7 @@
|
|||
99-03-31 +The TAB key can be used for completion in emacs and viraw mode.
|
||||
99-03-31 A bug in setting .sh.editchar during the KEYBD trap
|
||||
for the MULTIBYTE option was fixed in release ksh93h.
|
||||
99-03-31 A bug in shcomp for compilation of unary operators with [[...]]
|
||||
99-03-31 A bug in shcomp for compilation of unary operators with [[ ... ]]
|
||||
has been fixed.
|
||||
99-03-31 A bug in which the value of $? was changed when executing
|
||||
a keyboard trap has been fixed.
|
||||
|
@ -2853,7 +2853,7 @@
|
|||
96-07-31 A bug in right to left arithmetic assignment for which
|
||||
the arithmetic expression (( y = x = 1.5 )) did not
|
||||
yield 1 for y when x was declared typeset -i was fixed.
|
||||
96-07-31 printf has been fixed to handle format containing \0
|
||||
96-07-31 printf has been fixed to handle format containing \0
|
||||
and/or \0145 correctly. In addition, characters following
|
||||
%b in the format string are no longer displayed when
|
||||
the operand contains \c.
|
||||
|
|
|
@ -258,7 +258,7 @@ of ksh.
|
|||
2. The -C option is equivalent to -o noclobber. Files are
|
||||
created with O_EXCL when -C is on.
|
||||
|
||||
h. The following changes have been made to [[...]]:
|
||||
h. The following changes have been made to [[ ... ]]:
|
||||
1. A string by itself is equivalent to -n string.
|
||||
2. -e has been added as equivalent to -a.
|
||||
3. == has been added as equivalent =.
|
||||
|
|
|
@ -229,7 +229,7 @@ of ksh.
|
|||
c. A bug in right to left arithmetic assignment for which
|
||||
the arithmetic expression (( y = x = 1.5 )) did not
|
||||
yield 1 for y when x was declared typeset -i was fixed.
|
||||
d. printf has been fixed to handle format containing \0
|
||||
d. printf has been fixed to handle format containing \0
|
||||
and/or \0145 correctly. In addition, characters following
|
||||
%b in the format string are no longer displayed when
|
||||
the operand contains \c.
|
||||
|
@ -359,7 +359,7 @@ of ksh.
|
|||
were split across buffer boundaries has been fixed.
|
||||
|
||||
14. Bugs fixed in 12/28/93h for default OPTIONS
|
||||
a. I bug in shcomp for compilation of unary operators with [[...]]
|
||||
a. I bug in shcomp for compilation of unary operators with [[ ... ]]
|
||||
has been fixed.
|
||||
b. A bug in which the value of $? was changed when executing
|
||||
a keyboard trap has been fixed.
|
||||
|
|
|
@ -57,10 +57,10 @@ static const char enum_type[] =
|
|||
"field splitting and pathname expansion are not performed on "
|
||||
"the arguments. Tilde expansion occurs on \avalue\a.]"
|
||||
"[r?Enables readonly. Once enabled, the value cannot be changed or unset.]"
|
||||
"[a?Indexed array. Each \aname\a will converted to an indexed "
|
||||
"[a?Indexed array. Each \aname\a is converted to an indexed "
|
||||
"array of type \b\f?\f\b. If a variable already exists, the current "
|
||||
"value will become index \b0\b.]"
|
||||
"[A?Associative array. Each \aname\a will converted to an associative "
|
||||
"[A?Associative array. Each \aname\a is converted to an associative "
|
||||
"array of type \b\f?\f\b. If a variable already exists, the current "
|
||||
"value will become subscript \b0\b.]"
|
||||
"[h]:[string?Used within a type definition to provide a help string "
|
||||
|
|
|
@ -224,6 +224,10 @@ int b_eval(int argc,char *argv[], Shbltin_t *context)
|
|||
return(shp->exitval);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* for the dictionary generator */
|
||||
int b_source(register int n,char *argv[],Shbltin_t *context){}
|
||||
#endif
|
||||
int b_dot_cmd(register int n,char *argv[],Shbltin_t *context)
|
||||
{
|
||||
register char *script;
|
||||
|
@ -529,7 +533,7 @@ static void print_times(struct timeval utime, struct timeval stime)
|
|||
sfprintf(sfstdout, "%dm%02d%c%03ds %dm%02d%c%03ds\n", ut_min, ut_sec, radix, ut_ms, st_min, st_sec, radix, st_ms);
|
||||
}
|
||||
#if _lib_getrusage
|
||||
static void print_cpu_times()
|
||||
static void print_cpu_times(void)
|
||||
{
|
||||
struct rusage usage;
|
||||
/* Print the time (user & system) consumed by the shell. */
|
||||
|
@ -540,7 +544,7 @@ static void print_cpu_times()
|
|||
print_times(usage.ru_utime, usage.ru_stime);
|
||||
}
|
||||
#else /* _lib_getrusage */
|
||||
static void print_cpu_times()
|
||||
static void print_cpu_times(void)
|
||||
{
|
||||
struct timeval utime, stime;
|
||||
double dtime;
|
||||
|
|
|
@ -183,6 +183,10 @@ int b_trap(int argc,char *argv[],Shbltin_t *context)
|
|||
return(0);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* for the dictionary generator */
|
||||
int b_stop(int argc,char *argv[],Shbltin_t *context){}
|
||||
#endif
|
||||
int b_kill(int argc,char *argv[],Shbltin_t *context)
|
||||
{
|
||||
register char *signame;
|
||||
|
|
|
@ -191,7 +191,13 @@ int b_alias(int argc,register char *argv[],Shbltin_t *context)
|
|||
|
||||
#if 0
|
||||
/* for the dictionary generator */
|
||||
int b_local(int argc,char *argv[],Shbltin_t *context){}
|
||||
int b_autoload(int argc,register char *argv[],Shbltin_t *context){}
|
||||
int b_compound(int argc,register char *argv[],Shbltin_t *context){}
|
||||
int b_float(int argc,register char *argv[],Shbltin_t *context){}
|
||||
int b_functions(int argc,register char *argv[],Shbltin_t *context){}
|
||||
int b_integer(int argc,register char *argv[],Shbltin_t *context){}
|
||||
int b_local(int argc,register char *argv[],Shbltin_t *context){}
|
||||
int b_nameref(int argc,register char *argv[],Shbltin_t *context){}
|
||||
#endif
|
||||
int b_typeset(int argc,register char *argv[],Shbltin_t *context)
|
||||
{
|
||||
|
|
|
@ -19,7 +19,7 @@ are Linux, System V Release 4, Solaris, Sun OS, HP-UX Release 8 and above,
|
|||
AIX 3.2 and above, and Microsoft Windows systems.
|
||||
.P
|
||||
This memo describes how to write and compile programs
|
||||
that can be loaded into \f5ksh\fP at run time as built-in
|
||||
that can be loaded into \f5ksh\fP at run time as built-in
|
||||
commands.
|
||||
.AE \" abstract end
|
||||
.H 1 INTRODUCTION
|
||||
|
|
|
@ -357,7 +357,7 @@ const char sh_optalias[] =
|
|||
"to see whether it is an alias.]"
|
||||
"[+?If no \aname\as are specified then the names and values of all "
|
||||
"aliases are written to standard output. Otherwise, for "
|
||||
"each \aname\a that is specified, and \b=\b\avalue\a is not "
|
||||
"each \aname\a that is specified, and \b=\b\avalue\a is not "
|
||||
"specified, the current value of the alias corresponding to "
|
||||
"\aname\a is written to standard output. If \b=\b\avalue\a is "
|
||||
"specified, the alias \aname\a will be created or redefined.]"
|
||||
|
@ -876,7 +876,7 @@ _JOB_
|
|||
"\n[job ...]\n"
|
||||
"\n"
|
||||
"[+EXIT STATUS?If \bfg\b brings one or more jobs into the foreground, "
|
||||
"the exit status of \bfg\b will be that of the last \ajob\a. "
|
||||
"the exit status of \bfg\b will be that of the last \ajob\a. "
|
||||
"If one or more jobs does not exist or has completed, \bfg\b will "
|
||||
"return a non-zero exit status.]"
|
||||
"}"
|
||||
|
@ -1374,7 +1374,7 @@ const char sh_optpwd[] =
|
|||
"[+DESCRIPTION?\bpwd\b writes an absolute pathname of the current working "
|
||||
"directory to standard output. An absolute pathname is a "
|
||||
"pathname that begins with \b/\b that does not contains any "
|
||||
"\b.\b or \b..\b components.]"
|
||||
"\b.\b or \b..\b components.]"
|
||||
"[+?If both \b-L\b and \b-P\b are specified, the last one specified will "
|
||||
"be used. If neither \b-P\b or \b-L\b is specified then the "
|
||||
"behavior will be determined by the \bgetconf\b parameter "
|
||||
|
@ -1777,7 +1777,7 @@ const char sh_opttypeset[] =
|
|||
"assigned before the attributes are set.]"
|
||||
"[+?When \btypeset\b is called inside a function defined with the "
|
||||
"\bfunction\b reserved word, and \aname\a does not contain a "
|
||||
"\b.\b, then a local variable statically scoped to that function "
|
||||
"\b.\b, then a local variable statically scoped to that function "
|
||||
"will be created.]"
|
||||
"[+?Not all option combinations are possible. For example, the numeric "
|
||||
"options \b-i\b, \b-E\b, and \b-F\b cannot be specified with "
|
||||
|
@ -1844,7 +1844,7 @@ const char sh_opttypeset[] =
|
|||
"value will be displayed as an unsigned integer.]"
|
||||
"[x?Puts each \aname\a on the export list. See \bexport\b(1). \aname\a "
|
||||
"cannot contain a \b.\b.]"
|
||||
"[A?Associative array. Each \aname\a will converted to an associative "
|
||||
"[A?Associative array. Each \aname\a is converted to an associative "
|
||||
"array. If a variable already exists, the current value will "
|
||||
"become index \b0\b.]"
|
||||
"[C?Compound variable. Each \aname\a will be a compound variable. If "
|
||||
|
@ -1976,7 +1976,7 @@ const char sh_optunset[] =
|
|||
"[-1c?\n@(#)$Id: unset (AT&T Research) 1999-07-07 $\n]"
|
||||
"[--catalog?" SH_DICT "]"
|
||||
"[+NAME?unset - unset values and attributes of variables and functions]"
|
||||
"[+DESCRIPTION?For each \aname\a specified, \bunset\b unsets the variable, "
|
||||
"[+DESCRIPTION?For each \aname\a specified, \bunset\b unsets the variable, "
|
||||
"or function if \b-f\b is specified, from the current shell "
|
||||
"execution environment. Readonly variables cannot be unset.]"
|
||||
"[n?If \aname\a refers to variable that is a reference, the variable \aname\a "
|
||||
|
@ -2037,7 +2037,7 @@ _JOB_
|
|||
"\n"
|
||||
"[+EXIT STATUS?If \await\a is invoked with one or more \ajob\as, and all of "
|
||||
"them have terminated or were not known by the invoking shell, "
|
||||
"the exit status of \bwait\b will be that of the last \ajob\a. "
|
||||
"the exit status of \bwait\b will be that of the last \ajob\a. "
|
||||
"Otherwise, it will be one of the following:]{"
|
||||
"[+0?\bwait\b utility was invoked with no operands and all "
|
||||
"processes known by the invoking process have terminated.]"
|
||||
|
|
|
@ -411,7 +411,7 @@ const char e_lexlabunknown[] = "line %d: %s unknown label";
|
|||
const char e_lexobsolete1[] = "line %d: `...` obsolete, use $(...)";
|
||||
const char e_lexobsolete2[] = "line %d: -a obsolete, use -e";
|
||||
const char e_lexobsolete3[] = "line %d: '=' obsolete, use '=='";
|
||||
const char e_lexobsolete4[] = "line %d: %s within [[...]] obsolete, use ((...))";
|
||||
const char e_lexobsolete4[] = "line %d: %s within [[ ... ]] obsolete, use ((...))";
|
||||
const char e_lexobsolete5[] = "line %d: set %s obsolete";
|
||||
const char e_lexobsolete6[] = "line %d: `{' instead of `in' is obsolete";
|
||||
const char e_lexusebrace[] = "line %d: use braces to avoid ambiguities with $id[...]";
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include "streval.h"
|
||||
|
||||
const unsigned char strval_precedence[35] =
|
||||
/* opcode precedence,assignment */
|
||||
/* opcode precedence,assignment */
|
||||
{
|
||||
/* DEFAULT */ MAXPREC|NOASSIGN,
|
||||
/* DONE */ 0|NOASSIGN|RASSOC,
|
||||
|
|
|
@ -351,7 +351,7 @@ int ed_expand(Edit_t *ep, char outbuff[],int *cur,int *eol,int mode, int count)
|
|||
rval = -1;
|
||||
goto done;
|
||||
}
|
||||
/* match? */
|
||||
/* match? */
|
||||
if (*com==0 || (narg <= 1 && (strcmp(ap->argval,*com)==0) || (addstar && com[0][strlen(*com)-1]=='*')))
|
||||
{
|
||||
rval = -1;
|
||||
|
|
|
@ -305,7 +305,7 @@ int tty_raw(register int fd, int echomode)
|
|||
return(-1);
|
||||
ep->e_ttyspeed = (ttyparm.sg_ospeed>=B1200?FAST:SLOW);
|
||||
# ifdef TIOCGLTC
|
||||
/* try to remove effect of ^V and ^Y and ^O */
|
||||
/* try to remove effect of ^V and ^Y and ^O */
|
||||
if(ioctl(fd,TIOCGLTC,&l_chars) != SYSERR)
|
||||
{
|
||||
lchars = l_chars;
|
||||
|
|
|
@ -374,7 +374,7 @@ int ed_emacsread(void *context, int fd,char *buff,int scend, int reedit)
|
|||
do_default_processing:
|
||||
default:
|
||||
|
||||
if ((eol+1) >= (scend)) /* will not fit on line */
|
||||
if ((eol+1) >= (scend)) /* will not fit on line */
|
||||
{
|
||||
ed_ungetchar(ep->ed,c); /* save character for next line */
|
||||
goto process;
|
||||
|
@ -1234,7 +1234,7 @@ static void xcommands(register Emacs_t *ep,int count)
|
|||
show_info(ep,hbuf);
|
||||
return;
|
||||
}
|
||||
# if !AST_ksh_release /* debugging, modify as required */
|
||||
# if !_AST_ksh_release /* debugging, modify as required */
|
||||
case cntl('D'): /* ^X^D show debugging info */
|
||||
{
|
||||
char debugbuf[MAXLINE];
|
||||
|
|
|
@ -501,7 +501,7 @@ int ed_viread(void *context, int fd, register char *shbuf, int nchar, int reedit
|
|||
}
|
||||
|
||||
/*** Line terminated with escape, or escaped eol/eof, ***/
|
||||
/* so set raw mode */
|
||||
/*** so set raw mode ***/
|
||||
|
||||
if( tty_raw(ERRIO,0) < 0 )
|
||||
{
|
||||
|
|
|
@ -150,6 +150,6 @@ cat{
|
|||
# endif /* FD_SET */
|
||||
# ifndef _typ_fd_set
|
||||
typedef long fd_set;
|
||||
# endif /*_typ_fd_set */
|
||||
# endif /* _typ_fd_set */
|
||||
#endif /* _lib_select */
|
||||
}end
|
||||
|
|
|
@ -120,7 +120,7 @@ struct argnod
|
|||
#define ARG_QUOTED 0x20 /* word contained quote characters */
|
||||
#define ARG_MESSAGE 0x40 /* contains international string */
|
||||
#define ARG_APPEND 0x80 /* for += assignment */
|
||||
/* The following can be passed as options to sh_macexpand() */
|
||||
/* The following can be passed as options to sh_macexpand() */
|
||||
#define ARG_ARITH 0x100 /* arithmetic expansion */
|
||||
#define ARG_OPTIMIZE 0x200 /* try to optimize */
|
||||
#define ARG_NOGLOB 0x400 /* no file name expansion */
|
||||
|
|
|
@ -81,7 +81,7 @@ struct sh_scoped
|
|||
char *funname;
|
||||
int lineno;
|
||||
Dt_t *save_tree; /* var_tree for calling function */
|
||||
struct sh_scoped *self; /* pointer to copy of this scope*/
|
||||
struct sh_scoped *self; /* pointer to copy of this scope */
|
||||
Dt_t *var_local; /* local level variables for name() */
|
||||
struct slnod *staklist; /* link list of function stacks */
|
||||
int states; /* shell state bits used by sh_isstate(), etc. */
|
||||
|
@ -163,12 +163,12 @@ struct shared
|
|||
char *lastarg; \
|
||||
char *lastpath; /* last absolute path found */ \
|
||||
int path_err; /* last error on path search */ \
|
||||
Dt_t *track_tree; /* for tracked aliases*/ \
|
||||
Dt_t *track_tree; /* for tracked aliases */ \
|
||||
Dt_t *var_base; /* global level variables */ \
|
||||
Dt_t *openmatch; \
|
||||
Namval_t *namespace; /* current active namespace*/ \
|
||||
Namval_t *last_table; /* last table used in last nv_open */ \
|
||||
Namval_t *prev_table; /* previous table used in nv_open */ \
|
||||
Namval_t *namespace; /* current active namespace */ \
|
||||
Namval_t *last_table; /* last table used in last nv_open */ \
|
||||
Namval_t *prev_table; /* previous table used in nv_open */ \
|
||||
Sfio_t *outpool; /* output stream pool */ \
|
||||
long timeout; /* read timeout */ \
|
||||
unsigned int curenv; /* current subshell number */ \
|
||||
|
|
|
@ -127,7 +127,7 @@ typedef struct edit
|
|||
struct termio e_ott;
|
||||
#endif
|
||||
int *e_globals; /* global variables */
|
||||
genchar *e_window; /* display window image */
|
||||
genchar *e_window; /* display window image */
|
||||
char e_inmacro; /* processing macro expansion */
|
||||
#if KSHELL
|
||||
char e_vi_insert[2]; /* for sh_keytrap */
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
#define S_RBRA 26 /* right brace after $ */
|
||||
#define S_PAR 27 /* set for $( */
|
||||
#define S_ENDCH 28 /* macro expansion terminator */
|
||||
#define S_SLASH 29 /* / character terminates ~ expansion */
|
||||
#define S_SLASH 29 /* / character terminates ~ expansion */
|
||||
#define S_COLON 30 /* for character : */
|
||||
#define S_LABEL 31 /* for goto label */
|
||||
#define S_EDOL 32 /* ends $identifier */
|
||||
|
|
|
@ -88,7 +88,7 @@ struct Namarray
|
|||
void *(*fun)(Namval_t*,const char*,int); /* associative arrays */
|
||||
void *fixed; /* for fixed sized arrays */
|
||||
Dt_t *table; /* for subscripts */
|
||||
void *scope; /* non-zerp when scoped */
|
||||
void *scope; /* non-zero when scoped */
|
||||
};
|
||||
|
||||
/* The context pointer for declaration command */
|
||||
|
@ -167,7 +167,7 @@ struct Namval
|
|||
#define NV_HEXFLOAT (NV_LTOU) /* for C99 base16 float notation */
|
||||
#define NV_FLTSIZEZERO -1 /* a float with size of 0 being <0 */
|
||||
|
||||
/* options for nv_open */
|
||||
/* options for nv_open */
|
||||
|
||||
#define NV_APPEND 0x10000 /* append value */
|
||||
#define NV_MOVE 0x8000000 /* for use with nv_clone */
|
||||
|
@ -231,7 +231,7 @@ struct Namval
|
|||
#define ARRAY_UNDEF (4L<<ARRAY_BITS) /* For ${array} */
|
||||
|
||||
|
||||
/* These are disciplines provided by the library for use with nv_discfun */
|
||||
/* These are disciplines provided by the library for use with nv_discfun */
|
||||
#define NV_DCADD 0 /* used to add named disciplines */
|
||||
#define NV_DCRESTRICT 1 /* variable that are restricted in rsh */
|
||||
|
||||
|
@ -242,7 +242,7 @@ struct Namval
|
|||
# define extern __IMPORT__
|
||||
# endif /* _BLD_shell */
|
||||
#endif /* _DLL */
|
||||
/* prototype for array interface*/
|
||||
/* prototype for array interface */
|
||||
extern Namarr_t *nv_arrayptr(Namval_t*);
|
||||
extern Namarr_t *nv_setarray(Namval_t*,void*(*)(Namval_t*,const char*,int));
|
||||
extern int nv_arraynsub(Namarr_t*);
|
||||
|
@ -285,7 +285,7 @@ extern void nv_setvec(Namval_t*,int,int,char*[]);
|
|||
extern void nv_setvtree(Namval_t*);
|
||||
extern int nv_setsize(Namval_t*,int);
|
||||
extern Namfun_t *nv_disc(Namval_t*,Namfun_t*,int);
|
||||
extern void nv_unset(Namval_t*); /*obsolete */
|
||||
extern void nv_unset(Namval_t*); /* obsolete */
|
||||
extern void _nv_unset(Namval_t*,int);
|
||||
extern Namval_t *nv_search(const char *, Dt_t*, int);
|
||||
extern char *nv_name(Namval_t*);
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
#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:1024) /* maximum recursion depth*/
|
||||
#define MAXDEPTH (sizeof(char*)==2?64:1024) /* maximum recursion depth */
|
||||
|
||||
/*
|
||||
* path component structure for path searching
|
||||
|
|
|
@ -113,7 +113,6 @@ typedef struct _shlex_
|
|||
#define IORDWRSYM (SYMGT|'<')
|
||||
#define IORDWRSYMT (SYMSEMI|'<')
|
||||
#define IOCLOBSYM (SYMPIPE|'>')
|
||||
#define PIPESYM2 (SYMPIPE|'&')
|
||||
#define IPROCSYM (SYMLPAR|'<')
|
||||
#define OPROCSYM (SYMLPAR|'>')
|
||||
#define EOFSYM 04000 /* end-of-file */
|
||||
|
|
|
@ -37,15 +37,15 @@
|
|||
#define FPOU (040<<COMBITS) /* output is a pipe */
|
||||
#define FPCL (0100<<COMBITS) /* close the pipe */
|
||||
#define FCOOP (0200<<COMBITS) /* cooperating process */
|
||||
#define FSHOWME (0400<<COMBITS) /* set for showme commands */
|
||||
#define FSHOWME (0400<<COMBITS) /* set for showme commands */
|
||||
#define FALTPIPE (02000<<COMBITS) /* alternate pipes &| */
|
||||
#define FPOSIX (02<<COMBITS) /* posix semantics function */
|
||||
#define FLINENO (04<<COMBITS) /* for/case has line number */
|
||||
#define FOPTGET (0200<<COMBITS) /* function calls getopts */
|
||||
|
||||
#define TNEGATE (01<<COMBITS) /* ! inside [[...]] */
|
||||
#define TBINARY (02<<COMBITS) /* binary operator in [[...]] */
|
||||
#define TUNARY (04<<COMBITS) /* unary operator in [[...]] */
|
||||
#define TNEGATE (01<<COMBITS) /* ! inside [[ ... ]] */
|
||||
#define TBINARY (02<<COMBITS) /* binary operator in [[ ... ]] */
|
||||
#define TUNARY (04<<COMBITS) /* unary operator in [[ ... ]] */
|
||||
#define TTEST (010<<COMBITS)
|
||||
#define TPAREN (TBINARY|TUNARY)
|
||||
#define TSHIFT (COMBITS+4)
|
||||
|
@ -170,7 +170,7 @@ struct arithnod
|
|||
};
|
||||
|
||||
|
||||
/* types of ionodes stored in iofile */
|
||||
/* types of ionodes stored in iofile */
|
||||
#define IOUFD 0x3f /* file descriptor number mask */
|
||||
#define IOPUT 0x40 /* > redirection operator */
|
||||
#define IOAPP 0x80 /* >> redirection operator */
|
||||
|
|
|
@ -102,7 +102,7 @@ typedef struct _arith_
|
|||
short elen;
|
||||
} Arith_t;
|
||||
#define ARITH_COMP 04 /* set when compile separate from execute */
|
||||
#define ARITH_ASSIGNOP 010 /* set during assignment operators */
|
||||
#define ARITH_ASSIGNOP 010 /* set during assignment operators */
|
||||
|
||||
#define MAXPREC 15 /* maximum precision level */
|
||||
#define SEQPOINT 0200 /* sequence point */
|
||||
|
|
|
@ -221,7 +221,7 @@ name-value pair as a string. A \f5NULL\fP return value indicates
|
|||
that the name-value pair is unset.
|
||||
The \f5nv_getnum()\fP function returns the value of the given
|
||||
name-value pair as a double precision number using the \f5Sfio\fP
|
||||
library (See Sfio(3)) type \f5Sfdouble_t\fP.
|
||||
library (see sfio(3)) type \f5Sfdouble_t\fP.
|
||||
For name-value pairs without the \f5NV_INTEGER\fP attribute,
|
||||
the string value is evaluated as an arithmetic expression to
|
||||
arrive at a numerical value.
|
||||
|
@ -244,14 +244,14 @@ argument is actually a pointer to a name-value pair
|
|||
and \f5np\fP should become a reference to this name-value pair.
|
||||
If \f5NV_NOFREE\fP is specified, \fIvalue\fP itself becomes
|
||||
the value of the name-value pair \fInp\fP.
|
||||
Otherwise, a copy of the value is stored
|
||||
Otherwise, a copy of the value is stored
|
||||
as the value for \fInp\fP.
|
||||
.PP
|
||||
The \f5nv_unset()\fP function clears out the value and attributes
|
||||
of the given name-value function but does not free the name-value
|
||||
pair.
|
||||
If called from the \f5putval\fP discipline function, use the \fIflags\fP
|
||||
argument as the \fIflags\fP to \f5nv_unset()\fP. Otherwise, use 0.
|
||||
argument as the \fIflags\fP to \f5nv_unset()\fP. Otherwise, use 0.
|
||||
.PP
|
||||
The following attributes can be associated with a name-value pair:
|
||||
.IP
|
||||
|
@ -541,7 +541,7 @@ and returned.
|
|||
.IP
|
||||
\f5NV_CLONE\fP:
|
||||
If \fIfp\fP is non-\f5NULL\fP and it is on the stack,
|
||||
it is replace by a copy created by \f5malloc\fP(3).
|
||||
it is replaced by a copy created by \f5malloc\fP(3).
|
||||
The \f5nofree\fP field is set to \f50\fP.
|
||||
The new discipline is returned.
|
||||
Otherwise, \f5NULL\fP is returned.
|
||||
|
@ -671,7 +671,7 @@ argument contains the string used by \f5optget\fP(3) to generate
|
|||
the man page and process the options. The \fIop\fP argument
|
||||
specifies the callback discipline used by \f5optget\fP(3) and
|
||||
\fIsz\fP specifies the size of the callback information so
|
||||
that the discipline \fBoptget\fP(3) can be extended with private
|
||||
that the discipline \fBoptget\fP(3) can be extended with private
|
||||
data used by the callback function.
|
||||
.P
|
||||
The \f5nv_mkinttype()\fP function creates named integer types
|
||||
|
|
|
@ -3951,7 +3951,7 @@ using \fB\s+2.\s-2\fP\f2identifier\fP\fB\s+2.\s-2\fP\f2name\fP.
|
|||
Similarly, a function defined by a command in the
|
||||
.B namespace
|
||||
.I list\^
|
||||
is created using the name space name preceded by a \fB\s+2.\s-2\fP.
|
||||
is created using the name space name preceded by a \fB\s+2.\s-2\fP.
|
||||
.PP
|
||||
When the
|
||||
.I list\^
|
||||
|
@ -4314,7 +4314,7 @@ being searched.
|
|||
.P
|
||||
The
|
||||
.B .paths
|
||||
file is then checked for a line of the form
|
||||
file is then checked for a line of the form
|
||||
.BI PLUGIN_LIB= libname
|
||||
\*(OK \f3:\fP \f2libname\^\fP \*(CK .\|.\|. .
|
||||
Each library named by
|
||||
|
@ -6145,7 +6145,7 @@ and IEEE POSIX 1003.2 standards.
|
|||
(See
|
||||
.IR pathconf (2)
|
||||
and
|
||||
.IR sysconf (2).)
|
||||
.IR sysconf (3).)
|
||||
The
|
||||
.I pathname
|
||||
argument is required for parameters whose value depends on
|
||||
|
@ -7479,7 +7479,7 @@ or
|
|||
\f3times\fP
|
||||
Displays the accumulated user and system CPU times, one line with the times
|
||||
used by the shell and another with those used by all of the shell's child
|
||||
processes. No options are supporetd.
|
||||
processes. No options are supported.
|
||||
.TP
|
||||
\(dg \f3trap\fP \*(OK \f3\-p\fP \*(CK \*(OK \f2action\^\fP \*(CK \*(OK \f2sig\^\fP \*(CK .\|.\|.
|
||||
The
|
||||
|
@ -8445,7 +8445,7 @@ except that the following are disallowed:
|
|||
.RS
|
||||
.PD 0
|
||||
.PP
|
||||
Unsetting the restricted option.
|
||||
unsetting the restricted option,
|
||||
.br
|
||||
changing directory (see
|
||||
.IR cd (1)),
|
||||
|
@ -8470,9 +8470,9 @@ redirecting output
|
|||
.BR >| ,
|
||||
.BR <> ,
|
||||
and
|
||||
.BR >> ).
|
||||
.BR >> ) ,
|
||||
.br
|
||||
adding or deleting built-in commands.
|
||||
adding or deleting built-in commands,
|
||||
.br
|
||||
using
|
||||
.B "command -p"
|
||||
|
@ -8591,7 +8591,7 @@ lseek(2),
|
|||
paste(1),
|
||||
pathconf(2),
|
||||
pipe(2),
|
||||
sysconf(2),
|
||||
sysconf(3),
|
||||
umask(2),
|
||||
ulimit(2),
|
||||
wait(2),
|
||||
|
|
|
@ -2778,7 +2778,7 @@ the pathname for the built-in. The basename of this path must
|
|||
be the name of an existing built-in for this to succeed.
|
||||
Specifying the name of the built-in without a pathname causes
|
||||
this built-in to be found before a path search.
|
||||
A built-in can be deleted with the \fB\-d\fP option.
|
||||
A built-in can be deleted with the \fB\-d\fP option.
|
||||
.P
|
||||
On systems with run time loading of libraries, built-in commands
|
||||
can be added with the \f5builtin\fP command.
|
||||
|
|
|
@ -768,7 +768,7 @@ struct argnod *sh_argprocsub(Shell_t *shp,struct argnod *argp)
|
|||
sh_offstate(SH_INTERACTIVE);
|
||||
sh_offstate(SH_MONITOR);
|
||||
job.jobcontrol = 0;
|
||||
/* do the process substitution */
|
||||
/* run the process substitution */
|
||||
shp->subshell = 0;
|
||||
if(fd)
|
||||
shp->inpipe = pv;
|
||||
|
|
|
@ -871,13 +871,8 @@ static struct index_array *array_grow(Namval_t *np, register struct index_array
|
|||
}
|
||||
}
|
||||
else
|
||||
if((ap->val[0].cp=np->nvalue.cp))
|
||||
if((ap->val[0].cp=np->nvalue.cp) || (nv_isattr(np,NV_INTEGER) && !nv_isnull(np)))
|
||||
i++;
|
||||
else if(nv_isattr(np,NV_INTEGER) && !nv_isnull(np))
|
||||
{
|
||||
Sfdouble_t d= nv_getnum(np);
|
||||
i++;
|
||||
}
|
||||
ap->header.nelem = i;
|
||||
ap->header.hdr.disc = &array_disc;
|
||||
nv_disc(np,(Namfun_t*)ap, NV_FIRST);
|
||||
|
@ -1525,7 +1520,7 @@ char *nv_endsubscript(Namval_t *np, register char *cp, int mode)
|
|||
{
|
||||
Namarr_t *ap = nv_arrayptr(np);
|
||||
/* Block an attempt to alter a readonly array via subscript assignment or by appending the array.
|
||||
However need to allow instances of type variables. This exception is observed when np->nvflag
|
||||
However instances of type variables must be allowed. This exception is observed when np->nvflag
|
||||
has NV_BINARY and NV_LJUST set besides NV_RDONLY and NV_ARRAY. */
|
||||
if(nv_isattr(np,NV_RDONLY) && nv_isattr(np,NV_ARRAY) && mode&NV_ASSIGN && np->nvflag&(NV_BINARY|NV_LJUST)^(NV_BINARY|NV_LJUST))
|
||||
{
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
/*
|
||||
* Ksh - AT&T Labs
|
||||
* Written by David Korn
|
||||
* This file defines all the read/write shell global variables
|
||||
* This file defines all the read/write shell global variables
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
|
|
|
@ -578,7 +578,7 @@ void sh_exit(register int xno)
|
|||
shp->prefix = 0;
|
||||
#if SHOPT_TYPEDEF
|
||||
shp->mktype = 0;
|
||||
#endif /* SHOPT_TYPEDEF*/
|
||||
#endif /* SHOPT_TYPEDEF */
|
||||
if(job.in_critical)
|
||||
job_unlock();
|
||||
if(pp->mode == SH_JMPSCRIPT && !pp->prev)
|
||||
|
|
|
@ -210,13 +210,6 @@ static char *env_init(Shell_t*);
|
|||
static void env_import_attributes(Shell_t*,char*);
|
||||
static Init_t *nv_init(Shell_t*);
|
||||
static int shlvl;
|
||||
|
||||
#ifdef _WINIX
|
||||
# define EXE "?(.exe)"
|
||||
#else
|
||||
# define EXE
|
||||
#endif
|
||||
|
||||
static int rand_shift;
|
||||
|
||||
/*
|
||||
|
@ -284,7 +277,7 @@ static void put_ed(register Namval_t* np,const char *val,int flags,Namfun_t *fp)
|
|||
goto done;
|
||||
if(!(cp=val) && (*name=='E' || !(cp=nv_getval(sh_scoped(shp,EDITNOD)))))
|
||||
goto done;
|
||||
/* turn on vi or emacs option if editor name is either*/
|
||||
/* turn on vi or emacs option if editor name is either */
|
||||
cp = path_basename(cp);
|
||||
#if SHOPT_VSH
|
||||
if(strmatch(cp,"*[Vv][Ii]*"))
|
||||
|
@ -1970,7 +1963,7 @@ static void env_import_attributes(Shell_t *shp, char *next)
|
|||
int size = *(unsigned char*)(cp+1)-' ';
|
||||
if((flag&NV_INTEGER) && size==0)
|
||||
{
|
||||
/* check for floating*/
|
||||
/* check for floating */
|
||||
char *dp, *val = nv_getval(np);
|
||||
strtol(val,&dp,10);
|
||||
if(*dp=='.' || *dp=='e' || *dp=='E')
|
||||
|
|
|
@ -436,7 +436,7 @@ int job_reap(register int sig)
|
|||
#ifdef DEBUG
|
||||
sfprintf(sfstderr,"ksh: job line %4d: reap pid=%d critical=%d job %d with pid %d flags=%o complete with status=%x exit=%d\n",__LINE__,shgd->current_pid,job.in_critical,pw->p_job,pid,pw->p_flag,wstat,pw->p_exit);
|
||||
sfsync(sfstderr);
|
||||
#endif /* DEBUG*/
|
||||
#endif /* DEBUG */
|
||||
/* only top-level process in job should have notify set */
|
||||
if(px && pw != px)
|
||||
pw->p_flag &= ~P_NOTIFY;
|
||||
|
@ -1461,7 +1461,7 @@ int job_wait(register pid_t pid)
|
|||
sfprintf(sfstderr,"ksh: job line %4d: wait pid=%d critical=%d job=%d pid=%d\n",__LINE__,shgd->current_pid,job.in_critical,jobid,pid);
|
||||
if(pw)
|
||||
sfprintf(sfstderr,"ksh: job line %4d: wait pid=%d critical=%d flags=%o\n",__LINE__,shgd->current_pid,job.in_critical,pw->p_flag);
|
||||
#endif /* DEBUG*/
|
||||
#endif /* DEBUG */
|
||||
errno = 0;
|
||||
if(shp->coutpipe>=0 && lastpid && shp->cpid==lastpid)
|
||||
{
|
||||
|
@ -1704,7 +1704,7 @@ static void job_unstop(register struct process *px)
|
|||
|
||||
/*
|
||||
* remove a job from table
|
||||
* If all the processes have not completed, unpost first non-completed process
|
||||
* If all the processes have not completed, unpost first non-completed process
|
||||
* Otherwise the job is removed and job_unpost returns NULL.
|
||||
* pwlist is reset if the first job is removed
|
||||
* if <notify> is non-zero, then jobs with pending notifications are unposted
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
***********************************************************************/
|
||||
#pragma prototyped
|
||||
/*
|
||||
* KornShell lexical analyzer
|
||||
* KornShell lexical analyzer
|
||||
*
|
||||
* Written by David Korn
|
||||
* AT&T Labs
|
||||
|
@ -73,7 +73,7 @@ local_iswblank(wchar_t wc)
|
|||
struct lexstate
|
||||
{
|
||||
char incase; /* 1 for case pattern, 2 after case */
|
||||
char intest; /* 1 inside [[...]] */
|
||||
char intest; /* 1 inside [[ ... ]] */
|
||||
char testop1; /* 1 when unary test op legal */
|
||||
char testop2; /* 1 when binary test op legal */
|
||||
char reservok; /* >0 for reserved word legal */
|
||||
|
@ -758,7 +758,7 @@ int sh_lex(Lex_t* lp)
|
|||
mode = ST_NORM;
|
||||
continue;
|
||||
case S_LIT:
|
||||
if(oldmode(lp)==ST_NONE && !lp->lexd.noarg) /* in ((...)) */
|
||||
if(oldmode(lp)==ST_NONE && !lp->lexd.noarg) /* in ((...)) */
|
||||
{
|
||||
if((c=fcpeek(0))==LPAREN || c==RPAREN || c=='$' || c==LBRACE || c==RBRACE || c=='[' || c==']')
|
||||
{
|
||||
|
@ -813,7 +813,7 @@ int sh_lex(Lex_t* lp)
|
|||
ingrave = !ingrave;
|
||||
/* FALLTHROUGH */
|
||||
case S_QUOTE:
|
||||
if(oldmode(lp)==ST_NONE && lp->lexd.arith) /* in ((...)) */
|
||||
if(oldmode(lp)==ST_NONE && lp->lexd.arith) /* in ((...)) */
|
||||
{
|
||||
if(n!=S_GRAVE || fcpeek(0)=='\'')
|
||||
continue;
|
||||
|
@ -2321,10 +2321,6 @@ struct argnod *sh_endword(Shell_t *shp,int mode)
|
|||
break;
|
||||
}
|
||||
n = *sp;
|
||||
#if SHOPT_DOS
|
||||
if(!(inquote&1) && sh_lexstates[ST_NORM][n]==0)
|
||||
break;
|
||||
#endif /* SHOPT_DOS */
|
||||
if(!(inquote&1) || (sh_lexstates[ST_QUOTE][n] && n!=RBRACE))
|
||||
{
|
||||
if(n=='\n')
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
|
||||
#if _WINIX
|
||||
static int Skip;
|
||||
#endif /*_WINIX */
|
||||
#endif /* _WINIX */
|
||||
|
||||
static int _c_;
|
||||
typedef struct _mac_
|
||||
|
@ -823,7 +823,7 @@ static void copyto(register Mac_t *mp,int endch, int newquote)
|
|||
first = cp = fcseek(Skip);
|
||||
Skip = 0;
|
||||
}
|
||||
#endif /*_WINIX */
|
||||
#endif /* _WINIX */
|
||||
tilde = -1;
|
||||
c=0;
|
||||
}
|
||||
|
|
|
@ -277,7 +277,7 @@ int sh_main(int ac, char *av[], Shinit_f userinit)
|
|||
if(((type = sh_type(cp = av[0])) & SH_TYPE_SH) && (name = nv_getval(L_ARGNOD)) && (!((type = sh_type(cp = name)) & SH_TYPE_SH)))
|
||||
{
|
||||
av[0] = (type & SH_TYPE_LOGIN) ? cp : path_basename(cp);
|
||||
/* exec to change $0 for ps */
|
||||
/* exec to change $0 for ps */
|
||||
execv(pathshell(),av);
|
||||
/* exec fails */
|
||||
shp->st.dolv[0] = av[0];
|
||||
|
@ -480,7 +480,7 @@ static void exfile(register Shell_t *shp, register Sfio_t *iop,register int fno)
|
|||
if(sh_isoption(SH_VERBOSE))
|
||||
sh_onstate(SH_VERBOSE);
|
||||
sh_onstate(SH_ERREXIT);
|
||||
/* -eim flags don't apply to profiles */
|
||||
/* -eim flags don't apply to profiles */
|
||||
if(sh_isstate(SH_PROFILE))
|
||||
{
|
||||
sh_offstate(SH_INTERACTIVE);
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
static char *savesub = 0;
|
||||
static char Null[1];
|
||||
static Namval_t NullNode;
|
||||
static Dt_t *Refdict;
|
||||
static Dt_t *Refdict;
|
||||
static Dtdisc_t _Refdisc =
|
||||
{
|
||||
offsetof(struct Namref,np),sizeof(struct Namval_t*),sizeof(struct Namref)
|
||||
|
@ -280,7 +280,7 @@ void nv_setlist(register struct argnod *arg,register int flags, Namval_t *typ)
|
|||
shtp.rp = 0;
|
||||
shtp.nodes = (Namval_t**)sh_malloc(shtp.maxnodes*sizeof(Namval_t*));
|
||||
}
|
||||
#endif /* SHOPT_TYPEDEF*/
|
||||
#endif /* SHOPT_TYPEDEF */
|
||||
#if SHOPT_NAMESPACE
|
||||
if(shp->namespace && nv_dict(shp->namespace)==shp->var_tree)
|
||||
flags |= NV_NOSCOPE;
|
||||
|
@ -734,9 +734,7 @@ Namval_t *nv_create(const char *name, Dt_t *root, int flags, Namfun_t *dp)
|
|||
long mode, add=0;
|
||||
int copy=0,isref,top=0,noscope=(flags&NV_NOSCOPE);
|
||||
int nofree=0, level=0;
|
||||
#if SHOPT_FIXEDARRAY
|
||||
Namarr_t *ap;
|
||||
#endif /* SHOPT_FIXEDARRAY */
|
||||
if(root==shp->var_tree)
|
||||
{
|
||||
if(dtvnext(root))
|
||||
|
@ -944,7 +942,7 @@ Namval_t *nv_create(const char *name, Dt_t *root, int flags, Namfun_t *dp)
|
|||
{
|
||||
if(flags&NV_ARRAY)
|
||||
{
|
||||
Namarr_t *ap = nv_arrayptr(np);
|
||||
ap = nv_arrayptr(np);
|
||||
nq = nv_opensub(np);
|
||||
if((flags&NV_ASSIGN) && (!nq || nv_isnull(nq)))
|
||||
ap->nelem++;
|
||||
|
@ -1034,7 +1032,7 @@ Namval_t *nv_create(const char *name, Dt_t *root, int flags, Namfun_t *dp)
|
|||
if(c=='[')
|
||||
{
|
||||
#if SHOPT_FIXEDARRAY
|
||||
Namarr_t *ap = nv_arrayptr(np);
|
||||
ap = nv_arrayptr(np);
|
||||
#endif /* SHOPT_FIXEDARRAY */
|
||||
n = mode|nv_isarray(np);
|
||||
if(!mode && (flags&NV_ARRAY) && ((c=sp[1])=='*' || c=='@') && sp[2]==']')
|
||||
|
@ -2073,7 +2071,7 @@ static void rightjust(char *str, int size, int fill)
|
|||
* given physical size, return a logical size which reflects the
|
||||
* screen width of multi-byte characters
|
||||
* Multi-width characters replaced by spaces if they cross the boundary
|
||||
* <type> is non-zero for right justified fields
|
||||
* <type> is non-zero for right justified fields
|
||||
*/
|
||||
|
||||
static int ja_size(char *str,int size,int type)
|
||||
|
@ -2604,36 +2602,6 @@ Namval_t *sh_scoped(Shell_t *shp, register Namval_t *np)
|
|||
return(dtsearch(shp->var_tree,np));
|
||||
}
|
||||
|
||||
/*
|
||||
* return space separated list of names of variables in given tree
|
||||
*/
|
||||
static char *tableval(Dt_t *root)
|
||||
{
|
||||
static Sfio_t *out;
|
||||
register Namval_t *np;
|
||||
register int first=1;
|
||||
register Dt_t *base = dtview(root,0);
|
||||
if(out)
|
||||
sfseek(out,(Sfoff_t)0,SEEK_SET);
|
||||
else
|
||||
out = sfnew((Sfio_t*)0,(char*)0,-1,-1,SF_WRITE|SF_STRING);
|
||||
for(np=(Namval_t*)dtfirst(root);np;np=(Namval_t*)dtnext(root,np))
|
||||
{
|
||||
if(!nv_isnull(np) || np->nvfun || nv_isattr(np,~NV_NOFREE))
|
||||
{
|
||||
if(!first)
|
||||
sfputc(out,' ');
|
||||
else
|
||||
first = 0;
|
||||
sfputr(out,np->nvname,-1);
|
||||
}
|
||||
}
|
||||
sfputc(out,0);
|
||||
if(base)
|
||||
dtview(root,base);
|
||||
return((char*)out->_data);
|
||||
}
|
||||
|
||||
#if SHOPT_OPTIMIZE
|
||||
struct optimize
|
||||
{
|
||||
|
|
|
@ -41,12 +41,12 @@ static const char sh_opttype[] =
|
|||
"field splitting and pathname expansion are not performed on "
|
||||
"the arguments. Tilde expansion occurs on \avalue\a.]"
|
||||
"[r?Enables readonly. Once enabled, the value cannot be changed or unset.]"
|
||||
"[a]:?[type?Indexed array. Each \aname\a will converted to an indexed "
|
||||
"[a]:?[type?Indexed array. Each \aname\a is converted to an indexed "
|
||||
"array of type \b\f?\f\b. If a variable already exists, the current "
|
||||
"value will become index \b0\b. If \b[\b\atype\a\b]]\b is "
|
||||
"specified, each subscript is interpreted as a value of enumeration "
|
||||
"type \atype\a.]"
|
||||
"[A?Associative array. Each \aname\a will converted to an associative "
|
||||
"[A?Associative array. Each \aname\a is converted to an associative "
|
||||
"array of type \b\f?\f\b. If a variable already exists, the current "
|
||||
"value will become subscript \b0\b.]"
|
||||
"[h]:[string?Used within a type definition to provide a help string "
|
||||
|
@ -666,7 +666,6 @@ static int typeinfo(Opt_t* op, Sfio_t *out, const char *str, Optdisc_t *fp)
|
|||
nq = nv_namptr(dp->nodes,i);
|
||||
if(tp=nv_type(nq))
|
||||
{
|
||||
Namfun_t *pp = nv_hasdisc(nq,&type_disc);
|
||||
sfprintf(out,"\t[+%s?%s.\n",nq->nvname,tp->nvname);
|
||||
n = strlen(nq->nvname);
|
||||
while((cp=nv_namptr(dp->nodes,i+1)->nvname) && memcmp(cp,nq->nvname,n)==0 && cp[n]=='.')
|
||||
|
|
|
@ -682,7 +682,7 @@ static Shnode_t *arithfor(Lex_t *lexp,register Shnode_t *tf)
|
|||
/* remove trailing white space */
|
||||
while(offset>ARGVAL && ((c= *stkptr(stkp,offset-1)),isspace(c)))
|
||||
offset--;
|
||||
/* check for empty initialization expression */
|
||||
/* check for empty initialization expression */
|
||||
if(offset==ARGVAL && n==0)
|
||||
continue;
|
||||
stkseek(stkp,offset);
|
||||
|
|
|
@ -1261,7 +1261,7 @@ pid_t path_spawn(Shell_t *shp,const char *opath,register char **argv, char **env
|
|||
|
||||
/*
|
||||
* File is executable but not machine code.
|
||||
* Assume file is a Shell script and execute it.
|
||||
* Assume file is a shell script and execute it.
|
||||
*/
|
||||
|
||||
static noreturn void exscript(Shell_t *shp,register char *path,register char *argv[],char **envp)
|
||||
|
@ -1285,7 +1285,7 @@ static noreturn void exscript(Shell_t *shp,register char *path,register char *ar
|
|||
sh_setstate(sh_state(SH_FORKED));
|
||||
sfsync(sfstderr);
|
||||
#if SHOPT_SUID_EXEC && !SHOPT_PFSH
|
||||
/* check if file cannot open for read or script is setuid/setgid */
|
||||
/* check if file cannot open for read or script is setuid/setgid */
|
||||
{
|
||||
static char name[] = "/tmp/euidXXXXXXXXXX";
|
||||
register int n;
|
||||
|
|
|
@ -239,7 +239,7 @@ found:
|
|||
void sh_trim(register char *sp)
|
||||
/*@
|
||||
assume sp!=NULL;
|
||||
promise strlen(in sp) <= in strlen(sp);
|
||||
promise strlen(in sp) <= in strlen(sp);
|
||||
@*/
|
||||
{
|
||||
register char *dp;
|
||||
|
|
|
@ -769,7 +769,7 @@ Sfio_t *sh_subshell(Shell_t *shp,Shnode_t *t, volatile int flags, int comsub)
|
|||
sfswap(sp->saveout,sfstdout);
|
||||
else
|
||||
sfstdout = &_Sfstdout;
|
||||
/* check if standard output was preserved */
|
||||
/* check if standard output was preserved */
|
||||
if(sp->tmpfd>=0)
|
||||
{
|
||||
int err=errno;
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
*/
|
||||
|
||||
/* The file name of the script to execute is argv[0]
|
||||
* Argv[1] is the program name
|
||||
* Argv[1] is the program name
|
||||
* The basic idea is to open the script as standard input, set the effective
|
||||
* user and group id correctly, and then exec the shell.
|
||||
* The complicated part is getting the effective uid of the caller and
|
||||
|
@ -87,7 +87,9 @@ static const char version[] = "\n@(#)$Id: suid_exec "SH_RELEASE" $\n";
|
|||
static const char badopen[] = "cannot open";
|
||||
static const char badexec[] = "cannot exec";
|
||||
static const char devfd[] = "/dev/fd/10"; /* must match FDIN above */
|
||||
#ifndef _lib_setreuid
|
||||
static char tmpname[] = "/tmp/SUIDXXXXXX";
|
||||
#endif
|
||||
static char **arglist;
|
||||
|
||||
static char *shell;
|
||||
|
|
|
@ -79,7 +79,7 @@ struct funenv
|
|||
Namval_t **nref;
|
||||
};
|
||||
|
||||
/* ======== command execution ========*/
|
||||
/* ======== command execution ======== */
|
||||
|
||||
#if !SHOPT_DEVFD
|
||||
static pid_t fifo_save_ppid;
|
||||
|
@ -158,8 +158,7 @@ static void get_cpu_times(Shell_t *shp, struct timeval *tv_usr, struct timeval *
|
|||
#endif /* _lib_getrusage */
|
||||
|
||||
#ifdef timeofday
|
||||
/* 'inline' is commented out because C89 doesn't have it */
|
||||
static /*inline*/ double timeval_to_double(struct timeval tv)
|
||||
static inline double timeval_to_double(struct timeval tv)
|
||||
{
|
||||
return (double)tv.tv_sec + ((double)tv.tv_usec / 1000000.0);
|
||||
}
|
||||
|
@ -444,7 +443,7 @@ static int p_comarg(register struct comnod *com)
|
|||
int n = p_arg(com->comset,ARG_ASSIGN);
|
||||
if(com->comarg && (com->comtyp&COMSCAN))
|
||||
n+= p_arg(com->comarg,0);
|
||||
if(com->comstate && np)
|
||||
if(com->comstate && np)
|
||||
{
|
||||
/* call builtin to cleanup state */
|
||||
Shbltin_t *bp = &sh.bltindata;
|
||||
|
@ -611,7 +610,7 @@ struct Level
|
|||
/*
|
||||
* this is for a debugger but it hasn't been tested yet
|
||||
* if a debug script sets .sh.level it should set up the scope
|
||||
* as if you were executing in that level
|
||||
* as if you were executing in that level
|
||||
*/
|
||||
static void put_level(Namval_t* np,const char *val,int flags,Namfun_t *fp)
|
||||
{
|
||||
|
@ -1677,7 +1676,7 @@ int sh_exec(register const Shnode_t *t, int flags)
|
|||
}
|
||||
if(shp->topfd > topfd)
|
||||
sh_iorestore(shp,topfd,0);
|
||||
if(usepipe && tsetio && subdup && unpipe)
|
||||
if(usepipe && tsetio && subdup && unpipe)
|
||||
sh_iounpipe(shp);
|
||||
if(!sh_isstate(SH_MONITOR))
|
||||
{
|
||||
|
@ -2072,7 +2071,7 @@ int sh_exec(register const Shnode_t *t, int flags)
|
|||
|
||||
case TLST:
|
||||
{
|
||||
/* a list of commands are executed here */
|
||||
/* a list of commands are executed here */
|
||||
do
|
||||
{
|
||||
sh_exec(t->lst.lstlef,errorflg|OPTIMIZE);
|
||||
|
|
|
@ -145,9 +145,9 @@ The \f5Shell_t\fP structure contains the following fields:
|
|||
Dt_t *\fIalias_tree\fP; \fR/* shell alias dictionary */\fP
|
||||
Dt_t *\fIbltin_tree\fP; \fR/* shell built-in dictionary */\fP
|
||||
Shscope_t *\fItopscope\fP; \fR/* pointer to top-level scope */\fP
|
||||
char *\fIinfile_name\fP; \fR/* path name of current input file*/\fP
|
||||
int \fIinlineno\fP; \fR/* line number of current input file*/\fP
|
||||
int \fIexitval\fP; \fR/* most recent exit value*/\fP
|
||||
char *\fIinfile_name\fP; \fR/* path name of current input file */\fP
|
||||
int \fIinlineno\fP; \fR/* line number of current input file */\fP
|
||||
int \fIexitval\fP; \fR/* most recent exit value */\fP
|
||||
.ft R
|
||||
.fi
|
||||
This structure is returned by \f5sh_init()\fP but can also be retrieved
|
||||
|
@ -383,7 +383,7 @@ a slow device or waiting for a process to complete.
|
|||
This function can process events and run shell commands
|
||||
until there is input, the timer is reached or a signal arises.
|
||||
It is called with three arguments. The first is the file
|
||||
descriptor from which the shell trying to read or \f5\-1\fP
|
||||
descriptor from which the shell trying to read or \f5\-1\fP
|
||||
if the shell is waiting for a process to complete.
|
||||
The second is a timeout in milliseconds.
|
||||
A value of \f5\-1\fP for the timeout means that
|
||||
|
|
|
@ -132,7 +132,7 @@ y=* z=[
|
|||
s[$y]=1
|
||||
s[$z]=2
|
||||
if (( ${#s[@]} != 2 ))
|
||||
then err_exit 'number of elements of is not 2'
|
||||
then err_exit 'number of elements of s is not 2'
|
||||
fi
|
||||
(( s[$z] = s[$z] + ${s[$y]} ))
|
||||
if [[ ${s[$z]} != 3 ]]
|
||||
|
|
|
@ -68,7 +68,7 @@ if [[ ! -d . ]]
|
|||
then err_exit "-d: . should be a directory file"
|
||||
fi
|
||||
if [[ -f /dev/null ]]
|
||||
then err_exit "-f: /dev/null should not be an ordinary file"
|
||||
then err_exit "-f: /dev/null should not be an ordinary file"
|
||||
fi
|
||||
chmod 000 $file
|
||||
|
||||
|
@ -132,26 +132,26 @@ fi
|
|||
[[ -z '' && -z '' && -z '' ]] || err_exit "three ors not working"
|
||||
(exit 8)
|
||||
if [[ $? -ne 8 || $? -ne 8 ]]
|
||||
then err_exit 'value $? within [[...]]'
|
||||
then err_exit 'value $? within [[ ... ]]'
|
||||
fi
|
||||
x='(x'
|
||||
if [[ '(x' != '('* ]]
|
||||
then err_exit " '(x' does not match '('* within [[...]]"
|
||||
then err_exit " '(x' does not match '('* within [[ ... ]]"
|
||||
fi
|
||||
if [[ '(x' != "("* ]]
|
||||
then err_exit ' "(x" does not match "("* within [[...]]'
|
||||
then err_exit ' "(x" does not match "("* within [[ ... ]]'
|
||||
fi
|
||||
if [[ '(x' != \(* ]]
|
||||
then err_exit ' "(x" does not match \(* within [[...]]'
|
||||
then err_exit ' "(x" does not match \(* within [[ ... ]]'
|
||||
fi
|
||||
if [[ 'x(' != *'(' ]]
|
||||
then err_exit " 'x(' does not match '('* within [[...]]"
|
||||
then err_exit " 'x(' does not match '('* within [[ ... ]]"
|
||||
fi
|
||||
if [[ 'x&' != *'&' ]]
|
||||
then err_exit " 'x&' does not match '&'* within [[...]]"
|
||||
then err_exit " 'x&' does not match '&'* within [[ ... ]]"
|
||||
fi
|
||||
if [[ 'xy' == *'*' ]]
|
||||
then err_exit " 'xy' matches *'*' within [[...]]"
|
||||
then err_exit " 'xy' matches *'*' within [[ ... ]]"
|
||||
fi
|
||||
if [[ 3 > 4 ]]
|
||||
then err_exit '3 < 4'
|
||||
|
@ -252,7 +252,7 @@ i=hell
|
|||
[[ hell0 == $i[0] ]] || err_exit 'pattern $i[0] interpreted as array ref'
|
||||
test '(' = ')' && err_exit '"test ( = )" should not be true'
|
||||
[[ $($SHELL -c 'case F in ~(Eilr)[a-z0-9#]) print ok;;esac' 2> /dev/null) == ok ]] || err_exit '~(Eilr) not working in case command'
|
||||
[[ $($SHELL -c "case Q in ~(Fi)q | \$'\E') print ok;;esac" 2> /dev/null) == ok ]] || err_exit '~(Fi)q | \E not working in case command'
|
||||
[[ $($SHELL -c "case Q in ~(Fi)q | \$'\E') print ok;;esac" 2> /dev/null) == ok ]] || err_exit '~(Fi)q | \E not working in case command'
|
||||
|
||||
locales=$'\n'$(command -p locale -a 2>/dev/null)$'\n'
|
||||
for l in C C.UTF-8 en_US.ISO8859-1 en_US.ISO8859-15 en_US.UTF-8
|
||||
|
@ -330,7 +330,7 @@ unset x
|
|||
unset x y z foo bar
|
||||
|
||||
{ x=$($SHELL -c '[[ (( $# -eq 0 )) ]] && print ok') 2> /dev/null;}
|
||||
[[ $x == ok ]] || err_exit '((...)) inside [[...]] not treated as nested ()'
|
||||
[[ $x == ok ]] || err_exit '((...)) inside [[ ... ]] not treated as nested ()'
|
||||
|
||||
[[ -e /dev/fd/ ]] || err_exit '/dev/fd/ does not exits'
|
||||
[[ -e /dev/tcp/ ]] || err_exit '/dev/tcp/ does not exist'
|
||||
|
@ -400,11 +400,11 @@ done
|
|||
|
||||
# ======
|
||||
# Tests from ksh93v- for the -eq operator
|
||||
[[ 010 -eq 10 ]] || err_exit '010 is not 10 in [[...]]'
|
||||
[[ 010 -eq 10 ]] || err_exit '010 is not 10 in [[ ... ]]'
|
||||
|
||||
unset foo
|
||||
foo=10
|
||||
([[ foo -eq 10 ]]) || err_exit 'foo -eq 10 fails in [[...]] with foo=10'
|
||||
([[ foo -eq 10 ]]) || err_exit 'foo -eq 10 fails in [[ ... ]] with foo=10'
|
||||
|
||||
# ======
|
||||
exit $((Errors<125?Errors:125))
|
||||
|
|
|
@ -226,11 +226,11 @@ if (( $(printf 'x\0y' | wc -c) != 3 ))
|
|||
then err_exit 'printf \0 not working'
|
||||
fi
|
||||
if [[ $(printf "%bx%s\n" 'f\to\cbar') != $'f\to' ]]
|
||||
then err_exit 'printf %bx%s\n not working'
|
||||
then err_exit 'printf %bx%s\n not working'
|
||||
fi
|
||||
alpha=abcdefghijklmnop
|
||||
if [[ $(printf "%10.*s\n" 5 $alpha) != ' abcde' ]]
|
||||
then err_exit 'printf %10.%s\n not working'
|
||||
then err_exit 'printf %10.%s\n not working'
|
||||
fi
|
||||
float x2=.0000625
|
||||
if [[ $(printf "%10.5E\n" x2) != 6.25000E-05 ]]
|
||||
|
@ -748,11 +748,11 @@ foo=BUG command eval ':'
|
|||
# 'whence -f' should ignore functions
|
||||
foo_bar() { true; }
|
||||
actual="$(whence -f foo_bar)"
|
||||
whence -f foo_bar >/dev/null && err_exit "'whence -f' doesn't ignore functions (got '$(printf %q "$actual")')"
|
||||
whence -f foo_bar >/dev/null && err_exit "'whence -f' doesn't ignore functions (got $(printf %q "$actual"))"
|
||||
|
||||
# whence -vq/type -q must be tested as well
|
||||
actual="$(type -f foo_bar 2>&1)"
|
||||
type -f foo_bar >/dev/null 2>&1 && err_exit "'type -f' doesn't ignore functions (got '$(printf %q "$actual")')"
|
||||
type -f foo_bar >/dev/null 2>&1 && err_exit "'type -f' doesn't ignore functions (got $(printf %q "$actual"))"
|
||||
type -qf foo_bar && err_exit "'type -qf' doesn't ignore functions"
|
||||
|
||||
# Test the exit status of 'whence -q'
|
||||
|
@ -1060,7 +1060,7 @@ exp=1
|
|||
[[ $got == $exp ]] || err_exit "'kill %' has the wrong exit status (expected '$exp'; got '$got')"
|
||||
|
||||
# ======
|
||||
# 'cd -' should recognize the value of an overriden $OLDPWD variable
|
||||
# 'cd -' should recognize the value of an overridden $OLDPWD variable
|
||||
# https://github.com/ksh93/ksh/pull/249
|
||||
# https://github.com/att/ast/issues/8
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ if [[ ${newrec.name} != "${rec.name}" ]]
|
|||
then err_exit 'copying a compound object not working'
|
||||
fi
|
||||
if (( newrec.born.day != 16 ))
|
||||
then err_exit 'copying integer field of compound object not working'
|
||||
then err_exit 'copying integer field of compound object not working'
|
||||
fi
|
||||
p_t=(
|
||||
integer z=0
|
||||
|
@ -511,7 +511,7 @@ expected=$'(\n\ttypeset -A subtree=(\n\t\t[a_node]=(\n\t\t\tone=hello\n\t\t\ttwo
|
|||
typeset -C -A array
|
||||
float array[12].amount=2.9
|
||||
expected='typeset -C -A array=([12]=(typeset -l -E amount=2.9))'
|
||||
[[ $(typeset -p array) == "$expected" ]] || err_exit 'typeset with compound variable with compound variable array not working'
|
||||
[[ $(typeset -p array) == "$expected" ]] || err_exit 'typeset with compound variable with compound variable array not working'
|
||||
|
||||
typeset -T foo_t=(
|
||||
function diff
|
||||
|
|
|
@ -991,7 +991,7 @@ caller() {
|
|||
bar() { caller;}
|
||||
set -- $(bar)
|
||||
[[ $1 == $2 ]] && err_exit ".sh.inline optimization bug"
|
||||
( $SHELL -c ' function foo { typeset x=$1;print $1;};z=();z=($(foo bar)) ') 2> /dev/null || err_exit 'using a function to set an array in a command sub fails'
|
||||
( $SHELL -c ' function foo { typeset x=$1;print $1;};z=();z=($(foo bar)) ') 2> /dev/null || err_exit 'using a function to set an array in a command sub fails'
|
||||
|
||||
{
|
||||
got=$(
|
||||
|
@ -1153,7 +1153,7 @@ func2
|
|||
}
|
||||
foo
|
||||
EOF
|
||||
} 2> /dev/null || err_exit 'problem with unset -f foo within function foo'
|
||||
} 2> /dev/null || err_exit "problem with 'unset -f foo' within function foo"
|
||||
|
||||
val=$($SHELL 2> /dev/null <<- \EOF
|
||||
.sh.fun.set() { set -x; }
|
||||
|
|
|
@ -776,7 +776,7 @@ got=$(umask 777; set +x; { cat <(echo ok); } 2>&1)
|
|||
|
||||
# ======
|
||||
# https://github.com/att/ast/issues/1336
|
||||
# Use the /proc psuedo filesystem on Linux as a convenient way to force a write I/O error.
|
||||
# Use the /proc pseudo filesystem on Linux as a convenient way to force a write I/O error.
|
||||
if [[ $(uname) == Linux ]]
|
||||
then
|
||||
actual=$($SHELL -c 'echo > /proc/self/uid_map; echo okay' 2>&1)
|
||||
|
|
|
@ -81,7 +81,7 @@ function x.set
|
|||
[[ ${.sh.value} ]] && print hello
|
||||
}
|
||||
if [[ $(.foo.bar.set) != $(x.set) ]]
|
||||
then err_exit "function references not working"
|
||||
then err_exit "function references not working"
|
||||
fi
|
||||
if [[ $(typeset +n) != x ]]
|
||||
then err_exit "typeset +n doesn't list names of reference variables"
|
||||
|
|
|
@ -765,12 +765,14 @@ touch $'XXX\xc3\xa1' $'XXX\xc3\xab' &&
|
|||
tst $LINENO <<"!"
|
||||
L autocomplete should not fill partial multibyte characters
|
||||
# https://github.com/ksh93/ksh/issues/223
|
||||
|
||||
d 15
|
||||
p :test-1:
|
||||
w : XX\t
|
||||
r ^:test-1: : XXX\r\n$
|
||||
!
|
||||
|
||||
# err_exit #
|
||||
((SHOPT_VSH)) && tst $LINENO <<"!"
|
||||
L Using b, B, w and W commands in vi mode
|
||||
# https://github.com/att/ast/issues/1467
|
||||
|
|
|
@ -85,11 +85,11 @@ if [[ $z != 'a{b}c' ]]
|
|||
then err_exit '"${z="a{b}c"}" not correct'
|
||||
fi
|
||||
if [[ $(print -r -- "a\*b") != 'a\*b' ]]
|
||||
then err_exit '$(print -r -- "a\*b") differs from a\*b'
|
||||
then err_exit '$(print -r -- "a\*b") differs from a\*b'
|
||||
fi
|
||||
unset x
|
||||
if [[ $(print -r -- "a\*b$x") != 'a\*b' ]]
|
||||
then err_exit '$(print -r -- "a\*b$x") differs from a\*b'
|
||||
then err_exit '$(print -r -- "a\*b$x") differs from a\*b'
|
||||
fi
|
||||
x=hello
|
||||
set -- ${x+foo bar bam}
|
||||
|
@ -306,19 +306,19 @@ re='@(?*)/@(?*)/@(?*)'
|
|||
string='\3'
|
||||
[[ ${subject/${re}/${string}} != words ]] && err_exit 'string replacement with $string not working with string=\3'
|
||||
[[ $(print -r "${subject/${re}/${string}}") != words ]] && err_exit 'string replacement with $string not working with string=\3 using print'
|
||||
[[ ${subject/${re}/"${string}"} != '\3' ]] && err_exit 'string replacement with "$string" not working with string=\3'
|
||||
[[ $(print -r "${subject/${re}/"${string}"}") != '\3' ]] && err_exit 'string replacement with "$string" not working with string=\3 using print'
|
||||
[[ ${subject/${re}/"${string}"} != '\3' ]] && err_exit 'string replacement with "$string" not working with string=\3'
|
||||
[[ $(print -r "${subject/${re}/"${string}"}") != '\3' ]] && err_exit 'string replacement with "$string" not working with string=\3 using print'
|
||||
string='\\3'
|
||||
[[ ${subject/${re}/${string}} != '\3' ]] && err_exit 'string replacement with $string not working with string=\\3'
|
||||
[[ ${subject/${re}/"${string}"} != '\\3' ]] && err_exit 'string replacement with "$string" not working with string=\\3'
|
||||
[[ ${subject/${re}/"${string}"} != '\\3' ]] && err_exit 'string replacement with "$string" not working with string=\\3'
|
||||
[[ ${subject/${re}/\4} != '\4' ]] && err_exit 'string replacement with \4 not working'
|
||||
[[ ${subject/${re}/'\4'} != '\4' ]] && err_exit 'string replacement with '\4' not working'
|
||||
string='\4'
|
||||
[[ ${subject/${re}/${string}} != '\4' ]] && err_exit 'string replacement with $string not working with string=\4'
|
||||
[[ ${subject/${re}/"${string}"} != '\4' ]] && err_exit 'string replacement with "$string" not working with string=\4'
|
||||
[[ ${subject/${re}/"${string}"} != '\4' ]] && err_exit 'string replacement with "$string" not working with string=\4'
|
||||
string='&foo'
|
||||
[[ ${subject/${re}/${string}} != '&foo' ]] && err_exit 'string replacement with $string not working with string=&foo'
|
||||
[[ ${subject/${re}/"${string}"} != '&foo' ]] && err_exit 'string replacement with "$string" not working with string=&foo'
|
||||
[[ ${subject/${re}/"${string}"} != '&foo' ]] && err_exit 'string replacement with "$string" not working with string=&foo'
|
||||
{
|
||||
x=x
|
||||
x=${x:-`id | sed 's/^[^(]*(\([^)]*\)).*/\1/'`}
|
||||
|
|
|
@ -84,11 +84,11 @@ if [[ $z != 'a{b}c' ]]
|
|||
then err_exit '"${z="a{b}c"}" not correct'
|
||||
fi
|
||||
if [[ $(print -r -- "a\*b") != 'a\*b' ]]
|
||||
then err_exit '$(print -r -- "a\*b") differs from a\*b'
|
||||
then err_exit '$(print -r -- "a\*b") differs from a\*b'
|
||||
fi
|
||||
unset x
|
||||
if [[ $(print -r -- "a\*b$x") != 'a\*b' ]]
|
||||
then err_exit '$(print -r -- "a\*b$x") differs from a\*b'
|
||||
then err_exit '$(print -r -- "a\*b$x") differs from a\*b'
|
||||
fi
|
||||
x=hello
|
||||
set -- ${x+foo bar bam}
|
||||
|
@ -157,10 +157,10 @@ fi
|
|||
# The following caused a syntax error on earlier versions
|
||||
foo=foo x=-
|
||||
if [[ `eval print \\${foo$x}` != foo* ]]
|
||||
then err_exit '`eval print \\${foo$x}`' not working
|
||||
then err_exit '`eval print \\${foo$x}`' not working
|
||||
fi
|
||||
if [[ "`eval print \\${foo$x}`" != foo* ]]
|
||||
then err_exit '"`eval print \\${foo$x}`"' not working
|
||||
then err_exit '"`eval print \\${foo$x}`"' not working
|
||||
fi
|
||||
if ( [[ $() != '' ]] )
|
||||
then err_exit '$() not working'
|
||||
|
|
|
@ -137,7 +137,7 @@ do if print foo | grep bar
|
|||
then break
|
||||
fi
|
||||
done
|
||||
(( d==2000 )) || err_exit "trap '' CHLD causes side effects d=$d"
|
||||
(( d==2000 )) || err_exit "trap '' CHLD causes side effects d=$d"
|
||||
trap - CHLD
|
||||
|
||||
x=$($SHELL 2> /dev/null -ic '/dev/null/notfound; sleep .05 & sleep .1;jobs')
|
||||
|
|
|
@ -283,7 +283,7 @@
|
|||
08-12-07 include/ast_std.h,misc/getenv.c: no _ast_getenv for uwin ast54 compatibility
|
||||
08-12-07 tm/tmxfmt.c: add %[_][EO]K for [space pad] [full|long] iso
|
||||
08-12-07 sfio/sfvscanf.c: fix ok[] short by one allocation
|
||||
08-12-07 comp/setlocale.c: fix off by one composite initialition loop test
|
||||
08-12-07 comp/setlocale.c: fix off by one composite initialization loop test
|
||||
08-12-07 path/pathkey.c: fix off by one loop test
|
||||
08-12-04 vmalloc/vmbest.c: catch sbrk() wraparound
|
||||
08-12-04 comp/spawnveg.c: clean up attrs on failure too
|
||||
|
|
|
@ -42,6 +42,8 @@ typedef struct _direct_s
|
|||
/* convert a pointer to an int */
|
||||
#define P2I(p) (Sfulong_t)((char*)(p) - (char*)0)
|
||||
|
||||
#ifdef F_DIOINFO
|
||||
|
||||
#if __STD_C
|
||||
static ssize_t diordwr(Sfio_t* f, Void_t* buf, size_t n, Direct_t* di, int type)
|
||||
#else
|
||||
|
@ -59,7 +61,6 @@ int type;
|
|||
done = 0; /* amount processed by direct IO */
|
||||
rv = 0;
|
||||
|
||||
#ifdef F_DIOINFO
|
||||
if((P2I(buf)%di->dio.d_mem) == 0 &&
|
||||
(f->here%di->dio.d_miniosz) == 0 && n >= di->dio.d_miniosz )
|
||||
{ /* direct IO ok, make sure we're in the right mode */
|
||||
|
@ -92,7 +93,6 @@ int type;
|
|||
di->cntl &= ~FDIRECT;
|
||||
(void)fcntl(f->file, F_SETFL, di->cntl);
|
||||
}
|
||||
#endif /*F_DIOINFO*/
|
||||
|
||||
if((rw = n-done) > 0 &&
|
||||
(rv = type == SF_READ ? read(f->file,buf,rw) : write(f->file,buf,rw)) > 0 )
|
||||
|
@ -141,18 +141,18 @@ Sfdisc_t* disc;
|
|||
|
||||
if(type == SF_FINAL || type == SF_DPOP)
|
||||
{
|
||||
#ifdef F_DIOINFO
|
||||
if(di->cntl&FDIRECT)
|
||||
{ di->cntl &= ~FDIRECT;
|
||||
(void)fcntl(f->file,F_SETFL,di->cntl);
|
||||
}
|
||||
#endif
|
||||
free(disc);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* F_DIOINFO */
|
||||
|
||||
#if __STD_C
|
||||
int sfdcdio(Sfio_t* f, size_t bufsize)
|
||||
#else
|
||||
|
|
|
@ -202,6 +202,14 @@ typedef struct
|
|||
#define FMT_EXP_NOCR 0x100 /* skip \r */
|
||||
#define FMT_EXP_NONL 0x200 /* skip \n */
|
||||
|
||||
/*
|
||||
* Define inline as an empty macro if we are
|
||||
* compiling with C89.
|
||||
*/
|
||||
#if __STDC_VERSION__ < 199901L
|
||||
#define inline
|
||||
#endif
|
||||
|
||||
/*
|
||||
* multibyte macros
|
||||
*/
|
||||
|
|
|
@ -226,7 +226,7 @@ outputs an
|
|||
prompt specified by
|
||||
.I "format, .\|.\|."
|
||||
to the controlling terminal and reads a response from the controlling terminal.
|
||||
Offirmative response returns
|
||||
Affirmative response returns
|
||||
.LR 0 ,
|
||||
.L EOF
|
||||
or quit response returns
|
||||
|
|
|
@ -69,7 +69,7 @@ That is, \fIuserf\fP is called on a directory only after its descendants have
|
|||
been processed.
|
||||
The absence of this bit indicates that calls to the user functions
|
||||
are issued in preorder. That is, \fIuserf\fP is
|
||||
called on a directory before its descendants are processed.
|
||||
called on a directory before its descendants are processed.
|
||||
.IP
|
||||
FTW_PHYSICAL: Use \fIlstat\fR(2) instead of \fIstat\fR(2) to get
|
||||
file status and allow detection of symbolic links.
|
||||
|
|
|
@ -696,7 +696,7 @@ may result in undefined behavior.
|
|||
.PP
|
||||
.Ss " int sfgetc(Sfio_t* f)"
|
||||
.Ss " int sfputc(Sfio_t* f, int c)"
|
||||
These functions read/write a byte from/to stream \f5f\fP.
|
||||
These functions read/write a byte from/to stream \f5f\fP.
|
||||
\f5sfgetc()\fP returns the byte read or \f5-1\fP on error.
|
||||
\f5sfputc()\fP returns \f5c\fP on success and \f5-1\fP on error.
|
||||
|
||||
|
@ -2356,8 +2356,8 @@ symbol may be removed in a future release.
|
|||
The printing and scanning functions were extended to handle multibyte characters
|
||||
and to conform to the C99 standard.
|
||||
.PP
|
||||
The function \f5sfpoll()\fP was rehauled to make it useful
|
||||
for writing servers that must commnunicate with multiple streams
|
||||
The function \f5sfpoll()\fP was overhauled to make it useful
|
||||
for writing servers that must communicate with multiple streams
|
||||
without blocking.
|
||||
.PP
|
||||
The formatting pattern \f5%c\fP for \f5sf*printf\fP was extended
|
||||
|
|
|
@ -284,7 +284,7 @@ events in a \fIregion\fP.
|
|||
There are two standard disciplines, both with \f5round\fP being 0 and \f5exceptf\fP being \f5NULL\fP.
|
||||
.TP
|
||||
.MW Vmdcsystem
|
||||
A discipline whose \f5memoryf\fP function gets space from the operation system
|
||||
A discipline whose \f5memoryf\fP function gets space from the operation system
|
||||
via different available methods which include \fImmap(2)\fP, \fIsbrk(2)\fP and
|
||||
functions from the WIN32 API.
|
||||
For historical reason, \fIVmdcsbrk\fP is also available and functions like \fIVmdcsystem\fP.
|
||||
|
@ -523,7 +523,7 @@ A \f5Vmstat_t\fP structure has at least these members:
|
|||
.MW "size_t m_free; /* maximum free block size */
|
||||
.MW "int n_seg; /* count of segments */
|
||||
.MW "size_t extent; /* memory extent of region */
|
||||
.MW "int n_region; /* total Malloc regions */
|
||||
.MW "int n_region; /* total Malloc regions */
|
||||
.MW "int n_open; /* non-blocked operations */
|
||||
.MW "int n_lock; /* blocked operations */
|
||||
.MW "int n_probe; /* region searches */
|
||||
|
|
|
@ -47,6 +47,12 @@
|
|||
* not done for `csh script arg ...'
|
||||
*/
|
||||
|
||||
#ifdef _WINIX
|
||||
# define EXE "?(.exe)"
|
||||
#else
|
||||
# define EXE
|
||||
#endif
|
||||
|
||||
char*
|
||||
pathshell(void)
|
||||
{
|
||||
|
@ -59,13 +65,13 @@ pathshell(void)
|
|||
|
||||
static char* val;
|
||||
|
||||
if ((sh = getenv("SHELL")) && *sh == '/' && strmatch(sh, "*/(sh|*[!cC]sh)*([[:digit:]])?(-+([.[:alnum:]]))?(.exe)"))
|
||||
if ((sh = getenv("SHELL")) && *sh == '/' && strmatch(sh, "*/(sh|*[!cC]sh)*([[:digit:]])?(-+([.[:alnum:]]))" EXE))
|
||||
{
|
||||
if (!(ru = getuid()) || !eaccess("/bin", W_OK))
|
||||
{
|
||||
if (stat(sh, &st))
|
||||
goto defshell;
|
||||
if (ru != st.st_uid && !strmatch(sh, "?(/usr)?(/local)/?([ls])bin/?([[:lower:]])sh?(.exe)"))
|
||||
if (ru != st.st_uid && !strmatch(sh, "?(/usr)?(/local)/?([ls])bin/?([[:lower:]])sh" EXE))
|
||||
goto defshell;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -57,7 +57,7 @@ int* peek;
|
|||
}
|
||||
|
||||
/* buffer used during scanning of a double value or a multi-byte
|
||||
character. the fields mirror certain local variables in sfvscanf. */
|
||||
character. the fields mirror certain local variables in sfvscanf. */
|
||||
typedef struct _scan_s
|
||||
{ int error; /* get set by _sfdscan if no value specified */
|
||||
int inp; /* last input character read */
|
||||
|
|
|
@ -30,6 +30,9 @@
|
|||
#include <ast.h>
|
||||
#include <ctype.h>
|
||||
#include <ls.h>
|
||||
#ifdef __linux__
|
||||
#include <sys/sysmacros.h>
|
||||
#endif
|
||||
|
||||
char*
|
||||
fmtdev(struct stat* st)
|
||||
|
|
|
@ -465,7 +465,7 @@ static C_block PC2ROT[2][64/CHUNKBITS][1<<CHUNKBITS];
|
|||
/* Initial permutation/expansion table */
|
||||
static C_block IE3264[32/CHUNKBITS][1<<CHUNKBITS];
|
||||
|
||||
/* Table that combines the S, P, and E operations. */
|
||||
/* Table that combines the S, P, and E operations. */
|
||||
static long SPE[2][8][64];
|
||||
|
||||
/* compressed/interleaved => final permutation table */
|
||||
|
|
|
@ -248,7 +248,7 @@ sc1 = 9.97395106984001955652274773456e+000,
|
|||
sc2 = 2.80952153365721279953959310660e+001,
|
||||
sc3 = 2.19826478142545234106819407316e+001;
|
||||
/*
|
||||
* Coefficients for approximation to erfc in [4,28]
|
||||
* Coefficients for approximation to erfc in [4,28]
|
||||
*/
|
||||
static double
|
||||
rd0 = -2.1491361969012978677e-016, /* includes lsqrtPI_lo */
|
||||
|
@ -280,7 +280,7 @@ extern double erf(x)
|
|||
if (ax < .84375) {
|
||||
if (ax < 3.7e-09) {
|
||||
if (ax < 1.0e-308)
|
||||
return 0.125*(8.0*x+p0t8*x); /*avoid underflow */
|
||||
return 0.125*(8.0*x+p0t8*x); /* avoid underflow */
|
||||
return x + p0*x;
|
||||
}
|
||||
y = x*x;
|
||||
|
|
|
@ -165,7 +165,7 @@ double x;
|
|||
|
||||
#endif
|
||||
|
||||
/* returns exp(r = x + c) for |c| < |x| with no overlap. */
|
||||
/* returns exp(r = x + c) for |c| < |x| with no overlap. */
|
||||
|
||||
double __exp__D(x, c)
|
||||
double x, c;
|
||||
|
|
|
@ -166,7 +166,7 @@ double x;
|
|||
/* end of x < lnhuge */
|
||||
|
||||
else
|
||||
/* expm1(INF) is INF, expm1(+big#) overflows to INF */
|
||||
/* expm1(INF) is INF, expm1(+big#) overflows to INF */
|
||||
return( finite(x) ? scalb(one,5000) : x);
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ static char sccsid[] = "@(#)log1p.c 8.1 (Berkeley) 6/4/93";
|
|||
* Method :
|
||||
* 1. Argument Reduction: find k and f such that
|
||||
* 1+x = 2^k * (1+f),
|
||||
* where sqrt(2)/2 < 1+f < sqrt(2) .
|
||||
* where sqrt(2)/2 < 1+f < sqrt(2) .
|
||||
*
|
||||
* 2. Let s = f/(2+f) ; based on log(1+f) = log(1+s) - log(1-s)
|
||||
* = 2s + 2/3 s**3 + 2/5 s**5 + .....,
|
||||
|
|
|
@ -267,7 +267,7 @@ static int vmflinit()
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* use multiple regions to reduce blocking by concurrent threads */
|
||||
/* use multiple regions to reduce blocking by concurrent threads */
|
||||
#if _mem_mmap_anon || _mem_mmap_zero
|
||||
static Vmalloc_t *Region[64]; /* list of concurrent regions */
|
||||
static unsigned int Regmax = 64; /* max number of regions */
|
||||
|
|
|
@ -430,7 +430,7 @@ struct _seg_s
|
|||
#define DB2BEST(d) ((Vmuchar_t*)(d) - 2*sizeof(Head_t))
|
||||
#define DB2DEBUG(b) ((Vmuchar_t*)(b) + 2*sizeof(Head_t))
|
||||
|
||||
/* set file and line number, note that DBLN > 0 so that DBISBAD will work */
|
||||
/* set file and line number, note that DBLN > 0 so that DBISBAD will work */
|
||||
#define DBSETFL(d,f,l) (DBFILE(d) = (f), DBLN(d) = (f) ? (l) : 1)
|
||||
|
||||
/* set and test the state of known to be corrupted */
|
||||
|
|
|
@ -57,7 +57,7 @@ static const char usage[] =
|
|||
"converted back to the native encoding. Multibyte characters in the "
|
||||
"current locale are treated as printable characters.]"
|
||||
"[A:show-all?Equivalent to \b-vET\b.]"
|
||||
"[B:squeeze-blank?Multiple adjacent new-line characters are replace by one"
|
||||
"[B:squeeze-blank?Multiple adjacent new-line characters are replaced by one"
|
||||
" new-line.]"
|
||||
"[D:dos-output?Output files are opened in \atext\amode which inserts carriage"
|
||||
" returns in front of new-lines on some systems.]"
|
||||
|
|
|
@ -43,7 +43,7 @@ static const char usage[] =
|
|||
"to zero. \bfold\b will not insert a newline immediately "
|
||||
"before or after a carriage-return.]"
|
||||
"[+backspace?If positive, the current count of line width will be "
|
||||
"decremented by one. \bfold\b will not insert a newline "
|
||||
"decremented by one. \bfold\b will not insert a newline "
|
||||
"immediately before or after a backspace.]"
|
||||
"[+tab?Each tab character encountered will advance the column "
|
||||
"position to the next tab stop. Tab stops are at each "
|
||||
|
|
|
@ -478,7 +478,7 @@ outfield(Join_t* jp, int index, register int n, int last)
|
|||
{
|
||||
register unsigned char* sp = jp->state;
|
||||
|
||||
/*eliminate leading spaces */
|
||||
/* eliminate leading spaces */
|
||||
if (jp->mb)
|
||||
for (;;)
|
||||
{
|
||||
|
|
|
@ -48,7 +48,7 @@ static const char usage[] =
|
|||
"[+m?1 MiB.]"
|
||||
"[+g?1 GiB.]"
|
||||
"}"
|
||||
"[+?For backwards compatibility, \b-\b\anumber\a is equivalent to "
|
||||
"[+?For backwards compatibility, \b-\b\anumber\a is equivalent to "
|
||||
"\b-n\b \anumber\a and \b+\b\anumber\a is equivalent to "
|
||||
"\b-n -\b\anumber\a. \anumber\a may also have these option "
|
||||
"suffixes: \bb c f g k l m r\b.]"
|
||||
|
|
|
@ -37,7 +37,7 @@ static const char usage[] =
|
|||
"to standard output. If no \ainfile\a is given, or if the \ainfile\a "
|
||||
"is \b-\b, \buniq\b reads from standard input with the start of "
|
||||
"the file defined as the current offset.]"
|
||||
"[c:count?Output the number of times each line occurred along with "
|
||||
"[c:count?Output the number of times each line occurred along with "
|
||||
"the line.]"
|
||||
"[d:repeated|duplicates?Output the first of each duplicate line.]"
|
||||
"[D:all-repeated?Output all duplicate lines as a group with an empty "
|
||||
|
|
|
@ -201,9 +201,9 @@ static const char id[] = "\n@(#)$Id: dll library (AT&T Research) 2010-10-20 $\0\
|
|||
* its virtual origin and where it was
|
||||
* actually placed
|
||||
*/
|
||||
/*N.B. o_sndata etc. are one based */
|
||||
/* N.B. o_sndata etc. are one based */
|
||||
datareloc = (ulong)data - hdr->s[hdr->a.o_sndata-1].s_vaddr;
|
||||
/*hdr is address of header, not text, so add text s_scnptr */
|
||||
/* hdr is address of header, not text, so add text s_scnptr */
|
||||
textreloc = (ulong)hdr + hdr->s[hdr->a.o_sntext-1].s_scnptr
|
||||
- hdr->s[hdr->a.o_sntext-1].s_vaddr;
|
||||
ldhdr = (void*)((char*)hdr+ hdr->s[hdr->a.o_snloader-1].s_scnptr);
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
* ASSERT NOTE:
|
||||
* Some sanity checking code is included using assert(). On my FreeBSD
|
||||
* system, this additional code can be removed by compiling with NDEBUG
|
||||
* defined. Check your own systems man page on assert() to see how to
|
||||
* defined. Check your own system's man page on assert() to see how to
|
||||
* compile WITHOUT the sanity checking code on your system.
|
||||
*
|
||||
* UNROLLED TRANSFORM LOOP NOTE:
|
||||
|
|
Loading…
Reference in a new issue