version 1.48, 2009/10/26 08:18:16 |
version 1.52, 2009/10/30 05:58:37 |
|
|
|
|
#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 88 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]; |
}; |
}; |
|
|
static int foptions(int *, char *); |
static int foptions(int *, char *); |
Line 118 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; |
Line 135 main(int argc, char *argv[]) |
|
Line 136 main(int argc, char *argv[]) |
|
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 156 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; |
|
|
Line 182 main(int argc, char *argv[]) |
|
Line 184 main(int argc, char *argv[]) |
|
argv++; |
argv++; |
if (*argv && rc) { |
if (*argv && rc) { |
if (curp.lastman) |
if (curp.lastman) |
if ( ! man_reset(curp.lastman)) |
man_reset(curp.lastman); |
rc = 0; |
|
if (curp.lastmdoc) |
if (curp.lastmdoc) |
if ( ! mdoc_reset(curp.lastmdoc)) |
mdoc_reset(curp.lastmdoc); |
rc = 0; |
|
curp.lastman = NULL; |
curp.lastman = NULL; |
curp.lastmdoc = NULL; |
curp.lastmdoc = NULL; |
} |
} |
Line 231 static struct man * |
|
Line 231 static struct man * |
|
man_init(struct curparse *curp) |
man_init(struct curparse *curp) |
{ |
{ |
int pflags; |
int pflags; |
struct man *man; |
|
struct man_cb mancb; |
struct man_cb mancb; |
|
|
mancb.man_err = merr; |
mancb.man_err = merr; |
Line 248 man_init(struct curparse *curp) |
|
Line 247 man_init(struct curparse *curp) |
|
if (curp->fflags & NO_IGN_ESCAPE) |
if (curp->fflags & NO_IGN_ESCAPE) |
pflags &= ~MAN_IGN_ESCAPE; |
pflags &= ~MAN_IGN_ESCAPE; |
|
|
if (NULL == (man = man_alloc(curp, pflags, &mancb))) |
return(man_alloc(curp, pflags, &mancb)); |
warnx("memory exhausted"); |
|
|
|
return(man); |
|
} |
} |
|
|
|
|
Line 259 static struct mdoc * |
|
Line 255 static struct mdoc * |
|
mdoc_init(struct curparse *curp) |
mdoc_init(struct curparse *curp) |
{ |
{ |
int pflags; |
int pflags; |
struct mdoc *mdoc; |
|
struct mdoc_cb mdoccb; |
struct mdoc_cb mdoccb; |
|
|
mdoccb.mdoc_err = merr; |
mdoccb.mdoc_err = merr; |
Line 278 mdoc_init(struct curparse *curp) |
|
Line 273 mdoc_init(struct curparse *curp) |
|
if (curp->fflags & NO_IGN_CHARS) |
if (curp->fflags & NO_IGN_CHARS) |
pflags &= ~MDOC_IGN_CHARS; |
pflags &= ~MDOC_IGN_CHARS; |
|
|
if (NULL == (mdoc = mdoc_alloc(curp, pflags, &mdoccb))) |
return(mdoc_alloc(curp, pflags, &mdoccb)); |
warnx("memory exhausted"); |
|
|
|
return(mdoc); |
|
} |
} |
|
|
|
|
|
|
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 577 foptions(int *fflags, char *arg) |
|
Line 569 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 600 foptions(int *fflags, char *arg) |
|
Line 593 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); |