=================================================================== RCS file: /cvs/mandoc/main.c,v retrieving revision 1.273.2.2 retrieving revision 1.273.2.5 diff -u -p -r1.273.2.2 -r1.273.2.5 --- mandoc/main.c 2016/09/18 16:13:02 1.273.2.2 +++ mandoc/main.c 2017/01/27 14:41:40 1.273.2.5 @@ -1,7 +1,7 @@ -/* $Id: main.c,v 1.273.2.2 2016/09/18 16:13:02 schwarze Exp $ */ +/* $Id: main.c,v 1.273.2.5 2017/01/27 14:41:40 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons - * Copyright (c) 2010-2012, 2014-2016 Ingo Schwarze + * Copyright (c) 2010-2012, 2014-2017 Ingo Schwarze * Copyright (c) 2010 Joerg Sonnenberger * * Permission to use, copy, modify, and distribute this software for any @@ -125,6 +125,7 @@ main(int argc, char *argv[]) struct manpage *res, *resp; char *conf_file, *defpaths; const char *sec; + const char *thisarg; size_t i, sz; int prio, best_prio; enum outmode outmode; @@ -251,9 +252,14 @@ main(int argc, char *argv[]) break; case 'O': search.outkey = optarg; - while (optarg != NULL) - manconf_output(&conf.output, - strsep(&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; case 'S': search.arch = optarg; @@ -551,10 +557,10 @@ out: /* Stop here until moved to the foreground. */ - tc_pgid = tcgetpgrp(STDIN_FILENO); + tc_pgid = tcgetpgrp(tag_files->ofd); if (tc_pgid != man_pgid) { if (tc_pgid == pager_pid) { - (void)tcsetpgrp(STDIN_FILENO, + (void)tcsetpgrp(tag_files->ofd, man_pgid); if (signum == SIGTTIN) continue; @@ -567,7 +573,7 @@ out: /* Once in the foreground, activate the pager. */ if (pager_pid) { - (void)tcsetpgrp(STDIN_FILENO, pager_pid); + (void)tcsetpgrp(tag_files->ofd, pager_pid); kill(pager_pid, SIGCONT); } else pager_pid = spawn_pager(tag_files); @@ -802,6 +808,7 @@ parse(struct curparse *curp, int fd, const char *file) break; } } + mparse_updaterc(curp->mp, &rc); } static void @@ -1096,7 +1103,7 @@ spawn_pager(struct tag_files *tag_files) break; default: (void)setpgid(pager_pid, 0); - (void)tcsetpgrp(STDIN_FILENO, pager_pid); + (void)tcsetpgrp(tag_files->ofd, pager_pid); #if HAVE_PLEDGE if (pledge("stdio rpath tmppath tty proc", NULL) == -1) err((int)MANDOCLEVEL_SYSERR, "pledge"); @@ -1114,7 +1121,7 @@ spawn_pager(struct tag_files *tag_files) /* Do not start the pager before controlling the terminal. */ - while (tcgetpgrp(STDIN_FILENO) != getpid()) + while (tcgetpgrp(STDOUT_FILENO) != getpid()) nanosleep(&timeout, NULL); execvp(argv[0], argv);