From owner-svn-src-all@FreeBSD.ORG Mon Dec 29 15:33:22 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 19D99259; Mon, 29 Dec 2014 15:33:22 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EF089152B; Mon, 29 Dec 2014 15:33:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBTFXL8d097717; Mon, 29 Dec 2014 15:33:21 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBTFXLYq097714; Mon, 29 Dec 2014 15:33:21 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201412291533.sBTFXLYq097714@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Mon, 29 Dec 2014 15:33:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r276365 - stable/10/bin/sh X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Dec 2014 15:33:22 -0000 Author: jilles Date: Mon Dec 29 15:33:20 2014 New Revision: 276365 URL: https://svnweb.freebsd.org/changeset/base/276365 Log: MFC r276037: 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. Modified: stable/10/bin/sh/eval.c stable/10/bin/sh/expand.c stable/10/bin/sh/expand.h Directory Properties: stable/10/ (props changed) Modified: stable/10/bin/sh/eval.c ============================================================================== --- stable/10/bin/sh/eval.c Mon Dec 29 15:15:27 2014 (r276364) +++ stable/10/bin/sh/eval.c Mon Dec 29 15:33:20 2014 (r276365) @@ -538,13 +538,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; Modified: stable/10/bin/sh/expand.c ============================================================================== --- stable/10/bin/sh/expand.c Mon Dec 29 15:15:27 2014 (r276364) +++ stable/10/bin/sh/expand.c Mon Dec 29 15:33:20 2014 (r276365) @@ -171,17 +171,12 @@ expandarg(union node *arg, struct arglis 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 arglis * 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) { @@ -442,7 +437,7 @@ expbackq(union node *cmd, int quoted, in 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; @@ -642,7 +637,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; @@ -867,7 +862,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); @@ -1108,7 +1103,6 @@ expandmeta(struct strlist *str, int flag struct strlist **savelastp; struct strlist *sp; char c; - /* TODO - EXP_REDIR */ while (str) { if (fflag) Modified: stable/10/bin/sh/expand.h ============================================================================== --- stable/10/bin/sh/expand.h Mon Dec 29 15:15:27 2014 (r276364) +++ stable/10/bin/sh/expand.h Mon Dec 29 15:33:20 2014 (r276365) @@ -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 */