mirror of
https://github.com/sheumann/hush.git
synced 2024-12-21 23:29:34 +00:00
ash: comment about [[; code style fixes. No code changes.
This commit is contained in:
parent
68e5e2b1c7
commit
f7d5665969
40
shell/ash.c
40
shell/ash.c
@ -2230,7 +2230,8 @@ padvance(const char **path, const char *name)
|
|||||||
if (*path == NULL)
|
if (*path == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
start = *path;
|
start = *path;
|
||||||
for (p = start; *p && *p != ':' && *p != '%'; p++);
|
for (p = start; *p && *p != ':' && *p != '%'; p++)
|
||||||
|
continue;
|
||||||
len = p - start + strlen(name) + 2; /* "2" is for '/' and '\0' */
|
len = p - start + strlen(name) + 2; /* "2" is for '/' and '\0' */
|
||||||
while (stackblocksize() < len)
|
while (stackblocksize() < len)
|
||||||
growstackblock();
|
growstackblock();
|
||||||
@ -2244,7 +2245,8 @@ padvance(const char **path, const char *name)
|
|||||||
pathopt = NULL;
|
pathopt = NULL;
|
||||||
if (*p == '%') {
|
if (*p == '%') {
|
||||||
pathopt = ++p;
|
pathopt = ++p;
|
||||||
while (*p && *p != ':') p++;
|
while (*p && *p != ':')
|
||||||
|
p++;
|
||||||
}
|
}
|
||||||
if (*p == ':')
|
if (*p == ':')
|
||||||
*path = p + 1;
|
*path = p + 1;
|
||||||
@ -8427,7 +8429,7 @@ static int exportcmd(int, char **);
|
|||||||
static int getoptscmd(int, char **);
|
static int getoptscmd(int, char **);
|
||||||
#endif
|
#endif
|
||||||
#if !ENABLE_FEATURE_SH_EXTRA_QUIET
|
#if !ENABLE_FEATURE_SH_EXTRA_QUIET
|
||||||
static int helpcmd(int argc, char **argv);
|
static int helpcmd(int, char **);
|
||||||
#endif
|
#endif
|
||||||
#if ENABLE_ASH_MATH_SUPPORT
|
#if ENABLE_ASH_MATH_SUPPORT
|
||||||
static int letcmd(int, char **);
|
static int letcmd(int, char **);
|
||||||
@ -8450,7 +8452,19 @@ static int ulimitcmd(int, char **);
|
|||||||
#define BUILTIN_REG_ASSG "6"
|
#define BUILTIN_REG_ASSG "6"
|
||||||
#define BUILTIN_SPEC_REG_ASSG "7"
|
#define BUILTIN_SPEC_REG_ASSG "7"
|
||||||
|
|
||||||
/* make sure to keep these in proper order since it is searched via bsearch() */
|
/* We do not handle [[ expr ]] bashism bash-compatibly,
|
||||||
|
* we make it a synonym of [ expr ].
|
||||||
|
* Basically, word splitting and pathname expansion should NOT be performed
|
||||||
|
* Examples:
|
||||||
|
* no word splitting: a="a b"; [[ $a = "a b" ]]; echo $? should print "0"
|
||||||
|
* no pathname expansion: [[ /bin/m* = "/bin/m*" ]]; echo $? should print "0"
|
||||||
|
* Additional operators:
|
||||||
|
* || and && should work as -o and -a
|
||||||
|
* =~ regexp match
|
||||||
|
* Apart from the above, [[ expr ]] should work as [ expr ]
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Keep these in proper order since it is searched via bsearch() */
|
||||||
static const struct builtincmd builtintab[] = {
|
static const struct builtincmd builtintab[] = {
|
||||||
{ BUILTIN_SPEC_REG ".", dotcmd },
|
{ BUILTIN_SPEC_REG ".", dotcmd },
|
||||||
{ BUILTIN_SPEC_REG ":", truecmd },
|
{ BUILTIN_SPEC_REG ":", truecmd },
|
||||||
@ -9339,7 +9353,8 @@ chkmail(void)
|
|||||||
break;
|
break;
|
||||||
if (*p == '\0')
|
if (*p == '\0')
|
||||||
continue;
|
continue;
|
||||||
for (q = p; *q; q++);
|
for (q = p; *q; q++)
|
||||||
|
continue;
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
if (q[-1] != '/')
|
if (q[-1] != '/')
|
||||||
abort();
|
abort();
|
||||||
@ -9382,7 +9397,8 @@ setparam(char **argv)
|
|||||||
char **ap;
|
char **ap;
|
||||||
int nparam;
|
int nparam;
|
||||||
|
|
||||||
for (nparam = 0; argv[nparam]; nparam++);
|
for (nparam = 0; argv[nparam]; nparam++)
|
||||||
|
continue;
|
||||||
ap = newparam = ckmalloc((nparam + 1) * sizeof(*ap));
|
ap = newparam = ckmalloc((nparam + 1) * sizeof(*ap));
|
||||||
while (*argv) {
|
while (*argv) {
|
||||||
*ap++ = ckstrdup(*argv++);
|
*ap++ = ckstrdup(*argv++);
|
||||||
@ -9531,7 +9547,8 @@ shiftcmd(int argc ATTRIBUTE_UNUSED, char **argv)
|
|||||||
free(*ap1);
|
free(*ap1);
|
||||||
}
|
}
|
||||||
ap2 = shellparam.p;
|
ap2 = shellparam.p;
|
||||||
while ((*ap2++ = *ap1++) != NULL);
|
while ((*ap2++ = *ap1++) != NULL)
|
||||||
|
continue;
|
||||||
#if ENABLE_ASH_GETOPTS
|
#if ENABLE_ASH_GETOPTS
|
||||||
shellparam.optind = 1;
|
shellparam.optind = 1;
|
||||||
shellparam.optoff = -1;
|
shellparam.optoff = -1;
|
||||||
@ -10563,7 +10580,8 @@ checkend: {
|
|||||||
char *p, *q;
|
char *p, *q;
|
||||||
|
|
||||||
p = line;
|
p = line;
|
||||||
for (q = eofmark + 1; *q && *p == *q; p++, q++);
|
for (q = eofmark + 1; *q && *p == *q; p++, q++)
|
||||||
|
continue;
|
||||||
if (*p == '\n' && *q == '\0') {
|
if (*p == '\n' && *q == '\0') {
|
||||||
c = PEOF;
|
c = PEOF;
|
||||||
plinno++;
|
plinno++;
|
||||||
@ -11004,7 +11022,8 @@ xxreadtoken(void)
|
|||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
if (c == '#') {
|
if (c == '#') {
|
||||||
while ((c = pgetc()) != '\n' && c != PEOF);
|
while ((c = pgetc()) != '\n' && c != PEOF)
|
||||||
|
continue;
|
||||||
pungetc();
|
pungetc();
|
||||||
} else if (c == '\\') {
|
} else if (c == '\\') {
|
||||||
if (pgetc() != '\n') {
|
if (pgetc() != '\n') {
|
||||||
@ -11067,7 +11086,8 @@ xxreadtoken(void)
|
|||||||
#endif
|
#endif
|
||||||
continue;
|
continue;
|
||||||
case '#':
|
case '#':
|
||||||
while ((c = pgetc()) != '\n' && c != PEOF);
|
while ((c = pgetc()) != '\n' && c != PEOF)
|
||||||
|
continue;
|
||||||
pungetc();
|
pungetc();
|
||||||
continue;
|
continue;
|
||||||
case '\\':
|
case '\\':
|
||||||
|
Loading…
Reference in New Issue
Block a user