* update to mksh R26c
* there is no comma in front of "which" in English, I was taught
This commit is contained in:
parent
eb33e02f8e
commit
3f2912d717
@ -1,4 +1,4 @@
|
|||||||
$MirOS: src/bin/mksh/copyright,v 1.9 2006/01/27 00:44:16 tg Stab $
|
$MirOS: src/bin/mksh/copyright,v 1.10 2006/01/30 12:37:21 tg Exp $
|
||||||
|
|
||||||
mksh is a collective work under the following licence:
|
mksh is a collective work under the following licence:
|
||||||
|
|
||||||
@ -34,5 +34,5 @@ stead, please look at the file for the complete terms.
|
|||||||
On systems which use the GNU libc, an additional file (strlfun.c) has
|
On systems which use the GNU libc, an additional file (strlfun.c) has
|
||||||
to be built. It is covered by the ISC/OpenBSD licence.
|
to be built. It is covered by the ISC/OpenBSD licence.
|
||||||
|
|
||||||
On GNU/Cygwin, GNU/Linux, Solaris, setmode.c is compiled in, which is
|
On GNU/Cygwin, GNU/Linux, Solaris, setmode.c is compiled in (which is
|
||||||
covered by a three-clause UCB licence.
|
covered by a three-clause UCB licence).
|
||||||
|
4
edit.c
4
edit.c
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.18 2006/01/29 20:04:49 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.19 2006/01/30 12:37:21 tg Exp $");
|
||||||
|
|
||||||
/* tty driver characters we are interested in */
|
/* tty driver characters we are interested in */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -597,7 +597,7 @@ x_locate_word(const char *buf, int buflen, int pos, int *startp,
|
|||||||
iscmd = p < 0 || strchr(";|&()`", buf[p]);
|
iscmd = p < 0 || strchr(";|&()`", buf[p]);
|
||||||
if (iscmd) {
|
if (iscmd) {
|
||||||
/* If command has a /, path, etc. is not searched;
|
/* If command has a /, path, etc. is not searched;
|
||||||
* only current directory is searched, which is just
|
* only current directory is searched which is just
|
||||||
* like file globbing.
|
* like file globbing.
|
||||||
*/
|
*/
|
||||||
for (p = start; p < end; p++)
|
for (p = start; p < end; p++)
|
||||||
|
4
exec.c
4
exec.c
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.13 2006/01/29 20:04:51 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.14 2006/01/30 12:37:22 tg Exp $");
|
||||||
|
|
||||||
static int comexec(struct op *, struct tbl *volatile, char **,
|
static int comexec(struct op *, struct tbl *volatile, char **,
|
||||||
int volatile);
|
int volatile);
|
||||||
@ -395,7 +395,7 @@ comexec(struct op *t, struct tbl *volatile tp, char **ap, volatile int flags)
|
|||||||
|
|
||||||
/* Deal with the shell builtins builtin, exec and command since
|
/* Deal with the shell builtins builtin, exec and command since
|
||||||
* they can be followed by other commands. This must be done before
|
* they can be followed by other commands. This must be done before
|
||||||
* we know if we should create a local block, which must be done
|
* we know if we should create a local block which must be done
|
||||||
* before we can do a path search (in case the assignments change
|
* before we can do a path search (in case the assignments change
|
||||||
* PATH).
|
* PATH).
|
||||||
* Odd cases:
|
* Odd cases:
|
||||||
|
6
funcs.c
6
funcs.c
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.25 2006/01/29 20:04:51 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.26 2006/01/30 12:37:22 tg Exp $");
|
||||||
|
|
||||||
int
|
int
|
||||||
c_cd(char **wp)
|
c_cd(char **wp)
|
||||||
@ -347,7 +347,7 @@ c_print(char **wp)
|
|||||||
|
|
||||||
/* Ensure we aren't killed by a SIGPIPE while writing to
|
/* Ensure we aren't killed by a SIGPIPE while writing to
|
||||||
* a coprocess. at&t ksh doesn't seem to do this (seems
|
* a coprocess. at&t ksh doesn't seem to do this (seems
|
||||||
* to just check that the co-process is alive, which is
|
* to just check that the co-process is alive which is
|
||||||
* not enough).
|
* not enough).
|
||||||
*/
|
*/
|
||||||
if (coproc.write >= 0 && coproc.write == fd) {
|
if (coproc.write >= 0 && coproc.write == fd) {
|
||||||
@ -541,7 +541,7 @@ c_typeset(char **wp)
|
|||||||
|
|
||||||
fieldstr = basestr = NULL;
|
fieldstr = basestr = NULL;
|
||||||
builtin_opt.flags |= GF_PLUSOPT;
|
builtin_opt.flags |= GF_PLUSOPT;
|
||||||
/* at&t ksh seems to have 0-9 as options, which are multiplied
|
/* at&t ksh seems to have 0-9 as options which are multiplied
|
||||||
* to get a number that is used with -L, -R, -Z or -i (eg, -1R2
|
* to get a number that is used with -L, -R, -Z or -i (eg, -1R2
|
||||||
* sets right justify in a field of 12). This allows options
|
* sets right justify in a field of 12). This allows options
|
||||||
* to be grouped in an order (eg, -Lu12), but disallows -i8 -L3 and
|
* to be grouped in an order (eg, -Lu12), but disallows -i8 -L3 and
|
||||||
|
4
jobs.c
4
jobs.c
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/jobs.c,v 1.6 2005/11/22 18:40:42 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/jobs.c,v 1.7 2006/01/30 12:37:23 tg Exp $");
|
||||||
|
|
||||||
/* Order important! */
|
/* Order important! */
|
||||||
#define PRUNNING 0
|
#define PRUNNING 0
|
||||||
@ -930,7 +930,7 @@ j_waitj(Job *j,
|
|||||||
* a fork/exec instead of an exec (the fork means
|
* a fork/exec instead of an exec (the fork means
|
||||||
* the execed shell gets a different pid from its
|
* the execed shell gets a different pid from its
|
||||||
* pgrp, so naturally it sets its pgrp and gets hosed
|
* pgrp, so naturally it sets its pgrp and gets hosed
|
||||||
* when it gets foregrounded by the parent shell, which
|
* when it gets foregrounded by the parent shell which
|
||||||
* has restored the tty's pgrp to that of the su
|
* has restored the tty's pgrp to that of the su
|
||||||
* process).
|
* process).
|
||||||
*/
|
*/
|
||||||
|
4
main.c
4
main.c
@ -6,7 +6,7 @@
|
|||||||
#define EXTERN /* define EXTERNs in sh.h */
|
#define EXTERN /* define EXTERNs in sh.h */
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.33 2006/01/29 20:56:55 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.34 2006/01/30 12:37:23 tg Exp $");
|
||||||
|
|
||||||
#define MKSH_VERSION "@(#)MIRBSD KSH R26 2006/01/29"
|
#define MKSH_VERSION "@(#)MIRBSD KSH R26 2006/01/29"
|
||||||
|
|
||||||
@ -481,7 +481,7 @@ shell(Source * volatile s, volatile int toplevel)
|
|||||||
really_exit = 1;
|
really_exit = 1;
|
||||||
s->type = SSTDIN;
|
s->type = SSTDIN;
|
||||||
} else {
|
} else {
|
||||||
/* this for POSIX, which says EXIT traps
|
/* this for POSIX which says EXIT traps
|
||||||
* shall be taken in the environment
|
* shall be taken in the environment
|
||||||
* immediately after the last command
|
* immediately after the last command
|
||||||
* executed.
|
* executed.
|
||||||
|
30
mksh.1
30
mksh.1
@ -1,4 +1,4 @@
|
|||||||
.\" $MirOS: src/bin/mksh/mksh.1,v 1.28 2006/01/29 20:04:52 tg Exp $
|
.\" $MirOS: src/bin/mksh/mksh.1,v 1.29 2006/01/30 12:37:23 tg Exp $
|
||||||
.\" $OpenBSD: ksh.1,v 1.109 2005/12/06 20:40:02 jmc Exp $
|
.\" $OpenBSD: ksh.1,v 1.109 2005/12/06 20:40:02 jmc Exp $
|
||||||
.\" $OpenBSD: sh.1tbl,v 1.53 2004/12/10 01:56:56 jaredy Exp $
|
.\" $OpenBSD: sh.1tbl,v 1.53 2004/12/10 01:56:56 jaredy Exp $
|
||||||
.\"
|
.\"
|
||||||
@ -194,7 +194,7 @@ command is executed.
|
|||||||
The shell begins parsing its input by removing any backslash-newline
|
The shell begins parsing its input by removing any backslash-newline
|
||||||
combinations, then breaking it into
|
combinations, then breaking it into
|
||||||
.Em words .
|
.Em words .
|
||||||
Words, which are sequences of characters, are delimited by unquoted whitespace
|
Words (which are sequences of characters) are delimited by unquoted whitespace
|
||||||
characters (space, tab, and newline) or meta-characters
|
characters (space, tab, and newline) or meta-characters
|
||||||
.Po
|
.Po
|
||||||
.Ql \*(Lt ,
|
.Ql \*(Lt ,
|
||||||
@ -352,7 +352,7 @@ to the standard input of the following command.
|
|||||||
The exit status of a pipeline is that of its last command.
|
The exit status of a pipeline is that of its last command.
|
||||||
A pipeline may be prefixed by the
|
A pipeline may be prefixed by the
|
||||||
.Ql \&!
|
.Ql \&!
|
||||||
reserved word, which causes the exit status of the pipeline to be logically
|
reserved word which causes the exit status of the pipeline to be logically
|
||||||
complemented: if the original status was 0, the complemented status will be 1;
|
complemented: if the original status was 0, the complemented status will be 1;
|
||||||
if the original status was not 0, the complemented status will be 0.
|
if the original status was not 0, the complemented status will be 0.
|
||||||
.Pp
|
.Pp
|
||||||
@ -962,7 +962,7 @@ The results of substitution are, unless otherwise specified, also subject to
|
|||||||
brace expansion and file name expansion (see the relevant sections below).
|
brace expansion and file name expansion (see the relevant sections below).
|
||||||
.Pp
|
.Pp
|
||||||
A command substitution is replaced by the output generated by the specified
|
A command substitution is replaced by the output generated by the specified
|
||||||
command, which is run in a subshell.
|
command which is run in a subshell.
|
||||||
For
|
For
|
||||||
.Pf $( Ns Ar command Ns \&)
|
.Pf $( Ns Ar command Ns \&)
|
||||||
substitutions, normal quoting rules are used when
|
substitutions, normal quoting rules are used when
|
||||||
@ -1566,7 +1566,7 @@ files are created in
|
|||||||
.Pa /tmp .
|
.Pa /tmp .
|
||||||
.El
|
.El
|
||||||
.Ss Tilde expansion
|
.Ss Tilde expansion
|
||||||
Tilde expansion, which is done in parallel with parameter substitution, is done
|
Tilde expansion which is done in parallel with parameter substitution, is done
|
||||||
on words starting with an unquoted
|
on words starting with an unquoted
|
||||||
.Ql ~ .
|
.Ql ~ .
|
||||||
The characters following the tilde, up to the first
|
The characters following the tilde, up to the first
|
||||||
@ -2084,9 +2084,9 @@ otherwise the result is
|
|||||||
.Aq Ar arg3 .
|
.Aq Ar arg3 .
|
||||||
.El
|
.El
|
||||||
.Ss Co-processes
|
.Ss Co-processes
|
||||||
A co-process, which is a pipeline created with the
|
A co-process (which is a pipeline created with the
|
||||||
.Sq \*(Ba&
|
.Sq \*(Ba&
|
||||||
operator, is an asynchronous process that the shell can both write to (using
|
operator) is an asynchronous process that the shell can both write to (using
|
||||||
.Ic print -p )
|
.Ic print -p )
|
||||||
and read from (using
|
and read from (using
|
||||||
.Ic read -p ) .
|
.Ic read -p ) .
|
||||||
@ -2171,7 +2171,7 @@ command (which is an alias for
|
|||||||
may be used to create undefined functions: when an undefined function is
|
may be used to create undefined functions: when an undefined function is
|
||||||
executed, the shell searches the path specified in the
|
executed, the shell searches the path specified in the
|
||||||
.Ev FPATH
|
.Ev FPATH
|
||||||
parameter for a file with the same name as the function, which, if found, is
|
parameter for a file with the same name as the function which, if found, is
|
||||||
read and executed.
|
read and executed.
|
||||||
If after executing the file the named function is found to
|
If after executing the file the named function is found to
|
||||||
be defined, the function is executed; otherwise, the normal command search is
|
be defined, the function is executed; otherwise, the normal command search is
|
||||||
@ -2373,7 +2373,7 @@ is printed.
|
|||||||
.Pp
|
.Pp
|
||||||
The
|
The
|
||||||
.Fl d
|
.Fl d
|
||||||
option causes directory aliases, which are used in tilde expansion, to be
|
option causes directory aliases which are used in tilde expansion to be
|
||||||
listed or set (see
|
listed or set (see
|
||||||
.Sx Tilde expansion
|
.Sx Tilde expansion
|
||||||
above).
|
above).
|
||||||
@ -2439,7 +2439,7 @@ flag is given, the specified input
|
|||||||
.Ar string
|
.Ar string
|
||||||
will afterwards be immediately replaced by the given
|
will afterwards be immediately replaced by the given
|
||||||
.Ar substitute
|
.Ar substitute
|
||||||
string, which may contain editing commands.
|
string which may contain editing commands.
|
||||||
.Pp
|
.Pp
|
||||||
Control characters may be written using caret notation
|
Control characters may be written using caret notation
|
||||||
i.e. ^X represents Control-X.
|
i.e. ^X represents Control-X.
|
||||||
@ -2991,7 +2991,7 @@ The
|
|||||||
option is used to emulate, to some degree, the
|
option is used to emulate, to some degree, the
|
||||||
.Bx
|
.Bx
|
||||||
.Xr echo 1
|
.Xr echo 1
|
||||||
command, which does not process
|
command which does not process
|
||||||
.Ql \e
|
.Ql \e
|
||||||
sequences unless the
|
sequences unless the
|
||||||
.Fl e
|
.Fl e
|
||||||
@ -3667,7 +3667,7 @@ command above).
|
|||||||
.Pp
|
.Pp
|
||||||
There are two special signals:
|
There are two special signals:
|
||||||
.Dv EXIT
|
.Dv EXIT
|
||||||
(also known as 0), which is executed when the shell is about to exit, and
|
(also known as 0) which is executed when the shell is about to exit, and
|
||||||
.Dv ERR ,
|
.Dv ERR ,
|
||||||
which is executed after an error occurs (an error is something that would cause
|
which is executed after an error occurs (an error is something that would cause
|
||||||
the shell to exit if the
|
the shell to exit if the
|
||||||
@ -3832,7 +3832,7 @@ All lower case characters in values are converted to upper case.
|
|||||||
.Dq unsigned integer
|
.Dq unsigned integer
|
||||||
when used with the
|
when used with the
|
||||||
.Fl i
|
.Fl i
|
||||||
option, which meant upper case letters would never be used for bases greater
|
option which meant upper case letters would never be used for bases greater
|
||||||
than 10.
|
than 10.
|
||||||
See the
|
See the
|
||||||
.Fl U
|
.Fl U
|
||||||
@ -4068,7 +4068,7 @@ If the type of one or more of the names could not be determined, the exit
|
|||||||
status is non-zero.
|
status is non-zero.
|
||||||
.El
|
.El
|
||||||
.Ss Job control
|
.Ss Job control
|
||||||
Job control refers to the shell's ability to monitor and control jobs, which
|
Job control refers to the shell's ability to monitor and control jobs which
|
||||||
are processes or groups of processes created for commands or pipelines.
|
are processes or groups of processes created for commands or pipelines.
|
||||||
At a minimum, the shell keeps track of the status of the background (i.e.\&
|
At a minimum, the shell keeps track of the status of the background (i.e.\&
|
||||||
asynchronous) jobs that currently exist; this information can be displayed
|
asynchronous) jobs that currently exist; this information can be displayed
|
||||||
@ -4161,7 +4161,7 @@ indicates the current state of the job and can be:
|
|||||||
.It Done Op Ar number
|
.It Done Op Ar number
|
||||||
The job exited.
|
The job exited.
|
||||||
.Ar number
|
.Ar number
|
||||||
is the exit status of the job, which is omitted if the status is zero.
|
is the exit status of the job which is omitted if the status is zero.
|
||||||
.It Running
|
.It Running
|
||||||
The job has neither stopped nor exited (note that running does not necessarily
|
The job has neither stopped nor exited (note that running does not necessarily
|
||||||
mean consuming CPU time \-
|
mean consuming CPU time \-
|
||||||
|
4
syn.c
4
syn.c
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.5 2006/01/29 20:04:53 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.6 2006/01/30 12:37:24 tg Exp $");
|
||||||
|
|
||||||
struct nesting_state {
|
struct nesting_state {
|
||||||
int start_token; /* token than began nesting (eg, FOR) */
|
int start_token; /* token than began nesting (eg, FOR) */
|
||||||
@ -242,7 +242,7 @@ get_command(int cf)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case '(':
|
case '(':
|
||||||
/* Check for "> foo (echo hi)", which at&t ksh
|
/* Check for "> foo (echo hi)" which at&t ksh
|
||||||
* allows (not POSIX, but not disallowed)
|
* allows (not POSIX, but not disallowed)
|
||||||
*/
|
*/
|
||||||
afree(t, ATEMP);
|
afree(t, ATEMP);
|
||||||
|
7
var.c
7
var.c
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.15 2006/01/29 20:16:51 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.16 2006/01/30 12:37:24 tg Exp $");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Variables
|
* Variables
|
||||||
@ -583,7 +583,7 @@ typeset(const char *var, Tflag set, Tflag clr, int field, int base)
|
|||||||
/* IMPORT is only used when the shell starts up and is
|
/* IMPORT is only used when the shell starts up and is
|
||||||
* setting up its environment. Allow only simple array
|
* setting up its environment. Allow only simple array
|
||||||
* references at this time since parameter/command substitution
|
* references at this time since parameter/command substitution
|
||||||
* is preformed on the [expression], which would be a major
|
* is preformed on the [expression] which would be a major
|
||||||
* security hole.
|
* security hole.
|
||||||
*/
|
*/
|
||||||
if (set & IMPORT) {
|
if (set & IMPORT) {
|
||||||
@ -616,8 +616,7 @@ typeset(const char *var, Tflag set, Tflag clr, int field, int base)
|
|||||||
vpbase = (vp->flag & ARRAY) ? global(arrayname(var)) : vp;
|
vpbase = (vp->flag & ARRAY) ? global(arrayname(var)) : vp;
|
||||||
|
|
||||||
/* only allow export flag to be set. at&t ksh allows any attribute to
|
/* only allow export flag to be set. at&t ksh allows any attribute to
|
||||||
* be changed, which means it can be truncated or modified
|
* be changed which means it can be truncated or modified (-L/-R/-Z/-i)
|
||||||
* (-L/-R/-Z/-i).
|
|
||||||
*/
|
*/
|
||||||
if ((vpbase->flag&RDONLY) &&
|
if ((vpbase->flag&RDONLY) &&
|
||||||
(val || clr || (set & ~EXPORT)))
|
(val || clr || (set & ~EXPORT)))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user