version 1.39, 2009/07/24 14:00:59 |
version 1.43, 2009/09/16 22:17:27 |
Line 40 extern int getsubopt(char **, char * const *, char |
|
Line 40 extern int getsubopt(char **, char * const *, char |
|
# endif |
# endif |
#endif |
#endif |
|
|
typedef int (*out_mdoc)(void *, const struct mdoc *); |
typedef void (*out_mdoc)(void *, const struct mdoc *); |
typedef int (*out_man)(void *, const struct man *); |
typedef void (*out_man)(void *, const struct man *); |
typedef void (*out_free)(void *); |
typedef void (*out_free)(void *); |
|
|
struct buf { |
struct buf { |
|
|
enum outt { |
enum outt { |
OUTT_ASCII = 0, |
OUTT_ASCII = 0, |
OUTT_TREE, |
OUTT_TREE, |
|
#if 1 |
|
OUTT_HTML, |
|
#endif |
OUTT_LINT |
OUTT_LINT |
}; |
}; |
|
|
Line 85 struct curparse { |
|
Line 88 struct curparse { |
|
void *outdata; |
void *outdata; |
}; |
}; |
|
|
|
#if 1 |
|
extern void *html_alloc(void); |
|
extern void html_mdoc(void *, const struct mdoc *); |
|
extern void html_man(void *, const struct man *); |
|
extern void html_free(void *); |
|
#endif |
extern void *ascii_alloc(void); |
extern void *ascii_alloc(void); |
extern int tree_mdoc(void *, const struct mdoc *); |
extern void tree_mdoc(void *, const struct mdoc *); |
extern int tree_man(void *, const struct man *); |
extern void tree_man(void *, const struct man *); |
extern int terminal_mdoc(void *, const struct mdoc *); |
extern void terminal_mdoc(void *, const struct mdoc *); |
extern int terminal_man(void *, const struct man *); |
extern void terminal_man(void *, const struct man *); |
extern void terminal_free(void *); |
extern void terminal_free(void *); |
|
|
static int foptions(int *, char *); |
static int foptions(int *, char *); |
Line 418 fdesc(struct buf *blk, struct buf *ln, struct curparse |
|
Line 427 fdesc(struct buf *blk, struct buf *ln, struct curparse |
|
/* NOTE a parser may not have been assigned, yet. */ |
/* NOTE a parser may not have been assigned, yet. */ |
|
|
if ( ! (man || mdoc)) { |
if ( ! (man || mdoc)) { |
warnx("%s: not a manual", curp->file); |
(void)fprintf(stderr, "%s: not a manual\n", |
|
curp->file); |
return(0); |
return(0); |
} |
} |
|
|
Line 431 fdesc(struct buf *blk, struct buf *ln, struct curparse |
|
Line 441 fdesc(struct buf *blk, struct buf *ln, struct curparse |
|
|
|
if ( ! (curp->outman && curp->outmdoc)) { |
if ( ! (curp->outman && curp->outmdoc)) { |
switch (curp->outtype) { |
switch (curp->outtype) { |
|
#if 1 |
|
case (OUTT_HTML): |
|
curp->outdata = html_alloc(); |
|
curp->outman = html_man; |
|
curp->outmdoc = html_mdoc; |
|
curp->outfree = html_free; |
|
break; |
|
#endif |
case (OUTT_TREE): |
case (OUTT_TREE): |
curp->outman = tree_man; |
curp->outman = tree_man; |
curp->outmdoc = tree_mdoc; |
curp->outmdoc = tree_mdoc; |
Line 449 fdesc(struct buf *blk, struct buf *ln, struct curparse |
|
Line 467 fdesc(struct buf *blk, struct buf *ln, struct curparse |
|
/* Execute the out device, if it exists. */ |
/* Execute the out device, if it exists. */ |
|
|
if (man && curp->outman) |
if (man && curp->outman) |
if ( ! (*curp->outman)(curp->outdata, man)) |
(*curp->outman)(curp->outdata, man); |
return(-1); |
|
if (mdoc && curp->outmdoc) |
if (mdoc && curp->outmdoc) |
if ( ! (*curp->outmdoc)(curp->outdata, mdoc)) |
(*curp->outmdoc)(curp->outdata, mdoc); |
return(-1); |
|
|
|
return(1); |
return(1); |
} |
} |
Line 547 toptions(enum outt *tflags, char *arg) |
|
Line 563 toptions(enum outt *tflags, char *arg) |
|
*tflags = OUTT_LINT; |
*tflags = OUTT_LINT; |
else if (0 == strcmp(arg, "tree")) |
else if (0 == strcmp(arg, "tree")) |
*tflags = OUTT_TREE; |
*tflags = OUTT_TREE; |
|
#if 1 |
|
else if (0 == strcmp(arg, "html")) |
|
*tflags = OUTT_HTML; |
|
#endif |
else { |
else { |
warnx("bad argument: -T%s", arg); |
warnx("bad argument: -T%s", arg); |
return(0); |
return(0); |
Line 639 merr(void *arg, int line, int col, const char *msg) |
|
Line 659 merr(void *arg, int line, int col, const char *msg) |
|
|
|
curp = (struct curparse *)arg; |
curp = (struct curparse *)arg; |
|
|
warnx("%s:%d: error: %s (column %d)", |
(void)fprintf(stderr, "%s:%d:%d: error: %s\n", |
curp->file, line, msg, col); |
curp->file, line, col + 1, msg); |
|
|
return(0); |
return(0); |
} |
} |
Line 656 mwarn(void *arg, int line, int col, const char *msg) |
|
Line 676 mwarn(void *arg, int line, int col, const char *msg) |
|
if ( ! (curp->wflags & WARN_WALL)) |
if ( ! (curp->wflags & WARN_WALL)) |
return(1); |
return(1); |
|
|
warnx("%s:%d: warning: %s (column %d)", |
(void)fprintf(stderr, "%s:%d:%d: warning: %s\n", |
curp->file, line, msg, col); |
curp->file, line, col + 1, msg); |
|
|
if ( ! (curp->wflags & WARN_WERR)) |
if ( ! (curp->wflags & WARN_WERR)) |
return(1); |
return(1); |
|
|
warnx("considering warnings as errors"); |
|
return(0); |
return(0); |
} |
} |
|
|