version 1.10, 2015/02/23 15:09:09 |
version 1.11, 2015/02/23 17:24:51 |
|
|
texiexecmacro(struct texi *p, struct teximacro *m, |
texiexecmacro(struct texi *p, struct teximacro *m, |
const char *buf, size_t sz, size_t *pos) |
const char *buf, size_t sz, size_t *pos) |
{ |
{ |
size_t valsz, realsz, aasz, asz, |
size_t valsz, realsz, aasz, asz, |
ssz, i, j, k, start, end; |
ssz, i, j, k, start, end; |
char *val; |
char *val; |
char **args; |
char **args; |
|
const char *cp; |
|
|
args = argparse(p, buf, sz, pos, &asz, m->argsz); |
args = argparse(p, buf, sz, pos, &asz, m->argsz); |
if (asz != m->argsz) |
if (asz != m->argsz) |
Line 494 texiexecmacro(struct texi *p, struct teximacro *m, |
|
Line 495 texiexecmacro(struct texi *p, struct teximacro *m, |
|
texiabort(p, NULL); |
texiabort(p, NULL); |
} |
} |
|
|
j = strlcat(val, args[k], valsz + 1); |
for (cp = args[k]; '\0' != *cp; cp++) |
|
val[j++] = *cp; |
|
|
|
val[j] = '\0'; |
i = end; |
i = end; |
} |
} |
|
|
Line 1221 argparse(struct texi *p, const char *buf, |
|
Line 1225 argparse(struct texi *p, const char *buf, |
|
/* Test for zero-length '{ }'. */ |
/* Test for zero-length '{ }'. */ |
if (start == end && '}' == buf[*pos] && 0 == *argsz) |
if (start == end && '}' == buf[*pos] && 0 == *argsz) |
break; |
break; |
if (start == end) |
|
texierr(p, "zero-length argument"); |
|
/* FIXME: use reallocarray. */ |
/* FIXME: use reallocarray. */ |
args = realloc |
args = realloc |
(args, sizeof(char *) * |
(args, sizeof(char *) * |