[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.196 and 1.203

version 1.196, 2013/10/06 22:46:15 version 1.203, 2014/03/23 11:25:26
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 1674  ebool(struct mdoc *mdoc)
Line 1676  ebool(struct mdoc *mdoc)
   
         assert(MDOC_TEXT == mdoc->last->child->type);          assert(MDOC_TEXT == mdoc->last->child->type);
   
         if (0 == strcmp(mdoc->last->child->string, "on"))          if (0 == strcmp(mdoc->last->child->string, "on")) {
                   if (MDOC_Sm == mdoc->last->tok)
                           mdoc->flags &= ~MDOC_SMOFF;
                 return(1);                  return(1);
         if (0 == strcmp(mdoc->last->child->string, "off"))          }
           if (0 == strcmp(mdoc->last->child->string, "off")) {
                   if (MDOC_Sm == mdoc->last->tok)
                           mdoc->flags |= MDOC_SMOFF;
                 return(1);                  return(1);
           }
   
         mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_BADBOOL);          mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_BADBOOL);
         return(1);          return(1);
Line 1887  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 1985  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 2177  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 2189  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 2341  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 2369  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 if (-1 == asprintf(&defbuf, "%s %s",
                 }                      utsname.sysname, utsname.release)) {
                           perror(NULL);
                 if (strlcat(buf, utsname.sysname, BUFSIZ) >= BUFSIZ) {                          exit((int)MANDOCLEVEL_SYSERR);
                         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.196  
changed lines
  Added in v.1.203

CVSweb