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

Diff for /mandoc/mdoc_validate.c between version 1.385 and 1.391

version 1.385, 2020/04/18 20:40:10 version 1.391, 2022/06/08 16:31:46
Line 1 
Line 1 
 /* $Id$ */  /* $Id$ */
 /*  /*
  * Copyright (c) 2010-2020 Ingo Schwarze <schwarze@openbsd.org>   * Copyright (c) 2010-2021 Ingo Schwarze <schwarze@openbsd.org>
  * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>   * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
  * Copyright (c) 2010 Joerg Sonnenberger <joerg@netbsd.org>   * Copyright (c) 2010 Joerg Sonnenberger <joerg@netbsd.org>
  *   *
Line 92  static void  post_es(POST_ARGS);
Line 92  static void  post_es(POST_ARGS);
 static  void     post_eoln(POST_ARGS);  static  void     post_eoln(POST_ARGS);
 static  void     post_ex(POST_ARGS);  static  void     post_ex(POST_ARGS);
 static  void     post_fa(POST_ARGS);  static  void     post_fa(POST_ARGS);
   static  void     post_fl(POST_ARGS);
 static  void     post_fn(POST_ARGS);  static  void     post_fn(POST_ARGS);
 static  void     post_fname(POST_ARGS);  static  void     post_fname(POST_ARGS);
 static  void     post_fo(POST_ARGS);  static  void     post_fo(POST_ARGS);
Line 150  static const v_post mdoc_valids[MDOC_MAX - MDOC_Dd] = 
Line 151  static const v_post mdoc_valids[MDOC_MAX - MDOC_Dd] = 
         post_ex,        /* Ex */          post_ex,        /* Ex */
         post_fa,        /* Fa */          post_fa,        /* Fa */
         NULL,           /* Fd */          NULL,           /* Fd */
         post_tag,       /* Fl */          post_fl,        /* Fl */
         post_fn,        /* Fn */          post_fn,        /* Fn */
         post_delim_nb,  /* Ft */          post_delim_nb,  /* Ft */
         post_tag,       /* Ic */          post_tag,       /* Ic */
Line 163  static const v_post mdoc_valids[MDOC_MAX - MDOC_Dd] = 
Line 164  static const v_post mdoc_valids[MDOC_MAX - MDOC_Dd] = 
         post_defaults,  /* Pa */          post_defaults,  /* Pa */
         post_rv,        /* Rv */          post_rv,        /* Rv */
         post_st,        /* St */          post_st,        /* St */
         post_delim_nb,  /* Va */          post_tag,       /* Va */
         post_delim_nb,  /* Vt */          post_delim_nb,  /* Vt */
         post_xr,        /* Xr */          post_xr,        /* Xr */
         NULL,           /* %A */          NULL,           /* %A */
Line 1112  post_tg(POST_ARGS)
Line 1113  post_tg(POST_ARGS)
         /* Find the next node. */          /* Find the next node. */
         n = mdoc->last;          n = mdoc->last;
         for (nn = n; nn != NULL; nn = nn->parent) {          for (nn = n; nn != NULL; nn = nn->parent) {
                 if (nn->next != NULL) {                  if (nn->type != ROFFT_HEAD && nn->type != ROFFT_BODY &&
                       nn->type != ROFFT_TAIL && nn->next != NULL) {
                         nn = nn->next;                          nn = nn->next;
                         break;                          break;
                 }                  }
Line 1628  post_es(POST_ARGS)
Line 1630  post_es(POST_ARGS)
 }  }
   
 static void  static void
   post_fl(POST_ARGS)
   {
           struct roff_node        *n;
           char                    *cp;
   
           /*
            * Transform ".Fl Fl long" to ".Fl \-long",
            * resulting for example in better HTML output.
            */
   
           n = mdoc->last;
           if (n->prev != NULL && n->prev->tok == MDOC_Fl &&
               n->prev->child == NULL && n->child != NULL &&
               (n->flags & NODE_LINE) == 0) {
                   mandoc_asprintf(&cp, "\\-%s", n->child->string);
                   free(n->child->string);
                   n->child->string = cp;
                   roff_node_delete(mdoc, n->prev);
           }
           post_tag(mdoc);
   }
   
   static void
 post_xx(POST_ARGS)  post_xx(POST_ARGS)
 {  {
         struct roff_node        *n;          struct roff_node        *n;
Line 2593  post_section(POST_ARGS)
Line 2618  post_section(POST_ARGS)
                         if ((nch = n->child) != NULL &&                          if ((nch = n->child) != NULL &&
                             nch->type == ROFFT_TEXT &&                              nch->type == ROFFT_TEXT &&
                             strcmp(nch->string, tag) == 0)                              strcmp(nch->string, tag) == 0)
                                 tag_put(NULL, TAG_WEAK, n);                                  tag_put(NULL, TAG_STRONG, n);
                         else                          else
                                 tag_put(tag, TAG_FALLBACK, n);                                  tag_put(tag, TAG_FALLBACK, n);
                         free(tag);                          free(tag);
Line 2765  post_dt(POST_ARGS)
Line 2790  post_dt(POST_ARGS)
                 mandoc_msg(MANDOCERR_MSEC_BAD,                  mandoc_msg(MANDOCERR_MSEC_BAD,
                     nn->line, nn->pos, "Dt ... %s", nn->string);                      nn->line, nn->pos, "Dt ... %s", nn->string);
                 mdoc->meta.vol = mandoc_strdup(nn->string);                  mdoc->meta.vol = mandoc_strdup(nn->string);
         } else          } else {
                 mdoc->meta.vol = mandoc_strdup(cp);                  mdoc->meta.vol = mandoc_strdup(cp);
                   if (mdoc->filesec != '\0' &&
                       mdoc->filesec != *nn->string &&
                       *nn->string >= '1' && *nn->string <= '9')
                           mandoc_msg(MANDOCERR_MSEC_FILE, nn->line, nn->pos,
                               "*.%c vs Dt ... %c", mdoc->filesec, *nn->string);
           }
   
         /* Optional third argument: architecture. */          /* Optional third argument: architecture. */
   
Line 2842  post_os(POST_ARGS)
Line 2873  post_os(POST_ARGS)
 {  {
 #ifndef OSNAME  #ifndef OSNAME
         struct utsname    utsname;          struct utsname    utsname;
         static char      *defbuf;  
 #endif  #endif
         struct roff_node *n;          struct roff_node *n;
   
Line 2879  post_os(POST_ARGS)
Line 2909  post_os(POST_ARGS)
 #ifdef OSNAME  #ifdef OSNAME
         mdoc->meta.os = mandoc_strdup(OSNAME);          mdoc->meta.os = mandoc_strdup(OSNAME);
 #else /*!OSNAME */  #else /*!OSNAME */
         if (defbuf == NULL) {          if (mdoc->os_r == NULL) {
                 if (uname(&utsname) == -1) {                  if (uname(&utsname) == -1) {
                         mandoc_msg(MANDOCERR_OS_UNAME, n->line, n->pos, "Os");                          mandoc_msg(MANDOCERR_OS_UNAME, n->line, n->pos, "Os");
                         defbuf = mandoc_strdup("UNKNOWN");                          mdoc->os_r = mandoc_strdup("UNKNOWN");
                 } else                  } else
                         mandoc_asprintf(&defbuf, "%s %s",                          mandoc_asprintf(&mdoc->os_r, "%s %s",
                             utsname.sysname, utsname.release);                              utsname.sysname, utsname.release);
         }          }
         mdoc->meta.os = mandoc_strdup(defbuf);          mdoc->meta.os = mandoc_strdup(mdoc->os_r);
 #endif /*!OSNAME*/  #endif /*!OSNAME*/
   
 out:  out:

Legend:
Removed from v.1.385  
changed lines
  Added in v.1.391

CVSweb