From 1dfb13b6037c13961a8b44dfa8ab7e821d88440f Mon Sep 17 00:00:00 2001 From: tg Date: Thu, 24 Sep 2009 17:15:33 +0000 Subject: [PATCH] change undef/def MKSH_NOVI into 0/1 MKSH_S_NOVI flag (with more to come: MKSH_S_EDIT for small (Emacs) editing mode, MKSH_S_FEAT for all the dis- abled language features), which can be set to 0 despite MKSH_SMALL being defined to re-enable the Vi command line editing mode (which I wouldn't, but fits into the general mastermind scheme) --- Build.sh | 8 ++++---- check.t | 4 ++-- edit.c | 12 ++++++------ lex.c | 4 ++-- main.c | 4 ++-- misc.c | 6 +++--- sh.h | 16 ++++++++++------ sh_flags.h | 4 ++-- 8 files changed, 31 insertions(+), 27 deletions(-) diff --git a/Build.sh b/Build.sh index 0cb5bf0..69c0530 100644 --- a/Build.sh +++ b/Build.sh @@ -1,5 +1,5 @@ #!/bin/sh -srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.424 2009/09/23 18:22:37 tg Exp $' +srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.425 2009/09/24 17:15:28 tg Exp $' #- # Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009 # Thorsten Glaser @@ -22,10 +22,10 @@ srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.424 2009/09/23 18:22:37 tg Exp $' # Environment used: CC CFLAGS CPPFLAGS LDFLAGS LIBS NOWARN NROFF # TARGET_OS TARGET_OSREV # Feature selectors: USE_PRINTF_BUILTIN -# CPPFLAGS recognised: MKSH_SMALL MKSH_ASSUME_UTF8 MKSH_NOPWNAM MKSH_NOVI -# MKSH_CLS_STRING MKSH_BINSHREDUCED MKSH_UNEMPLOYED +# CPPFLAGS recognised: MKSH_ASSUME_UTF8 MKSH_BINSHREDUCED MKSH_CLS_STRING # MKSH_CONSERVATIVE_FDS MKSH_MIDNIGHTBSD01ASH_COMPAT -# MKSH_NO_LIMITS +# MKSH_NOPWNAM MKSH_NO_LIMITS MKSH_SMALL MKSH_S_NOVI +# MKSH_UNEMPLOYED LC_ALL=C export LC_ALL diff --git a/check.t b/check.t index 3f40fa6..0c2e5e0 100644 --- a/check.t +++ b/check.t @@ -1,4 +1,4 @@ -# $MirOS: src/bin/mksh/check.t,v 1.309 2009/09/23 18:04:53 tg Exp $ +# $MirOS: src/bin/mksh/check.t,v 1.310 2009/09/24 17:15:29 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 $ @@ -25,7 +25,7 @@ # http://www.research.att.com/~gsf/public/ifs.sh expected-stdout: - @(#)MIRBSD KSH R39 2009/09/23 + @(#)MIRBSD KSH R39 2009/09/24 description: Check version of shell. stdin: diff --git a/edit.c b/edit.c index 9f9d829..ca52a3e 100644 --- a/edit.c +++ b/edit.c @@ -25,7 +25,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.181 2009/09/23 18:04:54 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.182 2009/09/24 17:15:30 tg Exp $"); /* tty driver characters we are interested in */ typedef struct { @@ -62,7 +62,7 @@ static int x_escape(const char *, size_t, int (*)(const char *, size_t)); static int x_emacs(char *, size_t); static void x_init_emacs(void); static void x_init_prompt(void); -#ifndef MKSH_NOVI +#if !MKSH_S_NOVI static int x_vi(char *, size_t); #endif @@ -107,7 +107,7 @@ x_read(char *buf, size_t len) modified = 1; if (Flag(FEMACS) || Flag(FGMACS)) i = x_emacs(buf, len); -#ifndef MKSH_NOVI +#if !MKSH_S_NOVI else if (Flag(FVI)) i = x_vi(buf, len); #endif @@ -1044,7 +1044,7 @@ static int x_curprefix; #ifndef MKSH_SMALL static char *macroptr = NULL; /* bind key macro active? */ #endif -#ifndef MKSH_NOVI +#if !MKSH_S_NOVI static int cur_col; /* current column on line */ static int pwidth; /* width of prompt */ static int prompt_trunc; /* how much of prompt to truncate */ @@ -3368,7 +3368,7 @@ x_mode(bool onoff) return (prev); } -#ifndef MKSH_NOVI +#if !MKSH_S_NOVI /* +++ vi editing mode +++ */ #define Ctrl(c) (c&0x1f) @@ -5426,4 +5426,4 @@ vi_macro_reset(void) memset((char *)¯o, 0, sizeof(macro)); } } -#endif /* !MKSH_NOVI */ +#endif /* !MKSH_S_NOVI */ diff --git a/lex.c b/lex.c index 0627305..37beefb 100644 --- a/lex.c +++ b/lex.c @@ -22,7 +22,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.96 2009/09/23 18:04:56 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.97 2009/09/24 17:15:31 tg Exp $"); /* * states while lexing word @@ -1325,7 +1325,7 @@ getsc_line(Source *s) alarm(ksh_tmout); } if (have_tty && ( -#ifndef MKSH_NOVI +#if !MKSH_S_NOVI Flag(FVI) || #endif Flag(FEMACS) || Flag(FGMACS))) { diff --git a/main.c b/main.c index 761ca6e..c2b578f 100644 --- a/main.c +++ b/main.c @@ -33,7 +33,7 @@ #include #endif -__RCSID("$MirOS: src/bin/mksh/main.c,v 1.146 2009/09/23 18:04:57 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/main.c,v 1.147 2009/09/24 17:15:31 tg Exp $"); extern char **environ; @@ -199,7 +199,7 @@ 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 +#if !MKSH_S_NOVI Flag(FVITABCOMPLETE) = 1; #endif diff --git a/misc.c b/misc.c index a0b39a0..b33d39e 100644 --- a/misc.c +++ b/misc.c @@ -29,7 +29,7 @@ #include #endif -__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.123 2009/09/20 16:40:56 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.124 2009/09/24 17:15:32 tg Exp $"); #undef USE_CHVT /* XXX conditions correct? */ @@ -201,11 +201,11 @@ change_flag(enum sh_flag f, int what, unsigned int newval) } else #endif if (( -#ifndef MKSH_NOVI +#if !MKSH_S_NOVI f == FVI || #endif f == FEMACS || f == FGMACS) && newval) { -#ifndef MKSH_NOVI +#if !MKSH_S_NOVI Flag(FVI) = #endif Flag(FEMACS) = Flag(FGMACS) = 0; diff --git a/sh.h b/sh.h index 1887d76..7305375 100644 --- a/sh.h +++ b/sh.h @@ -134,9 +134,9 @@ #endif #ifdef EXTERN -__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.347 2009/09/23 18:04:57 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.348 2009/09/24 17:15:32 tg Exp $"); #endif -#define MKSH_VERSION "R39 2009/09/23" +#define MKSH_VERSION "R39 2009/09/24" #ifndef MKSH_INCLUDES_ONLY @@ -451,16 +451,20 @@ char *ucstrstr(char *, const char *); #ifdef MKSH_SMALL #ifndef MKSH_CONSERVATIVE_FDS -#define MKSH_CONSERVATIVE_FDS +#define MKSH_CONSERVATIVE_FDS /* defined */ #endif #ifndef MKSH_NOPWNAM -#define MKSH_NOPWNAM +#define MKSH_NOPWNAM /* defined */ #endif -#ifndef MKSH_NOVI -#define MKSH_NOVI +#ifndef MKSH_S_NOVI +#define MKSH_S_NOVI 1 #endif #endif +#ifndef MKSH_S_NOVI +#define MKSH_S_NOVI 0 +#endif + /* * simple grouping allocator */ diff --git a/sh_flags.h b/sh_flags.h index 49f835b..689f2e9 100644 --- a/sh_flags.h +++ b/sh_flags.h @@ -1,5 +1,5 @@ #if defined(SHFLAGS_DEFNS) -__RCSID("$MirOS: src/bin/mksh/sh_flags.h,v 1.1 2009/09/20 16:40:58 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/sh_flags.h,v 1.2 2009/09/24 17:15:33 tg Exp $"); #define FN(sname,cname,ochar,flags) /* nothing */ #elif defined(SHFLAGS_ENUMS) #define FN(sname,cname,ochar,flags) cname, @@ -111,7 +111,7 @@ FN("utf8-mode", FUNICODE, 'U', OF_ANY) /* -v echo input */ FN("verbose", FVERBOSE, 'v', OF_ANY) -#ifndef MKSH_NOVI +#if !MKSH_S_NOVI /* ./. Vi command line editing mode */ FN("vi", FVI, 0, OF_ANY)