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

Diff for /mandoc/mdoc.c between version 1.99 and 1.100

version 1.99, 2009/08/13 11:43:24 version 1.100, 2009/08/18 14:27:16
Line 74  const char *const __mdoc_merrnames[MERRMAX] = {   
Line 74  const char *const __mdoc_merrnames[MERRMAX] = {   
         "unclosed explicit scope", /* EOPEN */          "unclosed explicit scope", /* EOPEN */
         "unterminated quoted phrase", /* EQUOTPHR */          "unterminated quoted phrase", /* EQUOTPHR */
         "closure macro without prior context", /* ENOCTX */          "closure macro without prior context", /* ENOCTX */
         "invalid whitespace after control character", /* ESPACE */  
         "no description found for library" /* ELIB */          "no description found for library" /* ELIB */
 };  };
   
Line 670  macrowarn(struct mdoc *m, int ln, const char *buf)
Line 669  macrowarn(struct mdoc *m, int ln, const char *buf)
 int  int
 parsemacro(struct mdoc *m, int ln, char *buf)  parsemacro(struct mdoc *m, int ln, char *buf)
 {  {
         int               i, c;          int               i, j, c, ppos;
         char              mac[5];          char              mac[5];
   
         /* Empty lines are ignored. */          /* Empty lines are ignored. */
   
         /* FIXME: this can accept `.    xx' like libman! */  
   
         if (0 == buf[1])          if (0 == buf[1])
                 return(1);                  return(1);
   
         if (' ' == buf[1]) {          i = 1;
                 i = 2;  
           /* Accept whitespace after the initial control char. */
   
           if (' ' == buf[i]) {
                   i++;
                 while (buf[i] && ' ' == buf[i])                  while (buf[i] && ' ' == buf[i])
                         i++;                          i++;
                 if (0 == buf[i])                  if (0 == buf[i])
                         return(1);                          return(1);
                 return(mdoc_perr(m, ln, 1, ESPACE));  
         }          }
   
           ppos = i;
   
         /* Copy the first word into a nil-terminated buffer. */          /* Copy the first word into a nil-terminated buffer. */
   
         for (i = 1; i < 5; i++) {          for (j = 0; j < 4; j++, i++) {
                 if (0 == (mac[i - 1] = buf[i]))                  if (0 == (mac[j] = buf[i]))
                         break;                          break;
                 else if (' ' == buf[i])                  else if (' ' == buf[i])
                         break;                          break;
         }          }
   
         mac[i - 1] = 0;          mac[j] = 0;
   
         if (i == 5 || i <= 2) {          if (j == 4 || j < 2) {
                 if ( ! macrowarn(m, ln, mac))                  if ( ! macrowarn(m, ln, mac))
                         goto err;                          goto err;
                 return(1);                  return(1);
Line 721  parsemacro(struct mdoc *m, int ln, char *buf)
Line 723  parsemacro(struct mdoc *m, int ln, char *buf)
          * Begin recursive parse sequence.  Since we're at the start of           * Begin recursive parse sequence.  Since we're at the start of
          * the line, we don't need to do callable/parseable checks.           * the line, we don't need to do callable/parseable checks.
          */           */
         if ( ! mdoc_macro(m, c, ln, 1, &i, buf))          if ( ! mdoc_macro(m, c, ln, ppos, &i, buf))
                 goto err;                  goto err;
   
         return(1);          return(1);
Line 731  err: /* Error out. */
Line 733  err: /* Error out. */
         m->flags |= MDOC_HALT;          m->flags |= MDOC_HALT;
         return(0);          return(0);
 }  }
   
   

Legend:
Removed from v.1.99  
changed lines
  Added in v.1.100

CVSweb