diff --git a/Build.sh b/Build.sh index 78d9433..a234252 100644 --- a/Build.sh +++ b/Build.sh @@ -1,8 +1,9 @@ #!/bin/sh -# $MirOS: src/bin/mksh/Build.sh,v 1.212 2007/06/10 17:06:07 tg Exp $ +# $MirOS: src/bin/mksh/Build.sh,v 1.213 2007/06/15 21:55:18 tg Exp $ #- # Environment used: CC CFLAGS CPPFLAGS LDFLAGS LIBS NOWARN NROFF TARGET_OS -# CPPFLAGS recognised: MKSH_SMALL MKSH_ASSUME_UTF8 MKSH_NEED_MKNOD MKSH_NOPWNAM +# CPPFLAGS recognised: MKSH_SMALL MKSH_ASSUME_UTF8 MKSH_NEED_MKNOD MKSH_NOPWNAM +# MKSH_NOVI v() { diff --git a/check.t b/check.t index dbe1113..dba99da 100644 --- a/check.t +++ b/check.t @@ -1,4 +1,4 @@ -# $MirOS: src/bin/mksh/check.t,v 1.112 2007/06/09 22:02:04 tg Exp $ +# $MirOS: src/bin/mksh/check.t,v 1.113 2007/06/15 21:55:18 tg Exp $ # $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $ # $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $ # $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $ @@ -7,7 +7,7 @@ # http://www.research.att.com/~gsf/public/ifs.sh expected-stdout: - @(#)MIRBSD KSH R29 2007/06/09 + @(#)MIRBSD KSH R29 2007/06/15 description: Check version of shell. category: pdksh @@ -3901,12 +3901,12 @@ stdin: print got ${#anzahl[*]} files chmod +x foo/* export PATH=$(pwd)/foo:$PATH - $0 -c 'fnord' - $0 -c 'fnord; fnord; fnord; fnord' - $0 foo/bar - $0 #endif -__RCSID("$MirOS: src/bin/mksh/main.c,v 1.77 2007/06/15 20:52:19 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/main.c,v 1.78 2007/06/15 21:55:19 tg Exp $"); extern char **environ; @@ -80,7 +80,7 @@ main(int argc, const char *argv[]) size_t k; char *cp; #endif -#if HAVE_SETLOCALE_CTYPE +#if !defined(MKSH_SMALL) || HAVE_SETLOCALE_CTYPE const char *cc; #endif @@ -165,6 +165,22 @@ main(int argc, const char *argv[]) /* setstr can't fail here */ setstr(vp, def_path, KSH_RETURN_ERROR); +#ifndef MKSH_SMALL + cc = kshname; + if (*cc == '-') + ++cc; + i = 0; + while (cc[i] != '\0') + if (cc[i] == '/') { + cc += i + 1; + i = 0; + } else + ++i; + if ((cc[0] == 's' || cc[0] == 'S') && + (cc[1] == 'h' || cc[1] == 'H')) + Flag(FPOSIX) = 1; +#endif + /* Turn on nohup by default for now - will change to off * by default once people are aware of its existence * (at&t ksh does not have a nohup option - it always sends @@ -181,7 +197,9 @@ main(int argc, const char *argv[]) * by the environment or the user. Also, we want tab completion * on in vi by default. */ change_flag(FEMACS, OF_SPECIAL, 1); +#ifndef MKSH_NOVI Flag(FVITABCOMPLETE) = 1; +#endif /* import environment */ if (environ != NULL) diff --git a/misc.c b/misc.c index 5d8d007..2c9cdef 100644 --- a/misc.c +++ b/misc.c @@ -6,7 +6,7 @@ #include #endif -__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.57 2007/06/06 23:28:16 tg Exp $\t" +__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.58 2007/06/15 21:55:19 tg Exp $\t" MKSH_SH_H_ID); #undef USE_CHVT @@ -131,10 +131,12 @@ const struct option options[] = { { "trackall", 'h', OF_ANY }, { "utf8-hack", 'U', OF_ANY }, /* non-standard */ { "verbose", 'v', OF_ANY }, +#ifndef MKSH_NOVI { "vi", 0, OF_ANY }, { "viraw", 0, OF_ANY }, /* no effect */ { "vi-tabcomplete", 0, OF_ANY }, /* non-standard */ { "vi-esccomplete", 0, OF_ANY }, /* non-standard */ +#endif { "xtrace", 'x', OF_ANY }, /* Anonymous flags: used internally by shell only * (not visible to user) @@ -235,8 +237,15 @@ change_flag(enum sh_flag f, if (f == FMONITOR) { if (what != OF_CMDLINE && newval != oldval) j_change(); - } else if ((f == FVI || f == FEMACS || f == FGMACS) && newval) { - Flag(FVI) = Flag(FEMACS) = Flag(FGMACS) = 0; + } else if (( +#ifndef MKSH_NOVI + f == FVI || +#endif + f == FEMACS || f == FGMACS) && newval) { +#ifndef MKSH_NOVI + Flag(FVI) = +#endif + Flag(FEMACS) = Flag(FGMACS) = 0; Flag(f) = newval; } else if (f == FPRIVILEGED && oldval && !newval) { /* Turning off -p? */ diff --git a/sh.h b/sh.h index 1c9bb17..1c8c411 100644 --- a/sh.h +++ b/sh.h @@ -8,8 +8,8 @@ /* $OpenBSD: c_test.h,v 1.4 2004/12/20 11:34:26 otto Exp $ */ /* $OpenBSD: tty.h,v 1.5 2004/12/20 11:34:26 otto Exp $ */ -#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.146 2007/06/09 22:02:04 tg Exp $" -#define MKSH_VERSION "R29 2007/06/09" +#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.147 2007/06/15 21:55:20 tg Exp $" +#define MKSH_VERSION "R29 2007/06/15" #if HAVE_SYS_PARAM_H #include @@ -305,6 +305,10 @@ char *ucstrstr(char *, const char *); #define stristr(b,l) ((const char *)strcasestr((b), (l))) #endif +#if defined(MKSH_SMALL) && !defined(MKSH_NOVI) +#define MKSH_NOVI +#endif + /* * Area-based allocation built on malloc/free */ @@ -409,10 +413,12 @@ enum sh_flag { FTRACKALL, /* -h: create tracked aliases for all commands */ FUTFHACK, /* -U: utf-8 hack for command line editing */ FVERBOSE, /* -v: echo input */ +#ifndef MKSH_NOVI FVI, /* vi command editing */ FVIRAW, /* always read in raw mode (ignored) */ FVITABCOMPLETE, /* enable tab as file name completion char */ FVIESCCOMPLETE, /* enable ESC as file name completion in command mode */ +#endif FXTRACE, /* -x: execution trace */ FTALKING_I, /* (internal): initial shell was interactive */ FNFLAGS /* (place holder: how many flags are there) */