=================================================================== RCS file: /cvs/mandoc/main.c,v retrieving revision 1.45 retrieving revision 1.50 diff -u -p -r1.45 -r1.50 --- mandoc/main.c 2009/10/13 10:21:24 1.45 +++ mandoc/main.c 2009/10/26 15:44:51 1.50 @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.45 2009/10/13 10:21:24 kristaps Exp $ */ +/* $Id: main.c,v 1.50 2009/10/26 15:44:51 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -27,6 +27,7 @@ #include "mdoc.h" #include "man.h" +#include "main.h" #define UNCONST(a) ((void *)(uintptr_t)(const void *)(a)) @@ -34,6 +35,7 @@ #ifdef __linux__ extern int getsubopt(char **, char * const *, char **); +extern size_t strlcat(char *, const char *, size_t); # ifndef __dead # define __dead __attribute__((__noreturn__)) # endif @@ -87,20 +89,9 @@ struct curparse { out_man outman; out_free outfree; void *outdata; - char *outopts; + char outopts[BUFSIZ]; }; -extern void *html_alloc(char *); -extern void html_mdoc(void *, const struct mdoc *); -extern void html_man(void *, const struct man *); -extern void html_free(void *); -extern void *ascii_alloc(void); -extern void tree_mdoc(void *, const struct mdoc *); -extern void tree_man(void *, const struct man *); -extern void terminal_mdoc(void *, const struct mdoc *); -extern void terminal_man(void *, const struct man *); -extern void terminal_free(void *); - static int foptions(int *, char *); static int toptions(enum outt *, char *); static int moptions(enum intt *, char *); @@ -134,7 +125,7 @@ main(int argc, char *argv[]) curp.outtype = OUTT_ASCII; /* LINTED */ - while (-1 != (c = getopt(argc, argv, "f:m:o:T:VW:"))) + while (-1 != (c = getopt(argc, argv, "f:m:O:T:VW:"))) switch (c) { case ('f'): if ( ! foptions(&curp.fflags, optarg)) @@ -144,8 +135,9 @@ main(int argc, char *argv[]) if ( ! moptions(&curp.inttype, optarg)) return(EXIT_FAILURE); break; - case ('o'): - curp.outopts = optarg; + case ('O'): + (void)strlcat(curp.outopts, optarg, BUFSIZ); + (void)strlcat(curp.outopts, ",", BUFSIZ); break; case ('T'): if ( ! toptions(&curp.outtype, optarg)) @@ -231,8 +223,8 @@ usage(void) { (void)fprintf(stderr, "usage: %s [-V] [-foption...] " - "[-mformat] [-Toutput] [-Werr...]\n", - __progname); + "[-mformat] [-Ooption] [-Toutput] " + "[-Werr...]\n", __progname); exit(EXIT_FAILURE); } @@ -579,7 +571,7 @@ static int foptions(int *fflags, char *arg) { char *v, *o; - const char *toks[7]; + const char *toks[8]; toks[0] = "ign-scope"; toks[1] = "no-ign-escape"; @@ -587,7 +579,8 @@ foptions(int *fflags, char *arg) toks[3] = "no-ign-chars"; toks[4] = "ign-errors"; toks[5] = "strict"; - toks[6] = NULL; + toks[6] = "ign-escape"; + toks[7] = NULL; while (*arg) { o = arg; @@ -610,6 +603,9 @@ foptions(int *fflags, char *arg) case (5): *fflags |= NO_IGN_ESCAPE | NO_IGN_MACRO | NO_IGN_CHARS; + break; + case (6): + *fflags &= ~NO_IGN_ESCAPE; break; default: warnx("bad argument: -f%s", o);