new MKSH_NO_CMDLINE_EDITING to disable command line editing in its entirety
mainly for the Plan 9 port though it may also help the WinAPI variant, other porting efforts, as well as a new project I cannot say yet
This commit is contained in:
parent
7c4bf78446
commit
5780bc5eb7
5
Build.sh
5
Build.sh
@ -1,5 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.552 2012/04/27 16:16:19 tg Exp $'
|
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.553 2012/05/04 20:49:00 tg Exp $'
|
||||||
#-
|
#-
|
||||||
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
||||||
# 2011, 2012
|
# 2011, 2012
|
||||||
@ -1398,7 +1398,7 @@ else
|
|||||||
#define EXTERN
|
#define EXTERN
|
||||||
#define MKSH_INCLUDES_ONLY
|
#define MKSH_INCLUDES_ONLY
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
__RCSID("$MirOS: src/bin/mksh/Build.sh,v 1.552 2012/04/27 16:16:19 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/Build.sh,v 1.553 2012/05/04 20:49:00 tg Exp $");
|
||||||
int main(void) { printf("Hello, World!\n"); return (0); }
|
int main(void) { printf("Hello, World!\n"); return (0); }
|
||||||
EOF
|
EOF
|
||||||
case $cm in
|
case $cm in
|
||||||
@ -2092,6 +2092,7 @@ MKSH_DONT_EMIT_IDSTRING omit RCS IDs from binary
|
|||||||
MKSH_MIDNIGHTBSD01ASH_COMPAT set -o sh: additional compatibility quirk
|
MKSH_MIDNIGHTBSD01ASH_COMPAT set -o sh: additional compatibility quirk
|
||||||
MKSH_NOPROSPECTOFWORK disable jobs, co-processes, etc. (do not use)
|
MKSH_NOPROSPECTOFWORK disable jobs, co-processes, etc. (do not use)
|
||||||
MKSH_NOPWNAM skip PAM calls, for -static on eglibc, Solaris
|
MKSH_NOPWNAM skip PAM calls, for -static on eglibc, Solaris
|
||||||
|
MKSH_NO_CMDLINE_EDITING disable command line editing code entirely
|
||||||
MKSH_NO_DEPRECATED_WARNING omit warning when deprecated stuff is run
|
MKSH_NO_DEPRECATED_WARNING omit warning when deprecated stuff is run
|
||||||
MKSH_NO_EXTERNAL_CAT omit hack to skip cat builtin when flags passed
|
MKSH_NO_EXTERNAL_CAT omit hack to skip cat builtin when flags passed
|
||||||
MKSH_NO_LIMITS omit ulimit code
|
MKSH_NO_LIMITS omit ulimit code
|
||||||
|
5
edit.c
5
edit.c
@ -26,7 +26,9 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.234 2012/04/06 15:06:42 tg Exp $");
|
#ifndef MKSH_NO_CMDLINE_EDITING
|
||||||
|
|
||||||
|
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.235 2012/05/04 20:49:01 tg Exp $");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* in later versions we might use libtermcap for this, but since external
|
* in later versions we might use libtermcap for this, but since external
|
||||||
@ -5364,6 +5366,7 @@ vi_macro_reset(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* !MKSH_S_NOVI */
|
#endif /* !MKSH_S_NOVI */
|
||||||
|
#endif /* !MKSH_NO_CMDLINE_EDITING */
|
||||||
|
|
||||||
void
|
void
|
||||||
x_mkraw(int fd, struct termios *ocb, bool forread)
|
x_mkraw(int fd, struct termios *ocb, bool forread)
|
||||||
|
6
funcs.c
6
funcs.c
@ -38,7 +38,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.213 2012/05/04 20:08:24 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.214 2012/05/04 20:49:03 tg Exp $");
|
||||||
|
|
||||||
#if HAVE_KILLPG
|
#if HAVE_KILLPG
|
||||||
/*
|
/*
|
||||||
@ -139,7 +139,9 @@ const struct builtin mkshbuiltins[] = {
|
|||||||
{"+bg", c_fgbg},
|
{"+bg", c_fgbg},
|
||||||
{"+fg", c_fgbg},
|
{"+fg", c_fgbg},
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef MKSH_NO_CMDLINE_EDITING
|
||||||
{"bind", c_bind},
|
{"bind", c_bind},
|
||||||
|
#endif
|
||||||
{"cat", c_cat},
|
{"cat", c_cat},
|
||||||
#if HAVE_MKNOD
|
#if HAVE_MKNOD
|
||||||
{"mknod", c_mknod},
|
{"mknod", c_mknod},
|
||||||
@ -1481,6 +1483,7 @@ c_getopts(const char **wp)
|
|||||||
return (optc < 0 ? 1 : rv);
|
return (optc < 0 ? 1 : rv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef MKSH_NO_CMDLINE_EDITING
|
||||||
int
|
int
|
||||||
c_bind(const char **wp)
|
c_bind(const char **wp)
|
||||||
{
|
{
|
||||||
@ -1539,6 +1542,7 @@ c_bind(const char **wp)
|
|||||||
|
|
||||||
return (rv);
|
return (rv);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
c_shift(const char **wp)
|
c_shift(const char **wp)
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#include <sys/file.h>
|
#include <sys/file.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.123 2012/04/14 16:07:47 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.124 2012/05/04 20:49:04 tg Exp $");
|
||||||
|
|
||||||
Trap sigtraps[NSIG + 1];
|
Trap sigtraps[NSIG + 1];
|
||||||
static struct sigaction Sigact_ign;
|
static struct sigaction Sigact_ign;
|
||||||
@ -475,7 +475,7 @@ hist_get_oldest(void)
|
|||||||
return (history);
|
return (history);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !MKSH_S_NOVI
|
#if !defined(MKSH_NO_CMDLINE_EDITING) && !MKSH_S_NOVI
|
||||||
/* current position in history[] */
|
/* current position in history[] */
|
||||||
static char **current;
|
static char **current;
|
||||||
|
|
||||||
|
7
lex.c
7
lex.c
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.161 2012/04/07 11:19:49 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.162 2012/05/04 20:49:04 tg Exp $");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* states while lexing word
|
* states while lexing word
|
||||||
@ -1382,6 +1382,7 @@ getsc_line(Source *s)
|
|||||||
}
|
}
|
||||||
if (interactive)
|
if (interactive)
|
||||||
change_winsz();
|
change_winsz();
|
||||||
|
#ifndef MKSH_NO_CMDLINE_EDITING
|
||||||
if (have_tty && (
|
if (have_tty && (
|
||||||
#if !MKSH_S_NOVI
|
#if !MKSH_S_NOVI
|
||||||
Flag(FVI) ||
|
Flag(FVI) ||
|
||||||
@ -1395,7 +1396,9 @@ getsc_line(Source *s)
|
|||||||
nread = 0;
|
nread = 0;
|
||||||
xp[nread] = '\0';
|
xp[nread] = '\0';
|
||||||
xp += nread;
|
xp += nread;
|
||||||
} else {
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
if (interactive)
|
if (interactive)
|
||||||
pprompt(prompt, 0);
|
pprompt(prompt, 0);
|
||||||
else
|
else
|
||||||
|
6
main.c
6
main.c
@ -34,7 +34,7 @@
|
|||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.216 2012/04/14 16:07:47 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.217 2012/05/04 20:49:05 tg Exp $");
|
||||||
|
|
||||||
extern char **environ;
|
extern char **environ;
|
||||||
|
|
||||||
@ -327,6 +327,7 @@ main_init(int argc, const char *argv[], Source **sp, struct block **lp)
|
|||||||
*/
|
*/
|
||||||
Flag(FBRACEEXPAND) = 1;
|
Flag(FBRACEEXPAND) = 1;
|
||||||
|
|
||||||
|
#ifndef MKSH_NO_CMDLINE_EDITING
|
||||||
/*
|
/*
|
||||||
* Set edit mode to emacs by default, may be overridden
|
* Set edit mode to emacs by default, may be overridden
|
||||||
* by the environment or the user. Also, we want tab completion
|
* by the environment or the user. Also, we want tab completion
|
||||||
@ -335,6 +336,7 @@ main_init(int argc, const char *argv[], Source **sp, struct block **lp)
|
|||||||
change_flag(FEMACS, OF_SPECIAL, 1);
|
change_flag(FEMACS, OF_SPECIAL, 1);
|
||||||
#if !MKSH_S_NOVI
|
#if !MKSH_S_NOVI
|
||||||
Flag(FVITABCOMPLETE) = 1;
|
Flag(FVITABCOMPLETE) = 1;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* import environment */
|
/* import environment */
|
||||||
@ -517,7 +519,9 @@ main_init(int argc, const char *argv[], Source **sp, struct block **lp)
|
|||||||
utf_flag = 0;
|
utf_flag = 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#ifndef MKSH_NO_CMDLINE_EDITING
|
||||||
x_init();
|
x_init();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SIGWINCH
|
#ifdef SIGWINCH
|
||||||
|
7
misc.c
7
misc.c
@ -30,7 +30,7 @@
|
|||||||
#include <grp.h>
|
#include <grp.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.188 2012/05/04 20:08:25 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.189 2012/05/04 20:49:06 tg Exp $");
|
||||||
|
|
||||||
/* type bits for unsigned char */
|
/* type bits for unsigned char */
|
||||||
unsigned char chtypes[UCHAR_MAX + 1];
|
unsigned char chtypes[UCHAR_MAX + 1];
|
||||||
@ -226,6 +226,7 @@ change_flag(enum sh_flag f, int what, unsigned int newval)
|
|||||||
j_change();
|
j_change();
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef MKSH_NO_CMDLINE_EDITING
|
||||||
if ((
|
if ((
|
||||||
#if !MKSH_S_NOVI
|
#if !MKSH_S_NOVI
|
||||||
f == FVI ||
|
f == FVI ||
|
||||||
@ -236,7 +237,9 @@ change_flag(enum sh_flag f, int what, unsigned int newval)
|
|||||||
#endif
|
#endif
|
||||||
Flag(FEMACS) = Flag(FGMACS) = 0;
|
Flag(FEMACS) = Flag(FGMACS) = 0;
|
||||||
Flag(f) = (unsigned char)newval;
|
Flag(f) = (unsigned char)newval;
|
||||||
} else if (f == FPRIVILEGED && oldval && !newval) {
|
} else
|
||||||
|
#endif
|
||||||
|
if (f == FPRIVILEGED && oldval && !newval) {
|
||||||
/* Turning off -p? */
|
/* Turning off -p? */
|
||||||
|
|
||||||
/*XXX this can probably be optimised */
|
/*XXX this can probably be optimised */
|
||||||
|
10
sh.h
10
sh.h
@ -152,7 +152,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef EXTERN
|
#ifdef EXTERN
|
||||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.552 2012/05/04 20:08:25 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.553 2012/05/04 20:49:07 tg Exp $");
|
||||||
#endif
|
#endif
|
||||||
#define MKSH_VERSION "R40 2012/04/27"
|
#define MKSH_VERSION "R40 2012/04/27"
|
||||||
|
|
||||||
@ -1543,14 +1543,16 @@ void *aresize(void *, size_t, Area *);
|
|||||||
void *aresize2(void *, size_t, size_t, Area *);
|
void *aresize2(void *, size_t, size_t, Area *);
|
||||||
void afree(void *, Area *); /* can take NULL */
|
void afree(void *, Area *); /* can take NULL */
|
||||||
/* edit.c */
|
/* edit.c */
|
||||||
|
#ifndef MKSH_NO_CMDLINE_EDITING
|
||||||
#ifndef MKSH_SMALL
|
#ifndef MKSH_SMALL
|
||||||
int x_bind(const char *, const char *, bool, bool);
|
int x_bind(const char *, const char *, bool, bool);
|
||||||
#else
|
#else
|
||||||
int x_bind(const char *, const char *, bool);
|
int x_bind(const char *, const char *, bool);
|
||||||
#endif
|
#endif
|
||||||
void x_init(void);
|
void x_init(void);
|
||||||
void x_mkraw(int, struct termios *, bool);
|
|
||||||
int x_read(char *, size_t);
|
int x_read(char *, size_t);
|
||||||
|
#endif
|
||||||
|
void x_mkraw(int, struct termios *, bool);
|
||||||
/* eval.c */
|
/* eval.c */
|
||||||
char *substitute(const char *, int);
|
char *substitute(const char *, int);
|
||||||
char **eval(const char **, int);
|
char **eval(const char **, int);
|
||||||
@ -1604,7 +1606,9 @@ int c_fgbg(const char **);
|
|||||||
int c_kill(const char **);
|
int c_kill(const char **);
|
||||||
void getopts_reset(int);
|
void getopts_reset(int);
|
||||||
int c_getopts(const char **);
|
int c_getopts(const char **);
|
||||||
|
#ifndef MKSH_NO_CMDLINE_EDITING
|
||||||
int c_bind(const char **);
|
int c_bind(const char **);
|
||||||
|
#endif
|
||||||
int c_shift(const char **);
|
int c_shift(const char **);
|
||||||
int c_umask(const char **);
|
int c_umask(const char **);
|
||||||
int c_dot(const char **);
|
int c_dot(const char **);
|
||||||
@ -1646,7 +1650,7 @@ void sethistsize(mksh_ari_t);
|
|||||||
#if HAVE_PERSISTENT_HISTORY
|
#if HAVE_PERSISTENT_HISTORY
|
||||||
void sethistfile(const char *);
|
void sethistfile(const char *);
|
||||||
#endif
|
#endif
|
||||||
#if !MKSH_S_NOVI
|
#if !defined(MKSH_NO_CMDLINE_EDITING) && !MKSH_S_NOVI
|
||||||
char **histpos(void);
|
char **histpos(void);
|
||||||
int histnum(int);
|
int histnum(int);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#if defined(SHFLAGS_DEFNS)
|
#if defined(SHFLAGS_DEFNS)
|
||||||
__RCSID("$MirOS: src/bin/mksh/sh_flags.h,v 1.9 2011/06/12 15:37:10 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/sh_flags.h,v 1.10 2012/05/04 20:49:08 tg Exp $");
|
||||||
#define FN(sname,cname,ochar,flags) /* nothing */
|
#define FN(sname,cname,ochar,flags) /* nothing */
|
||||||
#elif defined(SHFLAGS_ENUMS)
|
#elif defined(SHFLAGS_ENUMS)
|
||||||
#define FN(sname,cname,ochar,flags) cname,
|
#define FN(sname,cname,ochar,flags) cname,
|
||||||
@ -29,14 +29,18 @@ FN("bgnice", FBGNICE, 0, OF_ANY)
|
|||||||
/* ./. enable {} globbing (non-standard) */
|
/* ./. enable {} globbing (non-standard) */
|
||||||
FN("braceexpand", FBRACEEXPAND, 0, OF_ANY)
|
FN("braceexpand", FBRACEEXPAND, 0, OF_ANY)
|
||||||
|
|
||||||
|
#ifndef MKSH_NO_CMDLINE_EDITING
|
||||||
/* ./. Emacs command line editing mode */
|
/* ./. Emacs command line editing mode */
|
||||||
FN("emacs", FEMACS, 0, OF_ANY)
|
FN("emacs", FEMACS, 0, OF_ANY)
|
||||||
|
#endif
|
||||||
|
|
||||||
/* -e quit on error */
|
/* -e quit on error */
|
||||||
FN("errexit", FERREXIT, 'e', OF_ANY)
|
FN("errexit", FERREXIT, 'e', OF_ANY)
|
||||||
|
|
||||||
|
#ifndef MKSH_NO_CMDLINE_EDITING
|
||||||
/* ./. Emacs command line editing mode, gmacs variant */
|
/* ./. Emacs command line editing mode, gmacs variant */
|
||||||
FN("gmacs", FGMACS, 0, OF_ANY)
|
FN("gmacs", FGMACS, 0, OF_ANY)
|
||||||
|
#endif
|
||||||
|
|
||||||
/* ./. reading EOF does not exit */
|
/* ./. reading EOF does not exit */
|
||||||
FN("ignoreeof", FIGNOREEOF, 0, OF_ANY)
|
FN("ignoreeof", FIGNOREEOF, 0, OF_ANY)
|
||||||
@ -108,7 +112,7 @@ FN("utf8-mode", FUNICODE, 'U', OF_ANY)
|
|||||||
/* -v echo input */
|
/* -v echo input */
|
||||||
FN("verbose", FVERBOSE, 'v', OF_ANY)
|
FN("verbose", FVERBOSE, 'v', OF_ANY)
|
||||||
|
|
||||||
#if !MKSH_S_NOVI
|
#if !defined(MKSH_NO_CMDLINE_EDITING) && !MKSH_S_NOVI
|
||||||
/* ./. Vi command line editing mode */
|
/* ./. Vi command line editing mode */
|
||||||
FN("vi", FVI, 0, OF_ANY)
|
FN("vi", FVI, 0, OF_ANY)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user