[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.197 and 1.204

version 1.197, 2013/10/21 23:47:58 version 1.204, 2014/03/23 12:11:18
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, 2011, 2012, 2013 Ingo Schwarze <schwarze@openbsd.org>   * Copyright (c) 2010-2014 Ingo Schwarze <schwarze@openbsd.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
Line 35 
Line 36 
   
 #include "mdoc.h"  #include "mdoc.h"
 #include "mandoc.h"  #include "mandoc.h"
   #include "mandoc_aux.h"
 #include "libmdoc.h"  #include "libmdoc.h"
 #include "libmandoc.h"  #include "libmandoc.h"
   
Line 1893  post_hyph(POST_ARGS)
Line 1895  post_hyph(POST_ARGS)
                 if (MDOC_TEXT != nch->type)                  if (MDOC_TEXT != nch->type)
                         continue;                          continue;
                 cp = nch->string;                  cp = nch->string;
                 if (3 > strnlen(cp, 3))                  if ('\0' == *cp)
                         continue;                          continue;
                 while ('\0' != *(++cp))                  while ('\0' != *(++cp))
                         if ('-' == *cp &&                          if ('-' == *cp &&
Line 1991  post_sh_head(POST_ARGS)
Line 1993  post_sh_head(POST_ARGS)
         /* The SYNOPSIS gets special attention in other areas. */          /* The SYNOPSIS gets special attention in other areas. */
   
         if (SEC_SYNOPSIS == sec) {          if (SEC_SYNOPSIS == sec) {
                 roff_setreg(mdoc->roff, "nS", 1);                  roff_setreg(mdoc->roff, "nS", 1, '=');
                 mdoc->flags |= MDOC_SYNOPSIS;                  mdoc->flags |= MDOC_SYNOPSIS;
         } else {          } else {
                 roff_setreg(mdoc->roff, "nS", 0);                  roff_setreg(mdoc->roff, "nS", 0, '=');
                 mdoc->flags &= ~MDOC_SYNOPSIS;                  mdoc->flags &= ~MDOC_SYNOPSIS;
         }          }
   
Line 2183  post_dd(POST_ARGS)
Line 2185  post_dd(POST_ARGS)
   
         n = mdoc->last;          n = mdoc->last;
         if (NULL == n->child || '\0' == n->child->string[0]) {          if (NULL == n->child || '\0' == n->child->string[0]) {
                 mdoc->meta.date = mandoc_normdate                  mdoc->meta.date = mdoc->quick ? mandoc_strdup("") :
                         (mdoc->parse, NULL, n->line, n->pos);                      mandoc_normdate(mdoc->parse, NULL, n->line, n->pos);
                 return(1);                  return(1);
         }          }
   
Line 2195  post_dd(POST_ARGS)
Line 2197  post_dd(POST_ARGS)
         }          }
   
         assert(c);          assert(c);
         mdoc->meta.date = mandoc_normdate          mdoc->meta.date = mdoc->quick ? mandoc_strdup(buf) :
                 (mdoc->parse, buf, n->line, n->pos);              mandoc_normdate(mdoc->parse, buf, n->line, n->pos);
   
         return(1);          return(1);
 }  }
Line 2347  post_bx(POST_ARGS)
Line 2349  post_bx(POST_ARGS)
 static int  static int
 post_os(POST_ARGS)  post_os(POST_ARGS)
 {  {
         struct mdoc_node *n;  
         char              buf[BUFSIZ];          char              buf[BUFSIZ];
         int               c;  
 #ifndef OSNAME  #ifndef OSNAME
         struct utsname    utsname;          struct utsname    utsname;
           static char      *defbuf;
 #endif  #endif
           struct mdoc_node *n;
           int               c;
   
         n = mdoc->last;          n = mdoc->last;
   
Line 2375  post_os(POST_ARGS)
Line 2378  post_os(POST_ARGS)
   
         assert(c);          assert(c);
   
         if ('\0' == buf[0]) {          if ('\0' != *buf) {
                 if (mdoc->defos) {                  mdoc->meta.os = mandoc_strdup(buf);
                         mdoc->meta.os = mandoc_strdup(mdoc->defos);                  return(1);
                         return(1);          }
                 }  
           if (mdoc->defos) {
                   mdoc->meta.os = mandoc_strdup(mdoc->defos);
                   return(1);
           }
   
 #ifdef OSNAME  #ifdef OSNAME
                 if (strlcat(buf, OSNAME, BUFSIZ) >= BUFSIZ) {          mdoc->meta.os = mandoc_strdup(OSNAME);
                         mdoc_nmsg(mdoc, n, MANDOCERR_MEM);  
                         return(0);  
                 }  
 #else /*!OSNAME */  #else /*!OSNAME */
           if (NULL == defbuf) {
                 if (-1 == uname(&utsname)) {                  if (-1 == uname(&utsname)) {
                         mdoc_nmsg(mdoc, n, MANDOCERR_UNAME);                          mdoc_nmsg(mdoc, n, MANDOCERR_UNAME);
                         mdoc->meta.os = mandoc_strdup("UNKNOWN");                          defbuf = mandoc_strdup("UNKNOWN");
                         return(post_prol(mdoc));                  } else
                 }                          mandoc_asprintf(&defbuf, "%s %s",
                               utsname.sysname, utsname.release);
                 if (strlcat(buf, utsname.sysname, BUFSIZ) >= BUFSIZ) {  
                         mdoc_nmsg(mdoc, n, MANDOCERR_MEM);  
                         return(0);  
                 }  
                 if (strlcat(buf, " ", BUFSIZ) >= BUFSIZ) {  
                         mdoc_nmsg(mdoc, n, MANDOCERR_MEM);  
                         return(0);  
                 }  
                 if (strlcat(buf, utsname.release, BUFSIZ) >= BUFSIZ) {  
                         mdoc_nmsg(mdoc, n, MANDOCERR_MEM);  
                         return(0);  
                 }  
 #endif /*!OSNAME*/  
         }          }
           mdoc->meta.os = mandoc_strdup(defbuf);
         mdoc->meta.os = mandoc_strdup(buf);  #endif /*!OSNAME*/
         return(1);          return(1);
 }  }
   

Legend:
Removed from v.1.197  
changed lines
  Added in v.1.204

CVSweb