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)
This commit is contained in:
tg 2009-09-24 17:15:33 +00:00
parent f00db85c98
commit 1dfb13b603
8 changed files with 31 additions and 27 deletions

View File

@ -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 <tg@mirbsd.org>
@ -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

View File

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

12
edit.c
View File

@ -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 *)&macro, 0, sizeof(macro));
}
}
#endif /* !MKSH_NOVI */
#endif /* !MKSH_S_NOVI */

4
lex.c
View File

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

4
main.c
View File

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

6
misc.c
View File

@ -29,7 +29,7 @@
#include <grp.h>
#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;

16
sh.h
View File

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

View File

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