From 0f3071a8b25c6ec0fd15917ae5b579085af8b516 Mon Sep 17 00:00:00 2001 From: tg Date: Fri, 30 Nov 2012 20:19:16 +0000 Subject: [PATCH] =?UTF-8?q?MKSH=5FDISABLE=5FEXPERIMENTAL=20is=20a=20NOP=20?= =?UTF-8?q?again;=20use=20${=C2=A0precmd;}=20in=20dot.mkshrc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Build.sh | 10 +++++----- dot.mkshrc | 4 ++-- eval.c | 10 +--------- exec.c | 6 +++--- lex.c | 8 +------- main.c | 8 +++----- sh.h | 10 +++------- syn.c | 7 ++----- tree.c | 8 +------- 9 files changed, 21 insertions(+), 50 deletions(-) diff --git a/Build.sh b/Build.sh index b805348..11e7c75 100644 --- a/Build.sh +++ b/Build.sh @@ -1,5 +1,5 @@ #!/bin/sh -srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.590 2012/11/20 18:50:41 tg Exp $' +srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.591 2012/11/30 20:19:09 tg Exp $' #- # Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 2011, 2012 @@ -1370,9 +1370,9 @@ ac_ifcpp 'ifdef MKSH_CONSERVATIVE_FDS' isset_MKSH_CONSERVATIVE_FDS '' \ #ac_ifcpp 'ifdef MKSH_DISABLE_DEPRECATED' isset_MKSH_DISABLE_DEPRECATED '' \ # "if deprecated features are to be omitted" && \ # check_categories="$check_categories nodeprecated" -ac_ifcpp 'ifdef MKSH_DISABLE_EXPERIMENTAL' isset_MKSH_DISABLE_EXPERIMENTAL '' \ - "if experimental features are to be omitted" && \ - check_categories="$check_categories noexperimental" +#ac_ifcpp 'ifdef MKSH_DISABLE_EXPERIMENTAL' isset_MKSH_DISABLE_EXPERIMENTAL '' \ +# "if experimental features are to be omitted" && \ +# check_categories="$check_categories noexperimental" # # Environment: headers @@ -1495,7 +1495,7 @@ else #define EXTERN #define MKSH_INCLUDES_ONLY #include "sh.h" - __RCSID("$MirOS: src/bin/mksh/Build.sh,v 1.590 2012/11/20 18:50:41 tg Exp $"); + __RCSID("$MirOS: src/bin/mksh/Build.sh,v 1.591 2012/11/30 20:19:09 tg Exp $"); int main(void) { printf("Hello, World!\n"); return (0); } EOF case $cm in diff --git a/dot.mkshrc b/dot.mkshrc index ec3576a..f75e576 100644 --- a/dot.mkshrc +++ b/dot.mkshrc @@ -1,5 +1,5 @@ # $Id$ -# $MirOS: src/bin/mksh/dot.mkshrc,v 1.72 2012/10/30 21:04:56 tg Exp $ +# $MirOS: src/bin/mksh/dot.mkshrc,v 1.73 2012/11/30 20:19:10 tg Exp $ #- # Copyright (c) 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, # 2011, 2012 @@ -30,7 +30,7 @@ function precmd { (( e )) && print -n "$e|" } -PS1=$'\001\r''$(precmd)${USER:=$(ulimit -c 0; id -un 2>/dev/null || echo \? +PS1=$'\001\r''${ precmd;}${USER:=$(ulimit -c 0; id -un 2>/dev/null || echo \? )}@${HOSTNAME%%.*}:$(local d=${PWD:-?} p=~; [[ $p = ?(*/) ]] || \ d=${d/#$p/~}; local m=${%d} n p=...; (( m > 0 )) || m=${#d} (( m > (n = (COLUMNS/3 < 7 ? 7 : COLUMNS/3)) )) && d=${d:(-n)} || \ diff --git a/eval.c b/eval.c index f0a5c00..c045147 100644 --- a/eval.c +++ b/eval.c @@ -23,7 +23,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.129 2012/10/22 20:19:12 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.130 2012/11/30 20:19:11 tg Exp $"); /* * string expansion @@ -277,30 +277,24 @@ expand(const char *cp, /* input word */ quote = st->quotew; continue; case COMSUB: -#ifndef MKSH_DISABLE_EXPERIMENTAL case FUNSUB: -#endif tilde_ok = 0; if (f & DONTRUNCOMMAND) { word = IFS_WORD; *dp++ = '$'; -#ifndef MKSH_DISABLE_EXPERIMENTAL if (c == FUNSUB) { *dp++ = '{'; *dp++ = ' '; } else -#endif *dp++ = '('; while (*sp != '\0') { Xcheck(ds, dp); *dp++ = *sp++; } -#ifndef MKSH_DISABLE_EXPERIMENTAL if (c == FUNSUB) { *dp++ = ';'; *dp++ = '}'; } else -#endif *dp++ = ')'; } else { type = comsub(&x, sp, c); @@ -1322,7 +1316,6 @@ comsub(Expand *xp, const char *cp, int fn MKSH_A_UNUSED) SHF_MAPHI|SHF_CLEXEC); if (shf == NULL) errorf("%s: %s %s", name, "can't open", "$() input"); -#ifndef MKSH_DISABLE_EXPERIMENTAL } else if (fn == FUNSUB) { int ofd1; struct temp *tf = NULL; @@ -1345,7 +1338,6 @@ comsub(Expand *xp, const char *cp, int fn MKSH_A_UNUSED) shf = shf_open(tf->tffn, O_RDONLY, 0, SHF_MAPHI | SHF_CLEXEC); unlink(tf->tffn); afree(tf, ATEMP); -#endif } else { int ofd1, pv[2]; diff --git a/exec.c b/exec.c index 0271320..d7376a4 100644 --- a/exec.c +++ b/exec.c @@ -23,7 +23,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.106 2012/11/30 19:02:06 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.107 2012/11/30 20:19:11 tg Exp $"); #ifndef MKSH_DEFAULT_EXECSHELL #define MKSH_DEFAULT_EXECSHELL "/bin/sh" @@ -605,7 +605,7 @@ comexec(struct op *t, struct tbl * volatile tp, const char **ap, /* go on, use the builtin */ break; #endif -#if !defined(MKSH_SMALL) && !defined(MKSH_DISABLE_EXPERIMENTAL) +#if !defined(MKSH_SMALL) } else if (tp->val.f == c_trap) { t->u.evalflags &= ~DOTCOMEXEC; break; @@ -614,7 +614,7 @@ comexec(struct op *t, struct tbl * volatile tp, const char **ap, break; tp = findcom(ap[0], fcflags & (FC_BI|FC_FUNC)); } -#if !defined(MKSH_SMALL) && !defined(MKSH_DISABLE_EXPERIMENTAL) +#if !defined(MKSH_SMALL) if (t->u.evalflags & DOTCOMEXEC) flags |= XEXEC; #endif diff --git a/lex.c b/lex.c index 5f00ab9..cc138b7 100644 --- a/lex.c +++ b/lex.c @@ -23,7 +23,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.171 2012/11/30 19:02:08 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.172 2012/11/30 20:19:12 tg Exp $"); /* * states while lexing word @@ -262,13 +262,11 @@ yylex(int cf) while (!((c = getsc()) == 0 || ((state == SBASE || state == SHEREDELIM || state == SHERESTRING) && ctype(c, C_LEX1)))) { -#ifndef MKSH_DISABLE_EXPERIMENTAL if (state == SBASE && subshell_nesting_type == /*{*/ '}' && c == /*{*/ '}') /* possibly end ${ :;} */ break; -#endif accept_nonword: Xcheck(ws, wp); switch (state) { @@ -403,9 +401,7 @@ yylex(int cf) ungetsc(c); subst_command: c = COMSUB; -#ifndef MKSH_DISABLE_EXPERIMENTAL subst_command2: -#endif sp = yyrecursive(c); cz = strlen(sp) + 1; XcheckN(ws, wp, cz); @@ -414,7 +410,6 @@ yylex(int cf) wp += cz; } } else if (c == '{') /*}*/ { -#ifndef MKSH_DISABLE_EXPERIMENTAL c = getsc(); if (ctype(c, C_IFSWS)) { /* @@ -425,7 +420,6 @@ yylex(int cf) goto subst_command2; } ungetsc(c); -#endif *wp++ = OSUBST; *wp++ = '{'; /*}*/ wp = get_brace_var(&ws, wp); diff --git a/main.c b/main.c index 7b1a67a..463d7b9 100644 --- a/main.c +++ b/main.c @@ -34,7 +34,7 @@ #include #endif -__RCSID("$MirOS: src/bin/mksh/main.c,v 1.245 2012/11/30 19:58:47 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/main.c,v 1.246 2012/11/30 20:19:13 tg Exp $"); extern char **environ; @@ -460,7 +460,7 @@ main_init(int argc, const char *argv[], Source **sp, struct block **lp) s = pushs(SSTRINGCMDLINE, ATEMP); if (!(s->start = s->str = argv[argi++])) errorf("%s %s", "-c", "requires an argument"); -#if !defined(MKSH_SMALL) && !defined(MKSH_DISABLE_EXPERIMENTAL) +#if !defined(MKSH_SMALL) while (*s->str) { if (*s->str != ' ' && ctype(*s->str, C_QUOTE)) break; @@ -849,7 +849,7 @@ shell(Source * volatile s, volatile bool toplevel) break; } } -#if !defined(MKSH_SMALL) && !defined(MKSH_DISABLE_EXPERIMENTAL) +#if !defined(MKSH_SMALL) else if ((s->flags & SF_MAYEXEC) && t->type == TCOM) t->u.evalflags |= DOTCOMEXEC; #endif @@ -1593,7 +1593,6 @@ maketemp(Area *ap, Temp_type type, struct temp **tlist) /* do another cycle */ } -#ifndef MKSH_DISABLE_EXPERIMENTAL if (type == TT_FUNSUB) { int nfd; @@ -1603,7 +1602,6 @@ maketemp(Area *ap, Temp_type type, struct temp **tlist) i = nfd; } } -#endif /* shf_fdopen cannot fail, so no fd leak */ tp->shf = shf_fdopen(i, SHF_WR, NULL); diff --git a/sh.h b/sh.h index 825c0cf..2d7481f 100644 --- a/sh.h +++ b/sh.h @@ -157,7 +157,7 @@ #endif #ifdef EXTERN -__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.608 2012/11/30 19:58:48 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.609 2012/11/30 20:19:14 tg Exp $"); #endif #define MKSH_VERSION "R41 2012/11/30" @@ -785,10 +785,8 @@ typedef uint8_t Temp_type; #define TT_HEREDOC_EXP 0 /* temporary file used for history editing (fc -e) */ #define TT_HIST_EDIT 1 -#ifndef MKSH_DISABLE_EXPERIMENTAL /* temporary file used during in-situ command substitution */ #define TT_FUNSUB 2 -#endif /* temp/heredoc files. The file is removed when the struct is freed. */ struct temp { @@ -1300,9 +1298,7 @@ struct op { #define SPAT 10 /* separate pattern: | */ #define CPAT 11 /* close pattern: ) */ #define ADELIM 12 /* arbitrary delimiter: ${foo:2:3} ${foo/bar/baz} */ -#ifndef MKSH_DISABLE_EXPERIMENTAL #define FUNSUB 14 /* ${ foo;} substitution (NUL terminated) */ -#endif /* * IO redirection @@ -1361,7 +1357,7 @@ struct ioword { #define DOTEMP BIT(8) /* dito: in word part of ${..[%#=?]..} */ #define DOVACHECK BIT(9) /* var assign check (for typeset, set, etc) */ #define DOMARKDIRS BIT(10) /* force markdirs behaviour */ -#if !defined(MKSH_SMALL) && !defined(MKSH_DISABLE_EXPERIMENTAL) +#if !defined(MKSH_SMALL) #define DOTCOMEXEC BIT(11) /* not an eval flag, used by sh -c hack */ #endif @@ -1507,7 +1503,7 @@ struct source { #define SF_ALIASEND BIT(2) /* faking space at end of alias */ #define SF_TTY BIT(3) /* type == SSTDIN & it is a tty */ #define SF_HASALIAS BIT(4) /* u.tblp valid (SALIAS, SEOF) */ -#if !defined(MKSH_SMALL) && !defined(MKSH_DISABLE_EXPERIMENTAL) +#if !defined(MKSH_SMALL) #define SF_MAYEXEC BIT(5) /* special sh -c optimisation hack */ #endif diff --git a/syn.c b/syn.c index be816c6..42da21f 100644 --- a/syn.c +++ b/syn.c @@ -23,7 +23,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.84 2012/10/30 20:49:44 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.85 2012/11/30 20:19:15 tg Exp $"); extern int subshell_nesting_type; extern void yyskiputf8bom(void); @@ -1134,13 +1134,10 @@ yyrecursive(int subtype MKSH_A_UNUSED) struct yyrecursive_state *ys; int stok, etok; -#ifndef MKSH_DISABLE_EXPERIMENTAL if (subtype == FUNSUB) { stok = '{'; etok = '}'; - } else -#endif - { + } else { stok = '('; etok = ')'; } diff --git a/tree.c b/tree.c index 1669473..1513a14 100644 --- a/tree.c +++ b/tree.c @@ -23,7 +23,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/tree.c,v 1.65 2012/10/22 20:19:18 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/tree.c,v 1.66 2012/11/30 20:19:16 tg Exp $"); #define INDENT 8 @@ -342,12 +342,10 @@ wdvarput(struct shf *shf, const char *wp, int quotelevel, int opmode) shf_putc(c, shf); shf_puts(cs, shf); break; -#ifndef MKSH_DISABLE_EXPERIMENTAL case FUNSUB: shf_puts("${ ", shf); cs = ";}"; goto pSUB; -#endif case EXPRSUB: shf_puts("$((", shf); cs = "))"; @@ -587,9 +585,7 @@ wdscan(const char *wp, int c) wp++; break; case COMSUB: -#ifndef MKSH_DISABLE_EXPERIMENTAL case FUNSUB: -#endif case EXPRSUB: while (*wp++ != 0) ; @@ -829,11 +825,9 @@ dumpwdvar_i(struct shf *shf, const char *wp, int quotelevel) closeandout: shf_putc('>', shf); break; -#ifndef MKSH_DISABLE_EXPERIMENTAL case FUNSUB: shf_puts("FUNSUB<", shf); goto dumpsub; -#endif case EXPRSUB: shf_puts("EXPRSUB<", shf); goto dumpsub;