"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "main.c" between
mdocml-1.14.1rc1.tar.gz and mdocml-1.14.1rc2.tar.gz

About: mdocml is a suite of tools compiling "-mdoc", the roff macro package of choice for BSD manual pages, and "-man", the predominant historical package for UNIX manuals. Hint: The installed binary name is "mandoc". Release candidate.

main.c  (mdocml-1.14.1rc1):main.c  (mdocml-1.14.1rc2)
/* $Id: main.c,v 1.280 2017/01/27 13:47:10 schwarze Exp $ */ /* $Id: main.c,v 1.283 2017/02/17 14:31:52 schwarze Exp $ */
/* /*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2012, 2014-2017 Ingo Schwarze <schwarze@openbsd.org> * Copyright (c) 2010-2012, 2014-2017 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2010 Joerg Sonnenberger <joerg@netbsd.org> * Copyright (c) 2010 Joerg Sonnenberger <joerg@netbsd.org>
* *
* Permission to use, copy, modify, and distribute this software for any * Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies. * copyright notice and this permission notice appear in all copies.
* *
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
skipping to change at line 102 skipping to change at line 102
struct manpage **, size_t *); struct manpage **, size_t *);
static int koptions(int *, char *); static int koptions(int *, char *);
static int moptions(int *, char *); static int moptions(int *, char *);
static void mmsg(enum mandocerr, enum mandoclevel, static void mmsg(enum mandocerr, enum mandoclevel,
const char *, int, int, const char *); const char *, int, int, const char *);
static void outdata_alloc(struct curparse *); static void outdata_alloc(struct curparse *);
static void parse(struct curparse *, int, const char *); static void parse(struct curparse *, int, const char *);
static void passthrough(const char *, int, int); static void passthrough(const char *, int, int);
static pid_t spawn_pager(struct tag_files *); static pid_t spawn_pager(struct tag_files *);
static int toptions(struct curparse *, char *); static int toptions(struct curparse *, char *);
static void usage(enum argmode) __attribute__((noreturn)); static void usage(enum argmode) __attribute__((__noreturn__));
static int woptions(struct curparse *, char *); static int woptions(struct curparse *, char *);
static const int sec_prios[] = {1, 4, 5, 8, 6, 3, 7, 2, 9}; static const int sec_prios[] = {1, 4, 5, 8, 6, 3, 7, 2, 9};
static char help_arg[] = "help"; static char help_arg[] = "help";
static char *help_argv[] = {help_arg, NULL}; static char *help_argv[] = {help_arg, NULL};
static enum mandoclevel rc; static enum mandoclevel rc;
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
struct manconf conf; struct manconf conf;
struct curparse curp;
struct mansearch search; struct mansearch search;
struct curparse curp;
struct tag_files *tag_files; struct tag_files *tag_files;
const char *progname;
char *auxpaths;
char *defos;
unsigned char *uc;
struct manpage *res, *resp; struct manpage *res, *resp;
char *conf_file, *defpaths; const char *progname, *sec, *thisarg;
const char *sec; char *conf_file, *defpaths, *auxpaths;
const char *thisarg; char *defos, *oarg;
unsigned char *uc;
size_t i, sz; size_t i, sz;
int prio, best_prio; int prio, best_prio;
enum outmode outmode; enum outmode outmode;
int fd; int fd;
int show_usage; int show_usage;
int options; int options;
int use_pager; int use_pager;
int status, signum; int status, signum;
int c; int c;
pid_t pager_pid, tc_pgid, man_pgid, pid; pid_t pager_pid, tc_pgid, man_pgid, pid;
skipping to change at line 170 skipping to change at line 167
#endif #endif
/* Search options. */ /* Search options. */
memset(&conf, 0, sizeof(conf)); memset(&conf, 0, sizeof(conf));
conf_file = defpaths = NULL; conf_file = defpaths = NULL;
auxpaths = NULL; auxpaths = NULL;
memset(&search, 0, sizeof(struct mansearch)); memset(&search, 0, sizeof(struct mansearch));
search.outkey = "Nd"; search.outkey = "Nd";
oarg = NULL;
if (strcmp(progname, BINM_MAN) == 0) if (strcmp(progname, BINM_MAN) == 0)
search.argmode = ARG_NAME; search.argmode = ARG_NAME;
else if (strcmp(progname, BINM_APROPOS) == 0) else if (strcmp(progname, BINM_APROPOS) == 0)
search.argmode = ARG_EXPR; search.argmode = ARG_EXPR;
else if (strcmp(progname, BINM_WHATIS) == 0) else if (strcmp(progname, BINM_WHATIS) == 0)
search.argmode = ARG_WORD; search.argmode = ARG_WORD;
else if (strncmp(progname, "help", 4) == 0) else if (strncmp(progname, "help", 4) == 0)
search.argmode = ARG_NAME; search.argmode = ARG_NAME;
else else
skipping to change at line 248 skipping to change at line 246
search.argmode = ARG_FILE; search.argmode = ARG_FILE;
outmode = OUTMODE_ALL; outmode = OUTMODE_ALL;
break; break;
case 'M': case 'M':
defpaths = optarg; defpaths = optarg;
break; break;
case 'm': case 'm':
auxpaths = optarg; auxpaths = optarg;
break; break;
case 'O': case 'O':
search.outkey = optarg; oarg = optarg;
while (optarg != NULL) {
thisarg = optarg;
if (manconf_output(&conf.output,
strsep(&optarg, ","), 0) == 0)
continue;
warnx("-O %s: Bad argument", thisarg);
return (int)MANDOCLEVEL_BADARG;
}
break; break;
case 'S': case 'S':
search.arch = optarg; search.arch = optarg;
break; break;
case 's': case 's':
search.sec = optarg; search.sec = optarg;
break; break;
case 'T': case 'T':
if ( ! toptions(&curp, optarg)) if ( ! toptions(&curp, optarg))
return (int)MANDOCLEVEL_BADARG; return (int)MANDOCLEVEL_BADARG;
skipping to change at line 301 skipping to change at line 291
break; break;
case ARG_NAME: case ARG_NAME:
outmode = OUTMODE_ONE; outmode = OUTMODE_ONE;
break; break;
default: default:
outmode = OUTMODE_LST; outmode = OUTMODE_LST;
break; break;
} }
} }
if (oarg != NULL) {
if (outmode == OUTMODE_LST)
search.outkey = oarg;
else {
while (oarg != NULL) {
thisarg = oarg;
if (manconf_output(&conf.output,
strsep(&oarg, ","), 0) == 0)
continue;
warnx("-O %s: Bad argument", thisarg);
return (int)MANDOCLEVEL_BADARG;
}
}
}
if (outmode == OUTMODE_FLN || if (outmode == OUTMODE_FLN ||
outmode == OUTMODE_LST || outmode == OUTMODE_LST ||
!isatty(STDOUT_FILENO)) !isatty(STDOUT_FILENO))
use_pager = 0; use_pager = 0;
#if HAVE_PLEDGE #if HAVE_PLEDGE
if (!use_pager) if (!use_pager)
if (pledge("stdio rpath flock", NULL) == -1) if (pledge("stdio rpath flock", NULL) == -1)
err((int)MANDOCLEVEL_SYSERR, "pledge"); err((int)MANDOCLEVEL_SYSERR, "pledge");
#endif #endif
skipping to change at line 743 skipping to change at line 748
if (curp->outdata == NULL) if (curp->outdata == NULL)
outdata_alloc(curp); outdata_alloc(curp);
mparse_result(curp->mp, &man, NULL); mparse_result(curp->mp, &man, NULL);
/* Execute the out device, if it exists. */ /* Execute the out device, if it exists. */
if (man == NULL) if (man == NULL)
return; return;
if (man->macroset == MACROSET_MDOC) { if (man->macroset == MACROSET_MDOC) {
mdoc_validate(man); if (curp->outtype != OUTT_TREE || !curp->outopts->noval)
mdoc_validate(man);
switch (curp->outtype) { switch (curp->outtype) {
case OUTT_HTML: case OUTT_HTML:
html_mdoc(curp->outdata, man); html_mdoc(curp->outdata, man);
break; break;
case OUTT_TREE: case OUTT_TREE:
tree_mdoc(curp->outdata, man); tree_mdoc(curp->outdata, man);
break; break;
case OUTT_MAN: case OUTT_MAN:
man_mdoc(curp->outdata, man); man_mdoc(curp->outdata, man);
break; break;
skipping to change at line 766 skipping to change at line 772
case OUTT_UTF8: case OUTT_UTF8:
case OUTT_LOCALE: case OUTT_LOCALE:
case OUTT_PS: case OUTT_PS:
terminal_mdoc(curp->outdata, man); terminal_mdoc(curp->outdata, man);
break; break;
default: default:
break; break;
} }
} }
if (man->macroset == MACROSET_MAN) { if (man->macroset == MACROSET_MAN) {
man_validate(man); if (curp->outtype != OUTT_TREE || !curp->outopts->noval)
man_validate(man);
switch (curp->outtype) { switch (curp->outtype) {
case OUTT_HTML: case OUTT_HTML:
html_man(curp->outdata, man); html_man(curp->outdata, man);
break; break;
case OUTT_TREE: case OUTT_TREE:
tree_man(curp->outdata, man); tree_man(curp->outdata, man);
break; break;
case OUTT_MAN: case OUTT_MAN:
man_man(curp->outdata, man); man_man(curp->outdata, man);
break; break;
 End of changes. 11 change blocks. 
21 lines changed or deleted 28 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS