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

Diff for /mandoc/Attic/argv.c between version 1.18 and 1.21

version 1.18, 2009/01/20 12:51:28 version 1.21, 2009/01/20 13:49:36
Line 25 
Line 25 
   
 #include "private.h"  #include "private.h"
   
   /*
    * Parse arguments and parameters of macros.  Arguments follow the
    * syntax of `-arg [val [valN...]]', while parameters are free-form text
    * following arguments (if any).  This file must correctly handle the
    * strange punctuation rules dictated by groff.
    */
   
 /* FIXME: .It called with -column and quoted arguments. */  /* FIXME: .It called with -column and quoted arguments. */
 /* FIXME: if arguments are quoted, they should not be later parsed for  
  * macros. */  
   
 static  int              lookup(int, const char *);  static  int              lookup(int, const char *);
 static  int              parse(struct mdoc *, int,  static  int              parse(struct mdoc *, int,
Line 65  mdoc_args(struct mdoc *mdoc, int line, int *pos, char 
Line 70  mdoc_args(struct mdoc *mdoc, int line, int *pos, char 
                         if ( ! mdoc_iscdelim(buf[i]))                          if ( ! mdoc_iscdelim(buf[i]))
                                 break;                                  break;
                         i++;                          i++;
                         if (0 == buf[i] || ! isspace(buf[i]))                          if (0 == buf[i] || ! isspace((int)buf[i]))
                                 break;                                  break;
                         i++;                          i++;
                         while (buf[i] && isspace(buf[i]))                          while (buf[i] && isspace((int)buf[i]))
                                 i++;                                  i++;
                 }                  }
                 if (0 == buf[i]) {                  if (0 == buf[i]) {
Line 102  mdoc_args(struct mdoc *mdoc, int line, int *pos, char 
Line 107  mdoc_args(struct mdoc *mdoc, int line, int *pos, char 
                         }                          }
                 else {                  else {
                         while (buf[*pos]) {                          while (buf[*pos]) {
                                 if (isspace(buf[*pos]))                                  if (isspace((int)buf[*pos]))
                                         if ('\\' != buf[*pos - 1])                                          if ('\\' != buf[*pos - 1])
                                                 break;                                                  break;
                                 (*pos)++;                                  (*pos)++;
Line 118  mdoc_args(struct mdoc *mdoc, int line, int *pos, char 
Line 123  mdoc_args(struct mdoc *mdoc, int line, int *pos, char 
                         return(ARGS_WORD);                          return(ARGS_WORD);
   
                 if ( ! (ARGS_TABSEP & fl))                  if ( ! (ARGS_TABSEP & fl))
                         while (buf[*pos] && isspace(buf[*pos]))                          while (buf[*pos] && isspace((int)buf[*pos]))
                                 (*pos)++;                                  (*pos)++;
   
                 if (buf[*pos])                  if (buf[*pos])
Line 148  mdoc_args(struct mdoc *mdoc, int line, int *pos, char 
Line 153  mdoc_args(struct mdoc *mdoc, int line, int *pos, char 
   
         buf[(*pos)++] = 0;          buf[(*pos)++] = 0;
         if (0 == buf[*pos])          if (0 == buf[*pos])
                 return(ARGS_WORD);                  return(ARGS_QWORD);
   
         while (buf[*pos] && isspace(buf[*pos]))          while (buf[*pos] && isspace((int)buf[*pos]))
                 (*pos)++;                  (*pos)++;
   
         if (buf[*pos])          if (buf[*pos])
                 return(ARGS_WORD);                  return(ARGS_QWORD);
   
         if ( ! mdoc_pwarn(mdoc, line, *pos, WARN_COMPAT, "whitespace at end-of-line"))          if ( ! mdoc_pwarn(mdoc, line, *pos, WARN_COMPAT, "whitespace at end-of-line"))
                 return(ARGS_ERROR);                  return(ARGS_ERROR);
   
         return(ARGS_WORD);          return(ARGS_QWORD);
 }  }
   
   
Line 447  mdoc_argv(struct mdoc *mdoc, int line, int tok,
Line 452  mdoc_argv(struct mdoc *mdoc, int line, int tok,
         if (0 == buf[*pos])          if (0 == buf[*pos])
                 return(ARGV_EOLN);                  return(ARGV_EOLN);
   
         assert( ! isspace(buf[*pos]));          assert( ! isspace((int)buf[*pos]));
   
         if ('-' != buf[*pos])          if ('-' != buf[*pos])
                 return(ARGV_WORD);                  return(ARGV_WORD);
Line 460  mdoc_argv(struct mdoc *mdoc, int line, int tok,
Line 465  mdoc_argv(struct mdoc *mdoc, int line, int tok,
   
         assert(*pos > 0);          assert(*pos > 0);
         while (buf[*pos]) {          while (buf[*pos]) {
                 if (isspace(buf[*pos]))                  if (isspace((int)buf[*pos]))
                         if ('\\' != buf[*pos - 1])                          if ('\\' != buf[*pos - 1])
                                 break;                                  break;
                 (*pos)++;                  (*pos)++;
Line 475  mdoc_argv(struct mdoc *mdoc, int line, int tok,
Line 480  mdoc_argv(struct mdoc *mdoc, int line, int tok,
                 return(ARGV_WORD);                  return(ARGV_WORD);
         }          }
   
         while (buf[*pos] && isspace(buf[*pos]))          while (buf[*pos] && isspace((int)buf[*pos]))
                 (*pos)++;                  (*pos)++;
   
         /* FIXME: whitespace if no value. */          /* FIXME: whitespace if no value. */

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.21

CVSweb