MKSH_DISABLE_EXPERIMENTAL is a NOP again; use ${ precmd;} in dot.mkshrc

This commit is contained in:
tg 2012-11-30 20:19:16 +00:00
parent f63bcae02c
commit 0f3071a8b2
9 changed files with 21 additions and 50 deletions

View File

@ -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

View File

@ -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)} || \

10
eval.c
View File

@ -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];

6
exec.c
View File

@ -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

8
lex.c
View File

@ -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);

8
main.c
View File

@ -34,7 +34,7 @@
#include <locale.h>
#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);

10
sh.h
View File

@ -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

7
syn.c
View File

@ -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 = ')';
}

8
tree.c
View File

@ -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;