=================================================================== RCS file: /cvs/mandoc/main.c,v retrieving revision 1.44 retrieving revision 1.48 diff -u -p -r1.44 -r1.48 --- mandoc/main.c 2009/09/21 13:06:13 1.44 +++ mandoc/main.c 2009/10/26 08:18:16 1.48 @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.44 2009/09/21 13:06:13 kristaps Exp $ */ +/* $Id: main.c,v 1.48 2009/10/26 08:18:16 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -20,13 +20,17 @@ #include #include #include +#include #include #include #include #include "mdoc.h" #include "man.h" +#include "main.h" +#define UNCONST(a) ((void *)(uintptr_t)(const void *)(a)) + /* Account for FreeBSD and Linux in our declarations. */ #ifdef __linux__ @@ -87,17 +91,6 @@ struct curparse { char *outopts; }; -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 *); @@ -131,7 +124,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)) @@ -141,7 +134,7 @@ main(int argc, char *argv[]) if ( ! moptions(&curp.inttype, optarg)) return(EXIT_FAILURE); break; - case ('o'): + case ('O'): curp.outopts = optarg; break; case ('T'): @@ -228,8 +221,8 @@ usage(void) { (void)fprintf(stderr, "usage: %s [-V] [-foption...] " - "[-mformat] [-Toutput] [-Werr...]\n", - __progname); + "[-mformat] [-Ooption] [-Toutput] " + "[-Werr...]\n", __progname); exit(EXIT_FAILURE); } @@ -576,7 +569,7 @@ static int foptions(int *fflags, char *arg) { char *v, *o; - char *toks[7]; + const char *toks[7]; toks[0] = "ign-scope"; toks[1] = "no-ign-escape"; @@ -588,7 +581,7 @@ foptions(int *fflags, char *arg) while (*arg) { o = arg; - switch (getsubopt(&arg, toks, &v)) { + switch (getsubopt(&arg, UNCONST(toks), &v)) { case (0): *fflags |= IGN_SCOPE; break; @@ -622,7 +615,7 @@ static int woptions(int *wflags, char *arg) { char *v, *o; - char *toks[3]; + const char *toks[3]; toks[0] = "all"; toks[1] = "error"; @@ -630,7 +623,7 @@ woptions(int *wflags, char *arg) while (*arg) { o = arg; - switch (getsubopt(&arg, toks, &v)) { + switch (getsubopt(&arg, UNCONST(toks), &v)) { case (0): *wflags |= WARN_WALL; break;