Add a -P/-o physical option which behaves similarly to bash/ksh's options
by the same name. This option makes the cd and pwd builtins behave physically (as opposed to logically) by default. Submitted by: fanf
This commit is contained in:
parent
ca8e9f2edf
commit
43d6a14678
@ -88,7 +88,7 @@ cdcmd(int argc, char **argv)
|
||||
int ch, phys, print = 0;
|
||||
|
||||
optreset = 1; optind = 1; opterr = 0; /* initialize getopt */
|
||||
phys = 0;
|
||||
phys = Pflag;
|
||||
while ((ch = getopt(argc, argv, "LP")) != -1) {
|
||||
switch (ch) {
|
||||
case 'L':
|
||||
@ -324,7 +324,7 @@ pwdcmd(int argc, char **argv)
|
||||
int ch, phys;
|
||||
|
||||
optreset = 1; optind = 1; opterr = 0; /* initialize getopt */
|
||||
phys = 0;
|
||||
phys = Pflag;
|
||||
while ((ch = getopt(argc, argv, "LP")) != -1) {
|
||||
switch (ch) {
|
||||
case 'L':
|
||||
|
@ -65,8 +65,9 @@ struct shparam {
|
||||
#define uflag optlist[14].val
|
||||
#define privileged optlist[15].val
|
||||
#define Tflag optlist[16].val
|
||||
#define Pflag optlist[17].val
|
||||
|
||||
#define NOPTS 17
|
||||
#define NOPTS 18
|
||||
|
||||
struct optent {
|
||||
const char *name;
|
||||
@ -93,6 +94,7 @@ struct optent optlist[NOPTS] = {
|
||||
{ "nounset", 'u', 0 },
|
||||
{ "privileged", 'p', 0 },
|
||||
{ "trapsasync", 'T', 0 },
|
||||
{ "physical", 'P', 0 },
|
||||
};
|
||||
#else
|
||||
extern struct optent optlist[NOPTS];
|
||||
|
13
bin/sh/sh.1
13
bin/sh/sh.1
@ -43,7 +43,7 @@
|
||||
.Nd command interpreter (shell)
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl /+abCEefIimnpsTuVvx
|
||||
.Op Fl /+abCEefIimnPpsTuVvx
|
||||
.Op Fl /+o Ar longname
|
||||
.Op Fl c Ar string
|
||||
.Op Ar arg ...
|
||||
@ -225,6 +225,17 @@ Turn on job control (set automatically when interactive).
|
||||
If not interactive, read commands but do not
|
||||
execute them. This is useful for checking the
|
||||
syntax of shell scripts.
|
||||
.It Fl P Li physical
|
||||
Change the default for the
|
||||
.Ic cd
|
||||
and
|
||||
.Ic pwd
|
||||
commands from
|
||||
.Fl L
|
||||
(logical directory layout)
|
||||
to
|
||||
.Fl P
|
||||
(physical directory layout).
|
||||
.It Fl p Li privileged
|
||||
Turn on privileged mode. This mode is enabled on startup
|
||||
if either the effective user or group id is not equal to the
|
||||
|
Loading…
Reference in New Issue
Block a user