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

Diff for /mandoc/mandocdb.c between version 1.246 and 1.251

version 1.246, 2017/04/24 23:06:18 version 1.251, 2017/06/24 14:38:32
Line 302  static const struct mdoc_handler __mdocs[MDOC_MAX - MD
Line 302  static const struct mdoc_handler __mdocs[MDOC_MAX - MD
         { NULL, 0, 0 },  /* En */          { NULL, 0, 0 },  /* En */
         { NULL, TYPE_Dx, NODE_NOSRC },  /* Dx */          { NULL, TYPE_Dx, NODE_NOSRC },  /* Dx */
         { NULL, 0, 0 },  /* %Q */          { NULL, 0, 0 },  /* %Q */
         { NULL, 0, 0 },  /* br */  
         { NULL, 0, 0 },  /* sp */  
         { NULL, 0, 0 },  /* %U */          { NULL, 0, 0 },  /* %U */
         { NULL, 0, 0 },  /* Ta */          { NULL, 0, 0 },  /* Ta */
         { NULL, 0, 0 },  /* ll */  
 };  };
 static  const struct mdoc_handler *const mdocs = __mdocs - MDOC_Dd;  static  const struct mdoc_handler *const mdocs = __mdocs - MDOC_Dd;
   
Line 423  mandocdb(int argc, char *argv[])
Line 420  mandocdb(int argc, char *argv[])
   
         exitcode = (int)MANDOCLEVEL_OK;          exitcode = (int)MANDOCLEVEL_OK;
         mchars_alloc();          mchars_alloc();
         mp = mparse_alloc(mparse_options, MANDOCLEVEL_BADARG, NULL, NULL);          mp = mparse_alloc(mparse_options, MANDOCLEVEL_BADARG, NULL,
               MANDOC_OS_OTHER, NULL);
         mandoc_ohash_init(&mpages, 6, offsetof(struct mpage, inodev));          mandoc_ohash_init(&mpages, 6, offsetof(struct mpage, inodev));
         mandoc_ohash_init(&mlinks, 6, offsetof(struct mlink, file));          mandoc_ohash_init(&mlinks, 6, offsetof(struct mlink, file));
   
Line 1547  parse_mdoc(struct mpage *mpage, const struct roff_meta
Line 1545  parse_mdoc(struct mpage *mpage, const struct roff_meta
 {  {
   
         for (n = n->child; n != NULL; n = n->next) {          for (n = n->child; n != NULL; n = n->next) {
                 if (n->tok == TOKEN_NONE || n->flags & mdocs[n->tok].taboo)                  if (n->tok == TOKEN_NONE ||
                       n->tok < ROFF_MAX ||
                       n->flags & mdocs[n->tok].taboo)
                         continue;                          continue;
                   assert(n->tok >= MDOC_Dd && n->tok < MDOC_MAX);
                 switch (n->type) {                  switch (n->type) {
                 case ROFFT_ELEM:                  case ROFFT_ELEM:
                 case ROFFT_BLOCK:                  case ROFFT_BLOCK:
Line 2122  dbwrite(struct dba *dba)
Line 2123  dbwrite(struct dba *dba)
         int              status;          int              status;
         pid_t            child;          pid_t            child;
   
           /*
            * Do not write empty databases, and delete existing ones
            * when makewhatis -u causes them to become empty.
            */
   
           dba_array_start(dba->pages);
           if (dba_array_next(dba->pages) == NULL) {
                   if (unlink(MANDOC_DB) == -1)
                           say(MANDOC_DB, "&unlink");
                   return;
           }
   
           /*
            * Build the database in a temporary file,
            * then atomically move it into place.
            */
   
         if (dba_write(MANDOC_DB "~", dba) != -1) {          if (dba_write(MANDOC_DB "~", dba) != -1) {
                 if (rename(MANDOC_DB "~", MANDOC_DB) == -1) {                  if (rename(MANDOC_DB "~", MANDOC_DB) == -1) {
                         exitcode = (int)MANDOCLEVEL_SYSERR;                          exitcode = (int)MANDOCLEVEL_SYSERR;
Line 2130  dbwrite(struct dba *dba)
Line 2148  dbwrite(struct dba *dba)
                 }                  }
                 return;                  return;
         }          }
   
           /*
            * We lack write permission and cannot replace the database
            * file, but let's at least check whether the data changed.
            */
   
         (void)strlcpy(tfn, "/tmp/mandocdb.XXXXXXXX", sizeof(tfn));          (void)strlcpy(tfn, "/tmp/mandocdb.XXXXXXXX", sizeof(tfn));
         if (mkdtemp(tfn) == NULL) {          if (mkdtemp(tfn) == NULL) {

Legend:
Removed from v.1.246  
changed lines
  Added in v.1.251

CVSweb