summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2014-12-21 22:18:30 +0000
committerjilles <jilles@FreeBSD.org>2014-12-21 22:18:30 +0000
commitffe29740d4971390457d911c48e446936d72eccb (patch)
tree58b671fb9f80928d9b82e69c650eea6e73141b99
parent3950b58647fa24897f7a2e6c02d55ec27e458c13 (diff)
downloadFreeBSD-src-ffe29740d4971390457d911c48e446936d72eccb.zip
FreeBSD-src-ffe29740d4971390457d911c48e446936d72eccb.tar.gz
sh: Remove EXP_REDIR.
EXP_REDIR was supposed to generate pathnames in redirection if exactly one file matches, as permitted but not required by POSIX in interactive mode. It is unlikely this will be implemented. No functional change is intended. MFC after: 1 week
-rw-r--r--bin/sh/eval.c4
-rw-r--r--bin/sh/expand.c18
-rw-r--r--bin/sh/expand.h1
3 files changed, 8 insertions, 15 deletions
diff --git a/bin/sh/eval.c b/bin/sh/eval.c
index d0460a0..486de9c 100644
--- a/bin/sh/eval.c
+++ b/bin/sh/eval.c
@@ -539,13 +539,13 @@ expredir(union node *n)
case NFROMTO:
case NAPPEND:
case NCLOBBER:
- expandarg(redir->nfile.fname, &fn, EXP_TILDE | EXP_REDIR);
+ expandarg(redir->nfile.fname, &fn, EXP_TILDE);
redir->nfile.expfname = fn.list->text;
break;
case NFROMFD:
case NTOFD:
if (redir->ndup.vname) {
- expandarg(redir->ndup.vname, &fn, EXP_TILDE | EXP_REDIR);
+ expandarg(redir->ndup.vname, &fn, EXP_TILDE);
fixredir(redir, fn.list->text, 1);
}
break;
diff --git a/bin/sh/expand.c b/bin/sh/expand.c
index fd8b996..b542303 100644
--- a/bin/sh/expand.c
+++ b/bin/sh/expand.c
@@ -171,17 +171,12 @@ expandarg(union node *arg, struct arglist *arglist, int flag)
STPUTC('\0', expdest);
p = grabstackstr(expdest);
exparg.lastp = &exparg.list;
- /*
- * TODO - EXP_REDIR
- */
if (flag & EXP_FULL) {
ifsbreakup(p, &exparg);
*exparg.lastp = NULL;
exparg.lastp = &exparg.list;
expandmeta(exparg.list, flag);
} else {
- if (flag & EXP_REDIR) /*XXX - for now, just remove escapes */
- rmescapes(p);
sp = (struct strlist *)stalloc(sizeof (struct strlist));
sp->text = p;
*exparg.lastp = sp;
@@ -209,7 +204,7 @@ expandarg(union node *arg, struct arglist *arglist, int flag)
* expansion, and tilde expansion if requested via EXP_TILDE/EXP_VARTILDE.
* Processing ends at a CTLENDVAR or CTLENDARI character as well as '\0'.
* This is used to expand word in ${var+word} etc.
- * If EXP_FULL, EXP_CASE or EXP_REDIR are set, keep and/or generate CTLESC
+ * If EXP_FULL or EXP_CASE are set, keep and/or generate CTLESC
* characters to allow for further processing.
* If EXP_FULL is set, also preserve CTLQUOTEMARK characters.
*/
@@ -217,7 +212,7 @@ static char *
argstr(char *p, int flag)
{
char c;
- int quotes = flag & (EXP_FULL | EXP_CASE | EXP_REDIR); /* do CTLESC */
+ int quotes = flag & (EXP_FULL | EXP_CASE); /* do CTLESC */
int firsteq = 1;
int split_lit;
int lit_quoted;
@@ -303,7 +298,7 @@ exptilde(char *p, int flag)
char c, *startp = p;
struct passwd *pw;
char *home;
- int quotes = flag & (EXP_FULL | EXP_CASE | EXP_REDIR);
+ int quotes = flag & (EXP_FULL | EXP_CASE);
while ((c = *p) != '\0') {
switch(c) {
@@ -437,7 +432,7 @@ expbackq(union node *cmd, int quoted, int flag)
char lastc;
int startloc = dest - stackblock();
char const *syntax = quoted? DQSYNTAX : BASESYNTAX;
- int quotes = flag & (EXP_FULL | EXP_CASE | EXP_REDIR);
+ int quotes = flag & (EXP_FULL | EXP_CASE);
size_t nnl;
INTOFF;
@@ -637,7 +632,7 @@ evalvar(char *p, int flag)
int varlen;
int varlenb;
int easy;
- int quotes = flag & (EXP_FULL | EXP_CASE | EXP_REDIR);
+ int quotes = flag & (EXP_FULL | EXP_CASE);
varflags = (unsigned char)*p++;
subtype = varflags & VSTYPE;
@@ -862,7 +857,7 @@ varisset(const char *name, int nulok)
static void
strtodest(const char *p, int flag, int subtype, int quoted)
{
- if (flag & (EXP_FULL | EXP_CASE | EXP_REDIR) && subtype != VSLENGTH)
+ if (flag & (EXP_FULL | EXP_CASE) && subtype != VSLENGTH)
STPUTS_QUOTES(p, quoted ? DQSYNTAX : BASESYNTAX, expdest);
else
STPUTS(p, expdest);
@@ -1104,7 +1099,6 @@ expandmeta(struct strlist *str, int flag __unused)
struct strlist **savelastp;
struct strlist *sp;
char c;
- /* TODO - EXP_REDIR */
while (str) {
savelastp = exparg.lastp;
diff --git a/bin/sh/expand.h b/bin/sh/expand.h
index 7495a63..93c80f3 100644
--- a/bin/sh/expand.h
+++ b/bin/sh/expand.h
@@ -50,7 +50,6 @@ struct arglist {
#define EXP_FULL 0x1 /* perform word splitting & file globbing */
#define EXP_TILDE 0x2 /* do normal tilde expansion */
#define EXP_VARTILDE 0x4 /* expand tildes in an assignment */
-#define EXP_REDIR 0x8 /* file glob for a redirection (1 match only) */
#define EXP_CASE 0x10 /* keeps quotes around for CASE pattern */
#define EXP_SPLIT_LIT 0x20 /* IFS split literal text ${v+-a b c} */
#define EXP_LIT_QUOTED 0x40 /* for EXP_SPLIT_LIT, start off quoted */
OpenPOWER on IntegriCloud