version 1.45, 2009/10/13 10:21:24 |
version 1.51, 2009/10/27 08:26:11 |
|
|
|
|
#include "mdoc.h" |
#include "mdoc.h" |
#include "man.h" |
#include "man.h" |
|
#include "main.h" |
|
|
#define UNCONST(a) ((void *)(uintptr_t)(const void *)(a)) |
#define UNCONST(a) ((void *)(uintptr_t)(const void *)(a)) |
|
|
|
|
|
|
#ifdef __linux__ |
#ifdef __linux__ |
extern int getsubopt(char **, char * const *, char **); |
extern int getsubopt(char **, char * const *, char **); |
|
extern size_t strlcat(char *, const char *, size_t); |
# ifndef __dead |
# ifndef __dead |
# define __dead __attribute__((__noreturn__)) |
# define __dead __attribute__((__noreturn__)) |
# endif |
# endif |
Line 87 struct curparse { |
|
Line 89 struct curparse { |
|
out_man outman; |
out_man outman; |
out_free outfree; |
out_free outfree; |
void *outdata; |
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 foptions(int *, char *); |
static int toptions(enum outt *, char *); |
static int toptions(enum outt *, char *); |
static int moptions(enum intt *, char *); |
static int moptions(enum intt *, char *); |
Line 128 main(int argc, char *argv[]) |
|
Line 119 main(int argc, char *argv[]) |
|
struct buf ln, blk; |
struct buf ln, blk; |
struct curparse curp; |
struct curparse curp; |
|
|
bzero(&curp, sizeof(struct curparse)); |
memset(&curp, 0, sizeof(struct curparse)); |
|
|
curp.inttype = INTT_AUTO; |
curp.inttype = INTT_AUTO; |
curp.outtype = OUTT_ASCII; |
curp.outtype = OUTT_ASCII; |
|
|
/* LINTED */ |
/* 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) { |
switch (c) { |
case ('f'): |
case ('f'): |
if ( ! foptions(&curp.fflags, optarg)) |
if ( ! foptions(&curp.fflags, optarg)) |
Line 144 main(int argc, char *argv[]) |
|
Line 135 main(int argc, char *argv[]) |
|
if ( ! moptions(&curp.inttype, optarg)) |
if ( ! moptions(&curp.inttype, optarg)) |
return(EXIT_FAILURE); |
return(EXIT_FAILURE); |
break; |
break; |
case ('o'): |
case ('O'): |
curp.outopts = optarg; |
(void)strlcat(curp.outopts, optarg, BUFSIZ); |
|
(void)strlcat(curp.outopts, ",", BUFSIZ); |
break; |
break; |
case ('T'): |
case ('T'): |
if ( ! toptions(&curp.outtype, optarg)) |
if ( ! toptions(&curp.outtype, optarg)) |
Line 166 main(int argc, char *argv[]) |
|
Line 158 main(int argc, char *argv[]) |
|
argc -= optind; |
argc -= optind; |
argv += optind; |
argv += optind; |
|
|
bzero(&ln, sizeof(struct buf)); |
memset(&ln, 0, sizeof(struct buf)); |
bzero(&blk, sizeof(struct buf)); |
memset(&blk, 0, sizeof(struct buf)); |
|
|
rc = 1; |
rc = 1; |
|
|
|
|
{ |
{ |
|
|
(void)fprintf(stderr, "usage: %s [-V] [-foption...] " |
(void)fprintf(stderr, "usage: %s [-V] [-foption...] " |
"[-mformat] [-Toutput] [-Werr...]\n", |
"[-mformat] [-Ooption] [-Toutput] " |
__progname); |
"[-Werr...]\n", __progname); |
exit(EXIT_FAILURE); |
exit(EXIT_FAILURE); |
} |
} |
|
|
|
|
foptions(int *fflags, char *arg) |
foptions(int *fflags, char *arg) |
{ |
{ |
char *v, *o; |
char *v, *o; |
const char *toks[7]; |
const char *toks[8]; |
|
|
toks[0] = "ign-scope"; |
toks[0] = "ign-scope"; |
toks[1] = "no-ign-escape"; |
toks[1] = "no-ign-escape"; |
Line 587 foptions(int *fflags, char *arg) |
|
Line 579 foptions(int *fflags, char *arg) |
|
toks[3] = "no-ign-chars"; |
toks[3] = "no-ign-chars"; |
toks[4] = "ign-errors"; |
toks[4] = "ign-errors"; |
toks[5] = "strict"; |
toks[5] = "strict"; |
toks[6] = NULL; |
toks[6] = "ign-escape"; |
|
toks[7] = NULL; |
|
|
while (*arg) { |
while (*arg) { |
o = arg; |
o = arg; |
Line 610 foptions(int *fflags, char *arg) |
|
Line 603 foptions(int *fflags, char *arg) |
|
case (5): |
case (5): |
*fflags |= NO_IGN_ESCAPE | |
*fflags |= NO_IGN_ESCAPE | |
NO_IGN_MACRO | NO_IGN_CHARS; |
NO_IGN_MACRO | NO_IGN_CHARS; |
|
break; |
|
case (6): |
|
*fflags &= ~NO_IGN_ESCAPE; |
break; |
break; |
default: |
default: |
warnx("bad argument: -f%s", o); |
warnx("bad argument: -f%s", o); |