sh: Add set -o nolog.
POSIX requires this to prevent entering function definitions in history but this implementation does nothing except retain the option's value. In ksh88, function definitions were usually entered in the history file, even when they came from ~/.profile and the $ENV file, to allow displaying their definitions. This is also the first option that does not have a letter.
This commit is contained in:
parent
c6cc7ec120
commit
62c3711632
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=287296
@ -886,7 +886,7 @@ varvalue(const char *name, int quoted, int subtype, int flag)
|
|||||||
num = backgndpidval();
|
num = backgndpidval();
|
||||||
break;
|
break;
|
||||||
case '-':
|
case '-':
|
||||||
for (i = 0 ; i < NOPTS ; i++) {
|
for (i = 0 ; i < NSHORTOPTS ; i++) {
|
||||||
if (optlist[i].val)
|
if (optlist[i].val)
|
||||||
STPUTC(optlist[i].letter, expdest);
|
STPUTC(optlist[i].letter, expdest);
|
||||||
}
|
}
|
||||||
|
@ -302,7 +302,7 @@ setoption(int flag, int val)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < NOPTS; i++)
|
for (i = 0; i < NSHORTOPTS; i++)
|
||||||
if (optlist[i].letter == flag) {
|
if (optlist[i].letter == flag) {
|
||||||
setoptionbyindex(i, val);
|
setoptionbyindex(i, val);
|
||||||
return;
|
return;
|
||||||
|
@ -64,8 +64,10 @@ struct shparam {
|
|||||||
#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 hflag optlist[18].val
|
||||||
|
#define nologflag optlist[19].val
|
||||||
|
|
||||||
#define NOPTS 19
|
#define NSHORTOPTS 19
|
||||||
|
#define NOPTS 20
|
||||||
|
|
||||||
struct optent {
|
struct optent {
|
||||||
const char *name;
|
const char *name;
|
||||||
@ -95,6 +97,7 @@ struct optent optlist[NOPTS] = {
|
|||||||
{ "trapsasync", 'T', 0 },
|
{ "trapsasync", 'T', 0 },
|
||||||
{ "physical", 'P', 0 },
|
{ "physical", 'P', 0 },
|
||||||
{ "trackall", 'h', 0 },
|
{ "trackall", 'h', 0 },
|
||||||
|
{ "nolog", '\0', 0 },
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
11
bin/sh/sh.1
11
bin/sh/sh.1
@ -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 July 11, 2015
|
.Dd August 29, 2015
|
||||||
.Dt SH 1
|
.Dt SH 1
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -343,6 +343,11 @@ Write each command
|
|||||||
variable subjected to parameter expansion and arithmetic expansion)
|
variable subjected to parameter expansion and arithmetic expansion)
|
||||||
to standard error before it is executed.
|
to standard error before it is executed.
|
||||||
Useful for debugging.
|
Useful for debugging.
|
||||||
|
.It nolog
|
||||||
|
Another do-nothing option for
|
||||||
|
.Tn POSIX
|
||||||
|
compliance.
|
||||||
|
It only has a long name.
|
||||||
.El
|
.El
|
||||||
.Pp
|
.Pp
|
||||||
The
|
The
|
||||||
@ -1173,7 +1178,9 @@ The only special parameter that can be made local is
|
|||||||
.Ql - .
|
.Ql - .
|
||||||
Making
|
Making
|
||||||
.Ql -
|
.Ql -
|
||||||
local causes any shell options that are
|
local causes any shell options
|
||||||
|
(including those that only have long names)
|
||||||
|
that are
|
||||||
changed via the
|
changed via the
|
||||||
.Ic set
|
.Ic set
|
||||||
command inside the function to be
|
command inside the function to be
|
||||||
|
Loading…
Reference in New Issue
Block a user