=================================================================== RCS file: /cvs/mandoc/roff.c,v retrieving revision 1.46 retrieving revision 1.48 diff -u -p -r1.46 -r1.48 --- mandoc/roff.c 2008/12/06 19:41:41 1.46 +++ mandoc/roff.c 2008/12/07 14:38:57 1.48 @@ -1,4 +1,4 @@ -/* $Id: roff.c,v 1.46 2008/12/06 19:41:41 kristaps Exp $ */ +/* $Id: roff.c,v 1.48 2008/12/07 14:38:57 kristaps Exp $ */ /* * Copyright (c) 2008 Kristaps Dzonsons * @@ -92,7 +92,8 @@ static int roffparse(struct rofftree *, char *); static int textparse(struct rofftree *, char *); static int roffdata(struct rofftree *, int, char *); static int roffspecial(struct rofftree *, int, - const char *, size_t, char **); + const char *, const int *, + const char **, size_t, char **); static int roffsetname(struct rofftree *, char **); #ifdef __linux__ @@ -618,8 +619,9 @@ roffnode_free(struct rofftree *tree) static int -roffspecial(struct rofftree *tree, int tok, - const char *start, size_t sz, char **ordp) +roffspecial(struct rofftree *tree, int tok, const char *start, + const int *argc, const char **argv, + size_t sz, char **ordp) { switch (tok) { @@ -651,15 +653,16 @@ roffspecial(struct rofftree *tree, int tok, return(0); break; + case (ROFF_Rv): + /* FALLTHROUGH*/ case (ROFF_Sx): /* FALLTHROUGH*/ case (ROFF_Ex): - if (1 != sz) { - roff_err(tree, start, "`%s' expects one arg", - toknames[tok]); - return(0); - } - break; + if (1 == sz) + break; + roff_err(tree, start, "`%s' expects one arg", + toknames[tok]); + return(0); case (ROFF_Sm): if (1 != sz) { @@ -689,8 +692,8 @@ roffspecial(struct rofftree *tree, int tok, break; } - return((*tree->cb.roffspecial) - (tree->arg, tok, tree->cur, ordp)); + return((*tree->cb.roffspecial)(tree->arg, tok, + tree->cur, argc, argv, ordp)); } @@ -839,7 +842,7 @@ roff_Dd(ROFFCALL_ARGS) argv++; - if (0 == strcmp(*argv, "$Mdocdate: December 6 2008 $")) { + if (0 == strcmp(*argv, "$Mdocdate: December 7 2008 $")) { t = time(NULL); if (NULL == localtime_r(&t, &tree->tm)) err(1, "localtime_r"); @@ -987,7 +990,7 @@ roff_Ns(ROFFCALL_ARGS) first = (*argv++ == tree->cur); morep[0] = NULL; - if ( ! roffspecial(tree, tok, *argv, 0, morep)) + if ( ! roffspecial(tree, tok, *argv, NULL, NULL, 0, morep)) return(0); while (*argv) { @@ -1199,7 +1202,8 @@ roff_ordered(ROFFCALL_ARGS) return(0); if (NULL == *argv) - return(roffspecial(tree, tok, p, 0, ordp)); + return(roffspecial(tree, tok, p, argcp, + (const char **)argvp, 0, ordp)); i = 0; while (*argv && i < ROFF_MAXLINEARG) { @@ -1215,7 +1219,9 @@ roff_ordered(ROFFCALL_ARGS) if (ROFF_MAX == c) break; - if ( ! roffspecial(tree, tok, p, (size_t)i, ordp)) + if ( ! roffspecial(tree, tok, p, argcp, + (const char **)argvp, + (size_t)i, ordp)) return(0); return(roffcall(tree, c, argv)); @@ -1224,7 +1230,9 @@ roff_ordered(ROFFCALL_ARGS) assert(i != ROFF_MAXLINEARG); ordp[i] = NULL; - if ( ! roffspecial(tree, tok, p, (size_t)i, ordp)) + if ( ! roffspecial(tree, tok, p, argcp, + (const char**)argvp, + (size_t)i, ordp)) return(0); /* FIXME: error if there's stuff after the punctuation. */