^V now is quote, not version, even in emacs mode. (From OpenBSD.)

Also, the "version" command got removed in its entirety.
Shaves off another global variable, even.
This commit is contained in:
tg 2005-08-02 12:35:27 +00:00
parent 1197e6fd1b
commit 0651ba008e
5 changed files with 25 additions and 90 deletions

View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.t,v 1.26 2005/07/07 23:27:52 tg Exp $
# $MirOS: src/bin/mksh/check.t,v 1.27 2005/08/02 12:35:25 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 $
@ -3701,5 +3701,5 @@ category: pdksh
stdin:
echo $KSH_VERSION
expected-stdout:
@(#)MIRBSD KSH R24 2005/07/07
@(#)MIRBSD KSH R24 2005/08/02
---

80
edit.c
View File

@ -1,7 +1,7 @@
/** $MirOS: src/bin/mksh/edit.c,v 1.11 2005/07/12 13:30:37 tg Exp $ */
/** $MirOS: src/bin/mksh/edit.c,v 1.12 2005/08/02 12:35:26 tg Exp $ */
/* $OpenBSD: edit.c,v 1.29 2005/04/13 02:33:08 deraadt Exp $ */
/* $OpenBSD: edit.h,v 1.8 2005/03/28 21:28:22 deraadt Exp $ */
/* $OpenBSD: emacs.c,v 1.37 2005/03/30 17:16:37 deraadt Exp $ */
/* $OpenBSD: emacs.c,v 1.38 2005/08/01 04:27:31 deraadt Exp $ */
/* $OpenBSD: vi.c,v 1.21 2005/03/30 17:16:37 deraadt Exp $ */
#include "sh.h"
@ -10,7 +10,7 @@
#include <ctype.h>
#include <libgen.h>
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.11 2005/07/12 13:30:37 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.12 2005/08/02 12:35:26 tg Exp $");
#define BEL 0x07
@ -1048,16 +1048,15 @@ static int x_emacs_putbuf(const char *, size_t);
#define XFUNC_stuff 43
#define XFUNC_stuffreset 44
#define XFUNC_transpose 45
#define XFUNC_version 46
#define XFUNC_xchg_point_mark 47
#define XFUNC_yank 48
#define XFUNC_comp_list 49
#define XFUNC_expand 50
#define XFUNC_fold_capitalize 51
#define XFUNC_fold_lower 52
#define XFUNC_fold_upper 53
#define XFUNC_set_arg 54
#define XFUNC_comment 55
#define XFUNC_xchg_point_mark 46
#define XFUNC_yank 47
#define XFUNC_comp_list 48
#define XFUNC_expand 49
#define XFUNC_fold_capitalize 50
#define XFUNC_fold_lower 51
#define XFUNC_fold_upper 52
#define XFUNC_set_arg 53
#define XFUNC_comment 54
static int x_abort (int);
static int x_beg_hist (int);
@ -1105,7 +1104,6 @@ static int x_set_mark (int);
static int x_stuff (int);
static int x_stuffreset (int);
static int x_transpose (int);
static int x_version (int);
static int x_xchg_point_mark (int);
static int x_yank (int);
static int x_comp_list (int);
@ -1163,7 +1161,6 @@ static const struct x_ftab x_ftab[] = {
{ x_stuff, "stuff", 0 },
{ x_stuffreset, "stuff-reset", 0 },
{ x_transpose, "transpose-chars", 0 },
{ x_version, "version", 0 },
{ x_xchg_point_mark, "exchange-point-and-mark", 0 },
{ x_yank, "yank", 0 },
{ x_comp_list, "complete-list", 0 },
@ -1228,7 +1225,7 @@ static struct x_defbindings const x_defbindings[] = {
{ XFUNC_set_mark, 1, ' ' },
{ XFUNC_kill_region, 0, MKCTRL('W') },
{ XFUNC_xchg_point_mark, 2, MKCTRL('X') },
{ XFUNC_version, 0, MKCTRL('V') },
{ XFUNC_literal, 0, MKCTRL('V') },
{ XFUNC_prev_histword, 1, '.' },
{ XFUNC_prev_histword, 1, '_' },
{ XFUNC_set_arg, 1, '0' },
@ -2431,38 +2428,6 @@ x_xchg_point_mark(int c __attribute__((unused)))
return KSTD;
}
static int
x_version(int c __attribute__((unused)))
{
char *o_xbuf = xbuf, *o_xend = xend;
char *o_xbp = xbp, *o_xep = xep, *o_xcp = xcp;
int lim = x_lastcp() - xbp;
char *v = strdup(ksh_version + 4);
check_sigwinch(); /* mksh hack ;-) */
xbuf = xbp = xcp = v;
xend = xep = v + strlen(v);
x_redraw(lim);
x_flush();
c = x_e_getc();
xbuf = o_xbuf;
xend = o_xend;
xbp = o_xbp;
xep = o_xep;
xcp = o_xcp;
x_redraw(strlen(ksh_version));
if (c < 0)
return KSTD;
/* This is what at&t ksh seems to do... Very bizarre */
if (c != ' ')
x_e_ungetc(c);
free(v);
return KSTD;
}
static int
x_noop(int c __attribute__((unused)))
{
@ -3043,7 +3008,6 @@ const unsigned char classify[128] = {
#define VREDO 7 /* . */
#define VLIT 8 /* ^V */
#define VSEARCH 9 /* /, ? */
#define VVERSION 10 /* <ESC> ^V */
static char undocbuf[LINE];
@ -3128,7 +3092,7 @@ x_vi(char *buf, size_t len)
trapsig(c == edchars.intr ? SIGINT : SIGQUIT);
x_mode(false);
unwind(LSHELL);
} else if (c == edchars.eof && state != VVERSION) {
} else if (c == edchars.eof) {
if (es->linelen == 0) {
x_vi_zotc(edchars.eof);
c = -1;
@ -3208,14 +3172,6 @@ vi_hook(int ch)
return -1;
refresh(0);
}
if (state == VVERSION) {
save_cbuf();
es->cursor = 0;
es->linelen = 0;
putbuf(ksh_version + 4,
strlen(ksh_version + 4), 0);
refresh(0);
}
}
}
break;
@ -3230,12 +3186,6 @@ vi_hook(int ch)
state = VNORMAL;
break;
case VVERSION:
restore_cbuf();
state = VNORMAL;
refresh(0);
break;
case VARG1:
if (isdigit(ch))
argc1 = argc1 * 10 + ch - '0';
@ -3452,8 +3402,6 @@ nextstate(int ch)
return VXCH;
else if (ch == '.')
return VREDO;
else if (ch == Ctrl('v'))
return VVERSION;
else if (is_cmd(ch))
return VCMD;
else

8
main.c
View File

@ -1,4 +1,4 @@
/** $MirOS: src/bin/mksh/main.c,v 1.22 2005/07/07 22:00:45 tg Exp $ */
/** $MirOS: src/bin/mksh/main.c,v 1.23 2005/08/02 12:35:26 tg Exp $ */
/* $OpenBSD: main.c,v 1.38 2005/03/30 17:16:37 deraadt Exp $ */
/* $OpenBSD: tty.c,v 1.8 2005/03/30 17:16:37 deraadt Exp $ */
/* $OpenBSD: io.c,v 1.21 2005/03/30 17:16:37 deraadt Exp $ */
@ -13,9 +13,9 @@
#include <time.h>
#endif
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.22 2005/07/07 22:00:45 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.23 2005/08/02 12:35:26 tg Exp $");
const char ksh_version[] = "@(#)MIRBSD KSH R24 2005/07/07";
#define MKSH_VERSION "@(#)MIRBSD KSH R24 2005/08/02"
extern char **environ;
@ -201,7 +201,7 @@ main(int argc, char *argv[])
#endif
setint(global("PPID"), (long)ppid);
/* setstr can't fail here */
setstr(global("KSH_VERSION"), ksh_version, KSH_RETURN_ERROR);
setstr(global("KSH_VERSION"), MKSH_VERSION, KSH_RETURN_ERROR);
/* execute initialisation statements */
for (wp = (char **)initcoms; *wp != NULL; wp++) {

19
mksh.1
View File

@ -1,5 +1,5 @@
.\" $MirOS: src/bin/mksh/mksh.1,v 1.14 2005/07/06 00:02:06 tg Exp $
.\" $OpenBSD: ksh.1,v 1.99 2005/05/25 16:52:06 jaredy Exp $
.\" $MirOS: src/bin/mksh/mksh.1,v 1.15 2005/08/02 12:35:26 tg Exp $
.\" $OpenBSD: ksh.1,v 1.101 2005/08/01 19:29:57 jmc Exp $
.\" $OpenBSD: sh.1tbl,v 1.53 2004/12/10 01:56:56 jaredy Exp $
.\"
.Dd May 22, 2005
@ -1418,11 +1418,6 @@ This parameter is not imported from the environment when the shell is
started.
.It Ev KSH_VERSION
The name and version of the shell (read-only).
See also the version commands in
.Sx Emacs editing mode
and
.Sx Vi editing mode
sections, below.
.It Ev LINENO
The line number of the function or shell script that is currently being
executed.
@ -4507,11 +4502,8 @@ lines (earlier).
Uppercase the next
.Ar n
words.
.It version: ^V
Display the version of
.Nm .
The current edit buffer is restored as soon as any
key is pressed (the key is then processed, unless it is a space).
.It quote: ^V
Synonym for ^^.
.It yank: ^Y
Inserts the most recently killed text string at the current cursor position.
.It yank-pop: ^[y
@ -4726,9 +4718,6 @@ enumeration command).
.It = and ^E
Command/file name enumeration.
List all the commands or files that match the current big-word.
.It ^V
Display the version of the shell;
it is displayed until another key is pressed (this key is ignored).
.It @ Ns Ar c
Macro expansion.
Execute the commands found in the alias

4
sh.h
View File

@ -1,4 +1,4 @@
/** $MirOS: src/bin/mksh/sh.h,v 1.16 2005/07/07 23:27:52 tg Exp $ */
/** $MirOS: src/bin/mksh/sh.h,v 1.17 2005/08/02 12:35:27 tg Exp $ */
/* $OpenBSD: sh.h,v 1.27 2005/03/28 21:33:04 deraadt Exp $ */
/* $OpenBSD: shf.h,v 1.5 2005/03/30 17:16:37 deraadt Exp $ */
/* $OpenBSD: table.h,v 1.6 2004/12/18 20:55:52 millert Exp $ */
@ -365,8 +365,6 @@ EXTERN struct coproc coproc;
/* Used in jobs.c and by coprocess stuff in exec.c */
EXTERN sigset_t sm_default, sm_sigchld;
extern const char ksh_version[];
/* name of called builtin function (used by error functions) */
EXTERN char *builtin_argv0;
EXTERN Tflag builtin_flag; /* flags of called builtin (SPEC_BI, etc.) */