sh: Add do-nothing -h option.

POSIX requires a -h option to sh and set, to locate and remember utilities
invoked by functions as they are defined. Given that this
locate-and-remember process is optional elsewhere, it seems safe enough to
make this option do nothing.

POSIX does not specify a long name for this option. Follow ksh in calling it
"trackall".
This commit is contained in:
Jilles Tjoelker 2011-06-18 23:43:28 +00:00
parent 8f0e65c915
commit 54b16435b7
2 changed files with 8 additions and 2 deletions

View File

@ -62,8 +62,9 @@ struct shparam {
#define privileged optlist[15].val #define privileged optlist[15].val
#define Tflag optlist[16].val #define Tflag optlist[16].val
#define Pflag optlist[17].val #define Pflag optlist[17].val
#define hflag optlist[18].val
#define NOPTS 18 #define NOPTS 19
struct optent { struct optent {
const char *name; const char *name;
@ -91,6 +92,7 @@ struct optent optlist[NOPTS] = {
{ "privileged", 'p', 0 }, { "privileged", 'p', 0 },
{ "trapsasync", 'T', 0 }, { "trapsasync", 'T', 0 },
{ "physical", 'P', 0 }, { "physical", 'P', 0 },
{ "trackall", 'h', 0 },
}; };
#else #else
extern struct optent optlist[NOPTS]; extern struct optent optlist[NOPTS];

View File

@ -32,7 +32,7 @@
.\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95 .\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd June 17, 2011 .Dd June 18, 2011
.Dt SH 1 .Dt SH 1
.Os .Os
.Sh NAME .Sh NAME
@ -241,6 +241,10 @@ tested, all commands of the function are considered to be tested as
well. well.
.It Fl f Li noglob .It Fl f Li noglob
Disable pathname expansion. Disable pathname expansion.
.It Fl h Li trackall
A do-nothing option for
.Tn POSIX
compliance.
.It Fl I Li ignoreeof .It Fl I Li ignoreeof
Ignore Ignore
.Dv EOF Ap s .Dv EOF Ap s