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

Diff for /mandoc/man_validate.c between version 1.59 and 1.60

version 1.59, 2011/01/12 16:55:22 version 1.60, 2011/01/17 00:21:29
Line 53  static int   check_part(CHKARGS);
Line 53  static int   check_part(CHKARGS);
 static  int       check_root(CHKARGS);  static  int       check_root(CHKARGS);
 static  int       check_sec(CHKARGS);  static  int       check_sec(CHKARGS);
 static  int       check_text(CHKARGS);  static  int       check_text(CHKARGS);
 static  int       check_title(CHKARGS);  
   
 static  int       post_AT(CHKARGS);  static  int       post_AT(CHKARGS);
 static  int       post_fi(CHKARGS);  static  int       post_fi(CHKARGS);
Line 70  static v_check   posts_nf[] = { check_eq0, post_nf, NU
Line 69  static v_check   posts_nf[] = { check_eq0, post_nf, NU
 static  v_check   posts_par[] = { check_par, NULL };  static  v_check   posts_par[] = { check_par, NULL };
 static  v_check   posts_part[] = { check_part, NULL };  static  v_check   posts_part[] = { check_part, NULL };
 static  v_check   posts_sec[] = { check_sec, NULL };  static  v_check   posts_sec[] = { check_sec, NULL };
 static  v_check   posts_th[] = { check_ge2, check_le5, check_title, post_TH, NULL };  static  v_check   posts_th[] = { check_ge2, check_le5, post_TH, NULL };
 static  v_check   posts_uc[] = { post_UC, NULL };  static  v_check   posts_uc[] = { post_UC, NULL };
 static  v_check   pres_bline[] = { check_bline, NULL };  static  v_check   pres_bline[] = { check_bline, NULL };
   
Line 200  check_root(CHKARGS) 
Line 199  check_root(CHKARGS) 
   
   
 static int  static int
 check_title(CHKARGS)  
 {  
         const char      *p;  
   
         assert(n->child);  
         /* FIXME: is this sufficient? */  
         if ('\0' == *n->child->string) {  
                 man_nmsg(m, n, MANDOCERR_SYNTARGCOUNT);  
                 return(0);  
         }  
   
         for (p = n->child->string; '\0' != *p; p++)  
                 /* Only warn about this once... */  
                 if (isalpha((u_char)*p) && ! isupper((u_char)*p)) {  
                         man_nmsg(m, n, MANDOCERR_UPPERCASE);  
                         break;  
                 }  
   
         return(1);  
 }  
   
   
 static int  
 check_text(CHKARGS)  check_text(CHKARGS)
 {  {
         char            *p;          char            *p;
Line 266  check_##name(CHKARGS) \
Line 242  check_##name(CHKARGS) \
 { \  { \
         if (n->nchild ineq (x)) \          if (n->nchild ineq (x)) \
                 return(1); \                  return(1); \
         man_vmsg(m, MANDOCERR_SYNTARGCOUNT, n->line, n->pos, \          man_vmsg(m, MANDOCERR_ARGCOUNT, n->line, n->pos, \
                         "line arguments %s %d (have %d)", \                          "line arguments %s %d (have %d)", \
                         #ineq, (x), n->nchild); \                          #ineq, (x), n->nchild); \
         return(0); \          return(1); \
 }  }
   
 INEQ_DEFINE(0, ==, eq0)  INEQ_DEFINE(0, ==, eq0)
Line 396  check_bline(CHKARGS)
Line 372  check_bline(CHKARGS)
 static int  static int
 post_TH(CHKARGS)  post_TH(CHKARGS)
 {  {
           const char      *p;
   
         if (m->meta.title)          if (m->meta.title)
                 free(m->meta.title);                  free(m->meta.title);
Line 415  post_TH(CHKARGS)
Line 392  post_TH(CHKARGS)
         /* ->TITLE<- MSEC DATE SOURCE VOL */          /* ->TITLE<- MSEC DATE SOURCE VOL */
   
         n = n->child;          n = n->child;
         assert(n);          if (n && n->string) {
         m->meta.title = mandoc_strdup(n->string);                  for (p = n->string; '\0' != *p; p++) {
                           /* Only warn about this once... */
                           if (isalpha((u_char)*p) && ! isupper((u_char)*p)) {
                                   man_nmsg(m, n, MANDOCERR_UPPERCASE);
                                   break;
                           }
                   }
                   m->meta.title = mandoc_strdup(n->string);
           } else
                   m->meta.title = mandoc_strdup("");
   
         /* TITLE ->MSEC<- DATE SOURCE VOL */          /* TITLE ->MSEC<- DATE SOURCE VOL */
   
         n = n->next;          if (n)
         assert(n);                  n = n->next;
         m->meta.msec = mandoc_strdup(n->string);          if (n && n->string)
                   m->meta.msec = mandoc_strdup(n->string);
           else
                   m->meta.msec = mandoc_strdup("");
   
         /* TITLE MSEC ->DATE<- SOURCE VOL */          /* TITLE MSEC ->DATE<- SOURCE VOL */
   
Line 433  post_TH(CHKARGS)
Line 422  post_TH(CHKARGS)
          * string, then use the current date.           * string, then use the current date.
          */           */
   
         n = n->next;          if (n)
                   n = n->next;
         if (n && n->string && *n->string) {          if (n && n->string && *n->string) {
                 m->meta.date = mandoc_a2time                  m->meta.date = mandoc_a2time
                         (MTIME_ISO_8601, n->string);                          (MTIME_ISO_8601, n->string);

Legend:
Removed from v.1.59  
changed lines
  Added in v.1.60

CVSweb