[BACK]Return to main.c CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc

Diff for /mandoc/main.c between version 1.277 and 1.281

version 1.277, 2016/09/18 15:47:45 version 1.281, 2017/02/10 15:45:28
Line 1 
Line 1 
 /*      $Id$ */  /*      $Id$ */
 /*  /*
  * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>   * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
  * Copyright (c) 2010-2012, 2014-2016 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
Line 123  main(int argc, char *argv[])
Line 123  main(int argc, char *argv[])
         struct manpage  *res, *resp;          struct manpage  *res, *resp;
         char            *conf_file, *defpaths;          char            *conf_file, *defpaths;
         const char      *sec;          const char      *sec;
           const char      *thisarg;
         size_t           i, sz;          size_t           i, sz;
         int              prio, best_prio;          int              prio, best_prio;
         enum outmode     outmode;          enum outmode     outmode;
Line 247  main(int argc, char *argv[])
Line 248  main(int argc, char *argv[])
                         break;                          break;
                 case 'O':                  case 'O':
                         search.outkey = optarg;                          search.outkey = optarg;
                         while (optarg != NULL)                          while (optarg != NULL) {
                                 manconf_output(&conf.output,                                  thisarg = optarg;
                                     strsep(&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;
Line 531  out:
Line 537  out:
   
                         /* Stop here until moved to the foreground. */                          /* 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 != man_pgid) {
                                 if (tc_pgid == pager_pid) {                                  if (tc_pgid == pager_pid) {
                                         (void)tcsetpgrp(STDIN_FILENO,                                          (void)tcsetpgrp(tag_files->ofd,
                                             man_pgid);                                              man_pgid);
                                         if (signum == SIGTTIN)                                          if (signum == SIGTTIN)
                                                 continue;                                                  continue;
Line 547  out:
Line 553  out:
                         /* Once in the foreground, activate the pager. */                          /* Once in the foreground, activate the pager. */
   
                         if (pager_pid) {                          if (pager_pid) {
                                 (void)tcsetpgrp(STDIN_FILENO, pager_pid);                                  (void)tcsetpgrp(tag_files->ofd, pager_pid);
                                 kill(pager_pid, SIGCONT);                                  kill(pager_pid, SIGCONT);
                         } else                          } else
                                 pager_pid = spawn_pager(tag_files);                                  pager_pid = spawn_pager(tag_files);
Line 736  parse(struct curparse *curp, int fd, const char *file)
Line 742  parse(struct curparse *curp, int fd, const char *file)
         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);
Line 759  parse(struct curparse *curp, int fd, const char *file)
Line 766  parse(struct curparse *curp, int fd, const char *file)
                 }                  }
         }          }
         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);
Line 781  parse(struct curparse *curp, int fd, const char *file)
Line 789  parse(struct curparse *curp, int fd, const char *file)
                         break;                          break;
                 }                  }
         }          }
           mparse_updaterc(curp->mp, &rc);
 }  }
   
 static void  static void
Line 1075  spawn_pager(struct tag_files *tag_files)
Line 1084  spawn_pager(struct tag_files *tag_files)
                 break;                  break;
         default:          default:
                 (void)setpgid(pager_pid, 0);                  (void)setpgid(pager_pid, 0);
                 (void)tcsetpgrp(STDIN_FILENO, pager_pid);                  (void)tcsetpgrp(tag_files->ofd, pager_pid);
 #if HAVE_PLEDGE  #if HAVE_PLEDGE
                 if (pledge("stdio rpath tmppath tty proc", NULL) == -1)                  if (pledge("stdio rpath tmppath tty proc", NULL) == -1)
                         err((int)MANDOCLEVEL_SYSERR, "pledge");                          err((int)MANDOCLEVEL_SYSERR, "pledge");
Line 1093  spawn_pager(struct tag_files *tag_files)
Line 1102  spawn_pager(struct tag_files *tag_files)
   
         /* Do not start the pager before controlling the terminal. */          /* Do not start the pager before controlling the terminal. */
   
         while (tcgetpgrp(STDIN_FILENO) != getpid())          while (tcgetpgrp(STDOUT_FILENO) != getpid())
                 nanosleep(&timeout, NULL);                  nanosleep(&timeout, NULL);
   
         execvp(argv[0], argv);          execvp(argv[0], argv);

Legend:
Removed from v.1.277  
changed lines
  Added in v.1.281

CVSweb