ash: add missing casts to match CTLfoo; add TODO comments
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
This commit is contained in:
parent
5277a9db70
commit
6040fe88f4
20
shell/ash.c
20
shell/ash.c
@ -6008,7 +6008,7 @@ argstr(char *p, int flags, struct strlist *var_str_list)
|
|||||||
flags &= ~EXP_TILDE;
|
flags &= ~EXP_TILDE;
|
||||||
tilde:
|
tilde:
|
||||||
q = p;
|
q = p;
|
||||||
if (*q == CTLESC && (flags & EXP_QWORD))
|
if ((unsigned char)*q == CTLESC && (flags & EXP_QWORD))
|
||||||
q++;
|
q++;
|
||||||
if (*q == '~')
|
if (*q == '~')
|
||||||
p = exptilde(p, q, flags);
|
p = exptilde(p, q, flags);
|
||||||
@ -6071,8 +6071,8 @@ argstr(char *p, int flags, struct strlist *var_str_list)
|
|||||||
/* "$@" syntax adherence hack */
|
/* "$@" syntax adherence hack */
|
||||||
if (!inquotes
|
if (!inquotes
|
||||||
&& memcmp(p, dolatstr, 4) == 0
|
&& memcmp(p, dolatstr, 4) == 0
|
||||||
&& ( p[4] == CTLQUOTEMARK
|
&& ( p[4] == (char)CTLQUOTEMARK
|
||||||
|| (p[4] == CTLENDVAR && p[5] == CTLQUOTEMARK)
|
|| (p[4] == (char)CTLENDVAR && p[5] == (char)CTLQUOTEMARK)
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
p = evalvar(p + 1, flags, /* var_str_list: */ NULL) + 1;
|
p = evalvar(p + 1, flags, /* var_str_list: */ NULL) + 1;
|
||||||
@ -6293,8 +6293,8 @@ subevalvar(char *p, char *varname, int strloc, int subtype,
|
|||||||
int zero;
|
int zero;
|
||||||
char *(*scan)(char*, char*, char*, char*, int, int);
|
char *(*scan)(char*, char*, char*, char*, int, int);
|
||||||
|
|
||||||
//bb_error_msg("subevalvar(p:'%s',varname:'%s',strloc:%d,subtype:%d,startloc:%d,varflags:%x,quotes:%d",
|
//bb_error_msg("subevalvar(p:'%s',varname:'%s',strloc:%d,subtype:%d,startloc:%d,varflags:%x,quotes:%d)",
|
||||||
// p, varname, strloc, subtype, startloc, varflags, quotes);
|
// p, varname, strloc, subtype, startloc, varflags, quotes);
|
||||||
|
|
||||||
herefd = -1;
|
herefd = -1;
|
||||||
argstr(p, (subtype != VSASSIGN && subtype != VSQUESTION) ? EXP_CASE : 0,
|
argstr(p, (subtype != VSASSIGN && subtype != VSQUESTION) ? EXP_CASE : 0,
|
||||||
@ -6727,8 +6727,8 @@ evalvar(char *p, int flags, struct strlist *var_str_list)
|
|||||||
vsplus:
|
vsplus:
|
||||||
if (varlen < 0) {
|
if (varlen < 0) {
|
||||||
argstr(
|
argstr(
|
||||||
p, flags | EXP_TILDE |
|
p,
|
||||||
(quoted ? EXP_QWORD : EXP_WORD),
|
flags | (quoted ? EXP_TILDE|EXP_QWORD : EXP_TILDE|EXP_WORD),
|
||||||
var_str_list
|
var_str_list
|
||||||
);
|
);
|
||||||
goto end;
|
goto end;
|
||||||
@ -11039,7 +11039,6 @@ readtoken1(int c, int syntax, char *eofmark, int striptabs)
|
|||||||
startlinno = g_parsefile->linno;
|
startlinno = g_parsefile->linno;
|
||||||
bqlist = NULL;
|
bqlist = NULL;
|
||||||
quotef = 0;
|
quotef = 0;
|
||||||
oldstyle = 0;
|
|
||||||
prevsyntax = 0;
|
prevsyntax = 0;
|
||||||
#if ENABLE_ASH_EXPAND_PRMT
|
#if ENABLE_ASH_EXPAND_PRMT
|
||||||
pssyntax = (syntax == PSSYNTAX);
|
pssyntax = (syntax == PSSYNTAX);
|
||||||
@ -11445,6 +11444,8 @@ parsesub: {
|
|||||||
c = pgetc();
|
c = pgetc();
|
||||||
#if ENABLE_ASH_BASH_COMPAT
|
#if ENABLE_ASH_BASH_COMPAT
|
||||||
if (c == ':' || c == '$' || isdigit(c)) {
|
if (c == ':' || c == '$' || isdigit(c)) {
|
||||||
|
//TODO: support more general format ${v:EXPR:EXPR},
|
||||||
|
// where EXPR follows $(()) rules
|
||||||
subtype = VSSUBSTR;
|
subtype = VSSUBSTR;
|
||||||
pungetc();
|
pungetc();
|
||||||
break; /* "goto do_pungetc" is bigger (!) */
|
break; /* "goto do_pungetc" is bigger (!) */
|
||||||
@ -11472,6 +11473,9 @@ parsesub: {
|
|||||||
}
|
}
|
||||||
#if ENABLE_ASH_BASH_COMPAT
|
#if ENABLE_ASH_BASH_COMPAT
|
||||||
case '/':
|
case '/':
|
||||||
|
/* ${v/[/]pattern/repl} */
|
||||||
|
//TODO: encode pattern and repl separately.
|
||||||
|
// Currently ${v/$var_with_slash/repl} is horribly broken
|
||||||
subtype = VSREPLACE;
|
subtype = VSREPLACE;
|
||||||
c = pgetc();
|
c = pgetc();
|
||||||
if (c != '/')
|
if (c != '/')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user