make tab completing filenames with ':' '=' '$' '`' work as well as
others (colon and equals sign need to be simply escaped, while dollar sign and accent gravis need double escaping like opening square brak- ket did back then); add = to C_QUOTE to simplify (doesn't break any- thing) and sort these strings asciibetically while here
This commit is contained in:
parent
dc98ec23a6
commit
6fcacf577d
4
check.t
4
check.t
@ -1,4 +1,4 @@
|
||||
# $MirOS: src/bin/mksh/check.t,v 1.335 2009/10/27 17:00:00 tg Exp $
|
||||
# $MirOS: src/bin/mksh/check.t,v 1.336 2009/10/30 00:57:35 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/10/27
|
||||
@(#)MIRBSD KSH R39 2009/10/30
|
||||
description:
|
||||
Check version of shell.
|
||||
stdin:
|
||||
|
18
edit.c
18
edit.c
@ -25,7 +25,7 @@
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.183 2009/09/26 04:01:31 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.184 2009/10/30 00:57:36 tg Exp $");
|
||||
|
||||
/* tty driver characters we are interested in */
|
||||
typedef struct {
|
||||
@ -251,7 +251,8 @@ static int
|
||||
x_file_glob(int flags __unused, const char *str, int slen, char ***wordsp)
|
||||
{
|
||||
char *toglob, **words;
|
||||
int nwords, i, idx, escaping;
|
||||
int nwords, i, idx;
|
||||
bool escaping;
|
||||
XPtrV w;
|
||||
struct source *s, *sold;
|
||||
|
||||
@ -261,20 +262,21 @@ x_file_glob(int flags __unused, const char *str, int slen, char ***wordsp)
|
||||
toglob = add_glob(str, slen);
|
||||
|
||||
/* remove all escaping backward slashes */
|
||||
escaping = 0;
|
||||
escaping = false;
|
||||
for (i = 0, idx = 0; toglob[i]; i++) {
|
||||
if (toglob[i] == '\\' && !escaping) {
|
||||
escaping = 1;
|
||||
escaping = true;
|
||||
continue;
|
||||
}
|
||||
/* specially escape escaped [ for globbing */
|
||||
if (escaping && toglob[i] == '[')
|
||||
/* specially escape escaped [ or $ or ` for globbing */
|
||||
if (escaping && (toglob[i] == '[' ||
|
||||
toglob[i] == '$' || toglob[i] == '`'))
|
||||
toglob[idx++] = QCHAR;
|
||||
|
||||
toglob[idx] = toglob[i];
|
||||
idx++;
|
||||
if (escaping)
|
||||
escaping = 0;
|
||||
escaping = false;
|
||||
}
|
||||
toglob[idx] = '\0';
|
||||
|
||||
@ -708,7 +710,7 @@ x_escape(const char *s, size_t len, int (*putbuf_func)(const char *, size_t))
|
||||
int rval = 0;
|
||||
|
||||
while (wlen - add > 0)
|
||||
if (vstrchr("\\$()[?{}*&;#|<>\"'`", s[add]) ||
|
||||
if (vstrchr("\"#$&'()*:;<=>?[\\`{|}", s[add]) ||
|
||||
vstrchr(ifs, s[add])) {
|
||||
if (putbuf_func(s, add) != 0) {
|
||||
rval = -1;
|
||||
|
4
eval.c
4
eval.c
@ -22,7 +22,7 @@
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.69 2009/09/06 17:42:12 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.70 2009/10/30 00:57:37 tg Exp $");
|
||||
|
||||
/*
|
||||
* string expansion
|
||||
@ -1179,7 +1179,7 @@ trimsub(char *str, char *pat, int how)
|
||||
* Name derived from V6's /etc/glob, the program that expanded filenames.
|
||||
*/
|
||||
|
||||
/* XXX cp not const 'cause slashes are temporarily replaced with nulls... */
|
||||
/* XXX cp not const 'cause slashes are temporarily replaced with NULs... */
|
||||
static void
|
||||
glob(char *cp, XPtrV *wp, int markdirs)
|
||||
{
|
||||
|
4
misc.c
4
misc.c
@ -29,7 +29,7 @@
|
||||
#include <grp.h>
|
||||
#endif
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.126 2009/10/27 17:00:02 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.127 2009/10/30 00:57:38 tg Exp $");
|
||||
|
||||
#undef USE_CHVT
|
||||
/* XXX conditions correct? */
|
||||
@ -83,7 +83,7 @@ initctypes(void)
|
||||
setctypes("*@#!$-?", C_VAR1);
|
||||
setctypes(" \t\n", C_IFSWS);
|
||||
setctypes("=-+?", C_SUBOP1);
|
||||
setctypes(" \n\t\"#$&'()*;<>?[]\\`|", C_QUOTE);
|
||||
setctypes("\t\n \"#$&'()*;<=>?[\\]`|", C_QUOTE);
|
||||
}
|
||||
|
||||
/* called from XcheckN() to grow buffer */
|
||||
|
6
sh.h
6
sh.h
@ -134,9 +134,9 @@
|
||||
#endif
|
||||
|
||||
#ifdef EXTERN
|
||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.358 2009/10/27 17:00:02 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.359 2009/10/30 00:57:38 tg Exp $");
|
||||
#endif
|
||||
#define MKSH_VERSION "R39 2009/10/27"
|
||||
#define MKSH_VERSION "R39 2009/10/30"
|
||||
|
||||
#ifndef MKSH_INCLUDES_ONLY
|
||||
|
||||
@ -677,7 +677,7 @@ EXTERN int really_exit;
|
||||
#define C_VAR1 BIT(3) /* *@#!$-? */
|
||||
#define C_IFSWS BIT(4) /* \t \n (IFS white space) */
|
||||
#define C_SUBOP1 BIT(5) /* "=-+?" */
|
||||
#define C_QUOTE BIT(6) /* \t \n"#$&'()*;<>?[]\`| (needing quoting) */
|
||||
#define C_QUOTE BIT(6) /* \t\n "#$&'()*;<=>?[\]`| (needing quoting) */
|
||||
#define C_IFS BIT(7) /* $IFS */
|
||||
#define C_SUBOP2 BIT(8) /* "#%" (magic, see below) */
|
||||
|
||||
|
8
syn.c
8
syn.c
@ -22,7 +22,7 @@
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.46 2009/10/04 12:45:23 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.47 2009/10/30 00:57:39 tg Exp $");
|
||||
|
||||
struct nesting_state {
|
||||
int start_token; /* token than began nesting (eg, FOR) */
|
||||
@ -619,11 +619,11 @@ function_body(char *name,
|
||||
/* Check for valid characters in name. POSIX and AT&T ksh93 say only
|
||||
* allow [a-zA-Z_0-9] but this allows more as old pdkshs have
|
||||
* allowed more (the following were never allowed:
|
||||
* nul space nl tab $ ' " \ ` ( ) & | ; = < >
|
||||
* C_QUOTE covers all but = and adds # [ ] ? *)
|
||||
* NUL TAB NL SP " $ & ' ( ) ; < = > \ ` |
|
||||
* C_QUOTE covers all but adds # * ? [ ]
|
||||
*/
|
||||
for (p = sname; *p; p++)
|
||||
if (ctype(*p, C_QUOTE) || *p == '=')
|
||||
if (ctype(*p, C_QUOTE))
|
||||
yyerror("%s: invalid function name\n", sname);
|
||||
|
||||
/* Note that POSIX allows only compound statements after foo(), sh and
|
||||
|
Loading…
x
Reference in New Issue
Block a user