[BACK]Return to mdoc_strings.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / mandoc

Diff for /src/usr.bin/mandoc/Attic/mdoc_strings.c between version 1.14 and 1.15

version 1.14, 2010/05/14 01:54:37 version 1.15, 2010/05/14 14:47:44
Line 24 
Line 24 
   
 #include "libmdoc.h"  #include "libmdoc.h"
   
 /* FIXME: this file is poorly named. */  static  const char * const secnames[SEC__MAX] = {
           NULL,
 struct mdoc_secname {          "NAME",
         const char      *name;  /* Name of section. */          "LIBRARY",
         enum mdoc_sec    sec;   /* Corresponding section. */          "SYNOPSIS",
           "DESCRIPTION",
           "IMPLEMENTATION NOTES",
           "RETURN VALUES",
           "ENVIRONMENT",
           "FILES",
           "EXIT STATUS",
           "EXAMPLES",
           "DIAGNOSTICS",
           "COMPATIBILITY",
           "ERRORS",
           "SEE ALSO",
           "STANDARDS",
           "HISTORY",
           "AUTHORS",
           "CAVEATS",
           "BUGS",
           "SECURITY CONSIDERATIONS",
           NULL
 };  };
   
 #define SECNAME_MAX     (20)  
   
 static  const struct mdoc_secname secnames[SECNAME_MAX] = {  
         { "NAME", SEC_NAME },  
         { "LIBRARY", SEC_LIBRARY },  
         { "SYNOPSIS", SEC_SYNOPSIS },  
         { "DESCRIPTION", SEC_DESCRIPTION },  
         { "IMPLEMENTATION NOTES", SEC_IMPLEMENTATION },  
         { "EXIT STATUS", SEC_EXIT_STATUS },  
         { "RETURN VALUES", SEC_RETURN_VALUES },  
         { "ENVIRONMENT", SEC_ENVIRONMENT },  
         { "FILES", SEC_FILES },  
         { "EXAMPLES", SEC_EXAMPLES },  
         { "DIAGNOSTICS", SEC_DIAGNOSTICS },  
         { "COMPATIBILITY", SEC_COMPATIBILITY },  
         { "ERRORS", SEC_ERRORS },  
         { "SEE ALSO", SEC_SEE_ALSO },  
         { "STANDARDS", SEC_STANDARDS },  
         { "HISTORY", SEC_HISTORY },  
         { "AUTHORS", SEC_AUTHORS },  
         { "CAVEATS", SEC_CAVEATS },  
         { "BUGS", SEC_BUGS },  
         { "SECURITY CONSIDERATIONS", SEC_SECURITY }  
 };  
   
   
 /*  /*
  * FIXME: this is repeated in print_text() (html.c) and term_word()   * FIXME: this is repeated in print_text() (html.c) and term_word()
  * (term.c).   * (term.c).
Line 66 
Line 58 
 {  {
   
         switch (p) {          switch (p) {
         case('|'): /* FIXME! */          case('|'):
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
         case('('):          case('('):
                 /* FALLTHROUGH */                  /* FALLTHROUGH */
Line 100 
Line 92 
 mdoc_isdelim(const char *p)  mdoc_isdelim(const char *p)
 {  {
   
         if (0 == *p)          if ('\0' == p[0])
                 return(0);                  return(0);
         if (0 != *(p + 1))          if ('\0' == p[1])
                 return(0);                  return(mdoc_iscdelim(p[0]));
         return(mdoc_iscdelim(*p));  
           /*
            * XXX; account for groff bubu where the \*(Ba reserved string
            * is treated in exactly the same way as the vertical bar.  This
            * is the only function that checks for this.
            */
           return(0 == strcmp(p, "\\*(Ba"));
 }  }
   
   
 enum mdoc_sec  enum mdoc_sec
 mdoc_atosec(const char *p)  mdoc_str2sec(const char *p)
 {  {
         int              i;          int              i;
   
         for (i = 0; i < SECNAME_MAX; i++)          for (i = 0; i < (int)SEC__MAX; i++)
                 if (0 == strcmp(p, secnames[i].name))                  if (secnames[i] && 0 == strcmp(p, secnames[i]))
                         return(secnames[i].sec);                          return((enum mdoc_sec)i);
   
         return(SEC_CUSTOM);          return(SEC_CUSTOM);
 }  }

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.15