=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/tbl_opts.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- src/usr.bin/mandoc/tbl_opts.c 2011/04/24 16:22:02 1.4 +++ src/usr.bin/mandoc/tbl_opts.c 2014/04/20 16:44:44 1.5 @@ -1,4 +1,4 @@ -/* $Id: tbl_opts.c,v 1.4 2011/04/24 16:22:02 schwarze Exp $ */ +/* $Id: tbl_opts.c,v 1.5 2014/04/20 16:44:44 schwarze Exp $ */ /* * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons * @@ -58,10 +58,10 @@ static const struct tbl_phrase keys[KEY_MAXKEYS] = { { "center", TBL_OPT_CENTRE, KEY_CENTRE}, { "centre", TBL_OPT_CENTRE, KEY_CENTRE}, - { "delim", 0, KEY_DELIM}, + { "delim", 0, KEY_DELIM}, { "expand", TBL_OPT_EXPAND, KEY_EXPAND}, - { "box", TBL_OPT_BOX, KEY_BOX}, - { "doublebox", TBL_OPT_DBOX, KEY_DBOX}, + { "box", TBL_OPT_BOX, KEY_BOX}, + { "doublebox", TBL_OPT_DBOX, KEY_DBOX}, { "allbox", TBL_OPT_ALLBOX, KEY_ALLBOX}, { "frame", TBL_OPT_BOX, KEY_FRAME}, { "doubleframe", TBL_OPT_DBOX, KEY_DFRAME}, @@ -72,11 +72,12 @@ { "nospaces", TBL_OPT_NOSPACE, KEY_NOSPACE}, }; -static int arg(struct tbl_node *, int, +static int arg(struct tbl_node *, int, const char *, int *, enum tbl_ident); -static void opt(struct tbl_node *, int, +static void opt(struct tbl_node *, int, const char *, int *); + static int arg(struct tbl_node *tbl, int ln, const char *p, int *pos, enum tbl_ident key) { @@ -89,8 +90,8 @@ /* Arguments always begin with a parenthesis. */ if ('(' != p[*pos]) { - mandoc_msg(MANDOCERR_TBL, tbl->parse, - ln, *pos, NULL); + mandoc_msg(MANDOCERR_TBL, tbl->parse, + ln, *pos, NULL); return(0); } @@ -103,27 +104,27 @@ */ switch (key) { - case (KEY_DELIM): + case KEY_DELIM: if ('\0' == p[(*pos)++]) { mandoc_msg(MANDOCERR_TBL, tbl->parse, - ln, *pos - 1, NULL); + ln, *pos - 1, NULL); return(0); - } + } if ('\0' == p[(*pos)++]) { mandoc_msg(MANDOCERR_TBL, tbl->parse, - ln, *pos - 1, NULL); + ln, *pos - 1, NULL); return(0); - } + } break; - case (KEY_TAB): + case KEY_TAB: if ('\0' != (tbl->opts.tab = p[(*pos)++])) break; mandoc_msg(MANDOCERR_TBL, tbl->parse, - ln, *pos - 1, NULL); + ln, *pos - 1, NULL); return(0); - case (KEY_LINESIZE): + case KEY_LINESIZE: for (i = 0; i < KEY_MAXNUMSZ && p[*pos]; i++, (*pos)++) { buf[i] = p[*pos]; if ( ! isdigit((unsigned char)buf[i])) @@ -138,12 +139,12 @@ mandoc_msg(MANDOCERR_TBL, tbl->parse, ln, *pos, NULL); return(0); - case (KEY_DPOINT): + case KEY_DPOINT: if ('\0' != (tbl->opts.decimal = p[(*pos)++])) break; - mandoc_msg(MANDOCERR_TBL, tbl->parse, - ln, *pos - 1, NULL); + mandoc_msg(MANDOCERR_TBL, tbl->parse, + ln, *pos - 1, NULL); return(0); default: abort(); @@ -178,7 +179,7 @@ * options ::= option_list [:space:]* [;][\n] * option_list ::= option option_tail * option_tail ::= [:space:]+ option_list | - * ::= epsilon + * ::= epsilon * option ::= [:alpha:]+ args * args ::= [:space:]* [(] [:alpha:]+ [)] */ @@ -211,7 +212,7 @@ while (isspace((unsigned char)p[*pos])) (*pos)++; - /* + /* * Look through all of the available keys to find one that * matches the input. FIXME: hashtable this. */ @@ -227,7 +228,7 @@ * of the sequence altogether. */ - if (keys[i].key) + if (keys[i].key) tbl->opts.opts |= keys[i].key; else if ( ! arg(tbl, ln, p, pos, keys[i].ident)) return; @@ -235,7 +236,7 @@ break; } - /* + /* * Allow us to recover from bad options by continuing to another * parse sequence. */