document the declaration utility stuff and the new \builtin
also, make global a declaration utility
This commit is contained in:
5
funcs.c
5
funcs.c
@@ -38,7 +38,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.326 2017/03/12 02:04:13 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.327 2017/03/12 02:31:01 tg Exp $");
|
||||||
|
|
||||||
#if HAVE_KILLPG
|
#if HAVE_KILLPG
|
||||||
/*
|
/*
|
||||||
@@ -117,10 +117,11 @@ const struct builtin mkshbuiltins[] = {
|
|||||||
{Tfalse, c_false},
|
{Tfalse, c_false},
|
||||||
{"fc", c_fc},
|
{"fc", c_fc},
|
||||||
{Tgetopts, c_getopts},
|
{Tgetopts, c_getopts},
|
||||||
{"=global", c_typeset},
|
{"^=global", c_typeset},
|
||||||
{Tjobs, c_jobs},
|
{Tjobs, c_jobs},
|
||||||
{"kill", c_kill},
|
{"kill", c_kill},
|
||||||
{"let", c_let},
|
{"let", c_let},
|
||||||
|
/* deprecated, to be replaced by \\builtin let */
|
||||||
{"let]", c_let},
|
{"let]", c_let},
|
||||||
{"print", c_print},
|
{"print", c_print},
|
||||||
{"pwd", c_pwd},
|
{"pwd", c_pwd},
|
||||||
|
49
mksh.1
49
mksh.1
@@ -1,4 +1,4 @@
|
|||||||
.\" $MirOS: src/bin/mksh/mksh.1,v 1.425 2017/03/11 23:10:41 tg Exp $
|
.\" $MirOS: src/bin/mksh/mksh.1,v 1.426 2017/03/12 02:31:02 tg Exp $
|
||||||
.\" $OpenBSD: ksh.1,v 1.160 2015/07/04 13:27:04 feinerer Exp $
|
.\" $OpenBSD: ksh.1,v 1.160 2015/07/04 13:27:04 feinerer Exp $
|
||||||
.\"-
|
.\"-
|
||||||
.\" Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
|
.\" Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
|
||||||
@@ -76,7 +76,7 @@
|
|||||||
.\" with -mandoc, it might implement .Mx itself, but we want to
|
.\" with -mandoc, it might implement .Mx itself, but we want to
|
||||||
.\" use our own definition. And .Dd must come *first*, always.
|
.\" use our own definition. And .Dd must come *first*, always.
|
||||||
.\"
|
.\"
|
||||||
.Dd $Mdocdate: March 11 2017 $
|
.Dd $Mdocdate: March 12 2017 $
|
||||||
.\"
|
.\"
|
||||||
.\" Check which macro package we use, and do other -mdoc setup.
|
.\" Check which macro package we use, and do other -mdoc setup.
|
||||||
.\"
|
.\"
|
||||||
@@ -2185,9 +2185,18 @@ files are created in
|
|||||||
The effective user id of the shell.
|
The effective user id of the shell.
|
||||||
.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,
|
||||||
on words starting with an unquoted
|
is applied to words starting with an unquoted
|
||||||
.Ql \*(TI .
|
.Ql \*(TI .
|
||||||
|
In parameter assignments (such as those preceding a simple-command or those
|
||||||
|
occurring in the arguments of a declaration utility), tilde expansion is done
|
||||||
|
after any assignment (i.e. after the equals sign) or after an unquoted colon
|
||||||
|
.Pq Ql \&: ;
|
||||||
|
login names are also delimited by colons.
|
||||||
|
The Korn shell, except in POSIX mode, always expands tildes after unquoted
|
||||||
|
equals signs, not just in assignment context (see below), and enables tab
|
||||||
|
completion for tildes after all unquoted colons during command line editing.
|
||||||
|
.Pp
|
||||||
The characters following the tilde, up to the first
|
The characters following the tilde, up to the first
|
||||||
.Ql / ,
|
.Ql / ,
|
||||||
if any, are assumed to be a login name.
|
if any, are assumed to be a login name.
|
||||||
@@ -2208,21 +2217,6 @@ If the login name is not found in the password file or
|
|||||||
if any quoting or parameter substitution occurs in the login name, no
|
if any quoting or parameter substitution occurs in the login name, no
|
||||||
substitution is performed.
|
substitution is performed.
|
||||||
.Pp
|
.Pp
|
||||||
In parameter assignments
|
|
||||||
(such as those preceding a simple-command or those occurring
|
|
||||||
in the arguments of
|
|
||||||
.Ic alias ,
|
|
||||||
.Ic export ,
|
|
||||||
.Ic global ,
|
|
||||||
.Ic readonly
|
|
||||||
and
|
|
||||||
.Ic typeset ) ,
|
|
||||||
tilde expansion is done after any assignment
|
|
||||||
(i.e. after the equals sign)
|
|
||||||
or after an unquoted colon
|
|
||||||
.Pq Ql \&: ;
|
|
||||||
login names are also delimited by colons.
|
|
||||||
.Pp
|
|
||||||
The home directory of previously expanded login names are cached and re-used.
|
The home directory of previously expanded login names are cached and re-used.
|
||||||
The
|
The
|
||||||
.Ic alias Fl d
|
.Ic alias Fl d
|
||||||
@@ -3217,6 +3211,18 @@ Execute the built-in command
|
|||||||
.Ar command .
|
.Ar command .
|
||||||
.Pp
|
.Pp
|
||||||
.It Xo
|
.It Xo
|
||||||
|
.Ic \ebuiltin
|
||||||
|
.Ar command Op Ar arg ...
|
||||||
|
.Xc
|
||||||
|
Same as
|
||||||
|
.Ic builtin .
|
||||||
|
Additionally acts as declaration utility forwarder, i.e. this is a
|
||||||
|
declaration utility (see
|
||||||
|
.Sx Tilde expansion )
|
||||||
|
.No iff Ar command
|
||||||
|
is a declaration utility.
|
||||||
|
.Pp
|
||||||
|
.It Xo
|
||||||
.Ic cat
|
.Ic cat
|
||||||
.Op Fl u
|
.Op Fl u
|
||||||
.Op Ar
|
.Op Ar
|
||||||
@@ -3346,6 +3352,7 @@ cannot be a shell function;
|
|||||||
and secondly, special built-in commands lose their specialness
|
and secondly, special built-in commands lose their specialness
|
||||||
(i.e. redirection and utility errors do not cause the shell to
|
(i.e. redirection and utility errors do not cause the shell to
|
||||||
exit, and command assignments are not permanent).
|
exit, and command assignments are not permanent).
|
||||||
|
The declaration utility property is not reset.
|
||||||
.Pp
|
.Pp
|
||||||
If the
|
If the
|
||||||
.Fl p
|
.Fl p
|
||||||
@@ -3480,6 +3487,7 @@ parameter.
|
|||||||
Sets the export attribute of the named parameters.
|
Sets the export attribute of the named parameters.
|
||||||
Exported parameters are passed in the environment to executed commands.
|
Exported parameters are passed in the environment to executed commands.
|
||||||
If values are specified, the named parameters are also assigned.
|
If values are specified, the named parameters are also assigned.
|
||||||
|
This is a declaration utility.
|
||||||
.Pp
|
.Pp
|
||||||
If no parameters are specified, all parameters with the export attribute
|
If no parameters are specified, all parameters with the export attribute
|
||||||
set are printed one per line; either their names, or, if a
|
set are printed one per line; either their names, or, if a
|
||||||
@@ -3999,6 +4007,7 @@ exec 3\*(Gt&p; exec 3\*(Gt&\-
|
|||||||
.Ar ... Oc
|
.Ar ... Oc
|
||||||
.Xc
|
.Xc
|
||||||
Sets the read-only attribute of the named parameters.
|
Sets the read-only attribute of the named parameters.
|
||||||
|
This is a declaration utility.
|
||||||
If values are given,
|
If values are given,
|
||||||
parameters are set to them before setting the attribute.
|
parameters are set to them before setting the attribute.
|
||||||
Once a parameter is
|
Once a parameter is
|
||||||
@@ -4253,7 +4262,6 @@ Background jobs are run with lower priority.
|
|||||||
.It Fl o Ic braceexpand
|
.It Fl o Ic braceexpand
|
||||||
Enable brace expansion (a.k.a. alternation).
|
Enable brace expansion (a.k.a. alternation).
|
||||||
This is enabled by default.
|
This is enabled by default.
|
||||||
If disabled, tilde expansion after an equals sign is disabled as a side effect.
|
|
||||||
.It Fl o Ic emacs
|
.It Fl o Ic emacs
|
||||||
Enable BRL emacs-like command-line editing (interactive shells only); see
|
Enable BRL emacs-like command-line editing (interactive shells only); see
|
||||||
.Sx Emacs editing mode .
|
.Sx Emacs editing mode .
|
||||||
@@ -4809,6 +4817,7 @@ A command that exits with a zero value.
|
|||||||
.Ar ... Oc
|
.Ar ... Oc
|
||||||
.Xc
|
.Xc
|
||||||
Display or set parameter attributes.
|
Display or set parameter attributes.
|
||||||
|
This is a declaration utility.
|
||||||
With no
|
With no
|
||||||
.Ar name
|
.Ar name
|
||||||
arguments, parameter attributes are displayed; if no options are used, the
|
arguments, parameter attributes are displayed; if no options are used, the
|
||||||
|
Reference in New Issue
Block a user