}
}
-/* Return nonzero if the next token matches STR exactly.
+/* Return nonzero and advance if the next token matches STR exactly.
STR must not be NULL. */
static int
{
if (*args == NULL)
return 0;
- return strcmp (*args, str) == 0;
+ else
+ {
+ int r = strcmp (*args, str) == 0;
+ args += r;
+ return r;
+ }
}
/* Return nonzero if there no more tokens. */
if (nextarg ("("))
{
- args++;
v = eval ();
if (!nextarg (")"))
error (2, 0, _("syntax error"));
- args++;
return v;
}
#endif
if (!posixly_correct && nextarg ("quote"))
{
- args++;
if (nomoreargs ())
error (2, 0, _("syntax error"));
return str_value (*args++);
}
else if (nextarg ("length"))
{
- args++;
r = eval6 ();
tostring (r);
v = int_value (strlen (r->u.s));
}
else if (nextarg ("match"))
{
- args++;
l = eval6 ();
r = eval6 ();
v = docolon (l, r);
}
else if (nextarg ("index"))
{
- args++;
l = eval6 ();
r = eval6 ();
tostring (l);
}
else if (nextarg ("substr"))
{
- args++;
l = eval6 ();
i1 = eval6 ();
i2 = eval6 ();
{
if (nextarg (":"))
{
- args++;
r = eval6 ();
v = docolon (l, r);
freev (l);
fxn = mod;
else
return l;
- args++;
r = eval5 ();
if (!toarith (l) || !toarith (r))
error (2, 0, _("non-numeric argument"));
fxn = minus;
else
return l;
- args++;
r = eval4 ();
if (!toarith (l) || !toarith (r))
error (2, 0, _("non-numeric argument"));
fxn = greater_than;
else
return l;
- args++;
r = eval3 ();
tostring (l);
tostring (r);
{
if (nextarg ("&"))
{
- args++;
r = eval2 ();
if (null (l) || null (r))
{
{
if (nextarg ("|"))
{
- args++;
r = eval1 ();
if (null (l))
{