clean up the CHARMASK mess
This commit is contained in:
parent
80e0de3f98
commit
e2c2a1c1a0
4
check.t
4
check.t
|
@ -1,4 +1,4 @@
|
||||||
# $MirOS: src/bin/mksh/check.t,v 1.139 2007/10/09 14:50:49 tg Exp $
|
# $MirOS: src/bin/mksh/check.t,v 1.140 2007/10/14 13:43:40 tg Exp $
|
||||||
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas 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: 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 $
|
# $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
|
# http://www.research.att.com/~gsf/public/ifs.sh
|
||||||
|
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
@(#)MIRBSD KSH R31 2007/10/09
|
@(#)MIRBSD KSH R31 2007/10/14
|
||||||
description:
|
description:
|
||||||
Check version of shell.
|
Check version of shell.
|
||||||
category: pdksh
|
category: pdksh
|
||||||
|
|
25
edit.c
25
edit.c
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.114 2007/10/09 14:50:50 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.115 2007/10/14 13:43:41 tg Exp $");
|
||||||
|
|
||||||
/* tty driver characters we are interested in */
|
/* tty driver characters we are interested in */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -1048,9 +1048,8 @@ struct x_defbindings {
|
||||||
/* Separator for motion */
|
/* Separator for motion */
|
||||||
#define is_mfs(c) (!(ksh_isalnux(c) || (c) == '$'))
|
#define is_mfs(c) (!(ksh_isalnux(c) || (c) == '$'))
|
||||||
|
|
||||||
#define CHARMASK 0xFF /* 8-bit character mask */
|
|
||||||
#define X_NTABS 3 /* normal, meta1, meta2 */
|
#define X_NTABS 3 /* normal, meta1, meta2 */
|
||||||
#define X_TABSZ (CHARMASK+1) /* size of keydef tables etc */
|
#define X_TABSZ 256 /* size of keydef tables etc */
|
||||||
|
|
||||||
/* Arguments for do_complete()
|
/* Arguments for do_complete()
|
||||||
* 0 = enumerate M-= complete as much as possible and then list
|
* 0 = enumerate M-= complete as much as possible and then list
|
||||||
|
@ -1487,7 +1486,7 @@ x_emacs(char *buf, size_t len)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
f = x_curprefix == -1 ? XFUNC_insert :
|
f = x_curprefix == -1 ? XFUNC_insert :
|
||||||
x_tab[x_curprefix][c & CHARMASK];
|
x_tab[x_curprefix][c];
|
||||||
if (f & 0x80) {
|
if (f & 0x80) {
|
||||||
f &= 0x7F;
|
f &= 0x7F;
|
||||||
if ((i = x_e_getc()) != '~')
|
if ((i = x_e_getc()) != '~')
|
||||||
|
@ -1583,7 +1582,7 @@ x_ins_string(int c)
|
||||||
x_e_putc2(7);
|
x_e_putc2(7);
|
||||||
return KSTD;
|
return KSTD;
|
||||||
}
|
}
|
||||||
macroptr = x_atab[c >> 8][c & CHARMASK];
|
macroptr = x_atab[c >> 8][c & 255];
|
||||||
if (macroptr && !*macroptr) {
|
if (macroptr && !*macroptr) {
|
||||||
/* XXX bell? */
|
/* XXX bell? */
|
||||||
macroptr = NULL;
|
macroptr = NULL;
|
||||||
|
@ -2121,7 +2120,7 @@ x_search_hist(int c)
|
||||||
x_flush();
|
x_flush();
|
||||||
if ((c = x_e_getc()) < 0)
|
if ((c = x_e_getc()) < 0)
|
||||||
return KSTD;
|
return KSTD;
|
||||||
f = x_tab[0][c & CHARMASK];
|
f = x_tab[0][c];
|
||||||
if (f & 0x80) {
|
if (f & 0x80) {
|
||||||
f &= 0x7F;
|
f &= 0x7F;
|
||||||
if ((c = x_e_getc()) != '~')
|
if ((c = x_e_getc()) != '~')
|
||||||
|
@ -2606,7 +2605,7 @@ x_bind(const char *a1, const char *a2,
|
||||||
m2 = m1 = x_mapin(a1, ATEMP);
|
m2 = m1 = x_mapin(a1, ATEMP);
|
||||||
prefix = key = 0;
|
prefix = key = 0;
|
||||||
for (;; m1++) {
|
for (;; m1++) {
|
||||||
key = *m1 & CHARMASK;
|
key = (u_char)*m1;
|
||||||
f = x_tab[prefix][key] & 0x7F;
|
f = x_tab[prefix][key] & 0x7F;
|
||||||
if (f == XFUNC_meta1)
|
if (f == XFUNC_meta1)
|
||||||
prefix = 1;
|
prefix = 1;
|
||||||
|
@ -2914,7 +2913,7 @@ x_adjust(void)
|
||||||
static void
|
static void
|
||||||
x_e_ungetc(int c)
|
x_e_ungetc(int c)
|
||||||
{
|
{
|
||||||
unget_char = c;
|
unget_char = c < 0 ? -1 : (c & 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -2925,16 +2924,14 @@ x_e_getc(void)
|
||||||
if (unget_char >= 0) {
|
if (unget_char >= 0) {
|
||||||
c = unget_char;
|
c = unget_char;
|
||||||
unget_char = -1;
|
unget_char = -1;
|
||||||
} else {
|
} else if (macroptr) {
|
||||||
if (macroptr) {
|
c = (u_char)*macroptr++;
|
||||||
c = *macroptr++;
|
|
||||||
if (!*macroptr)
|
if (!*macroptr)
|
||||||
macroptr = NULL;
|
macroptr = NULL;
|
||||||
} else
|
} else
|
||||||
c = x_getc();
|
c = x_getc();
|
||||||
}
|
|
||||||
|
|
||||||
return c <= CHARMASK ? c : (c & CHARMASK);
|
return (c);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -3038,7 +3035,7 @@ x_set_arg(int c)
|
||||||
int n = 0;
|
int n = 0;
|
||||||
int first = 1;
|
int first = 1;
|
||||||
|
|
||||||
c &= CHARMASK; /* strip command prefix */
|
c &= 255; /* strip command prefix */
|
||||||
for (; c >= 0 && ksh_isdigit(c); c = x_e_getc(), first = 0)
|
for (; c >= 0 && ksh_isdigit(c); c = x_e_getc(), first = 0)
|
||||||
n = n * 10 + (c - '0');
|
n = n * 10 + (c - '0');
|
||||||
if (c < 0 || first) {
|
if (c < 0 || first) {
|
||||||
|
|
4
sh.h
4
sh.h
|
@ -8,8 +8,8 @@
|
||||||
/* $OpenBSD: c_test.h,v 1.4 2004/12/20 11:34:26 otto Exp $ */
|
/* $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 $ */
|
/* $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.176 2007/10/09 14:50:50 tg Exp $"
|
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.177 2007/10/14 13:43:41 tg Exp $"
|
||||||
#define MKSH_VERSION "R31 2007/10/09"
|
#define MKSH_VERSION "R31 2007/10/14"
|
||||||
|
|
||||||
#if HAVE_SYS_PARAM_H
|
#if HAVE_SYS_PARAM_H
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
|
Loading…
Reference in New Issue