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

Diff for /src/usr.bin/rpcgen/rpc_scan.c between version 1.9 and 1.10

version 1.9, 2002/06/01 01:40:38 version 1.10, 2002/07/05 05:39:42
Line 47 
Line 47 
 #include "rpc_parse.h"  #include "rpc_parse.h"
 #include "rpc_util.h"  #include "rpc_util.h"
   
 static unget_token(token *tokp);  static void unget_token(token *tokp);
 static findstrconst(char **, char **);  static void findstrconst(char **, char **);
 static findchrconst(char **, char **);  static void findchrconst(char **, char **);
 static findconst(char **, char **);  static void findconst(char **, char **);
 static findkind(char **, token *);  static void findkind(char **, token *);
 static cppline(char *);  static int cppline(char *);
 static directive(char *);  static int directive(char *);
 static printdirective(char *);  static void printdirective(char *);
 static docppline(char *, int *, char **);  static void docppline(char *, int *, char **);
   
 #define startcomment(where) (where[0] == '/' && where[1] == '*')  #define startcomment(where) (where[0] == '/' && where[1] == '*')
 #define endcomment(where) (where[-1] == '*' && where[0] == '/')  #define endcomment(where) (where[-1] == '*' && where[0] == '/')
Line 305 
Line 305 
         }          }
 }  }
   
 static  static void
 unget_token(tokp)  unget_token(tokp)
         token *tokp;          token *tokp;
 {  {
Line 313 
Line 313 
         pushed = 1;          pushed = 1;
 }  }
   
 static  static void
 findstrconst(str, val)  findstrconst(str, val)
         char **str;          char **str;
         char **val;          char **val;
Line 323 
Line 323 
   
         p = *str;          p = *str;
         do {          do {
                 *p++;                  p++;
         } while (*p && *p != '"');          } while (*p && *p != '"');
         if (*p == 0) {          if (*p == 0) {
                 error("unterminated string constant");                  error("unterminated string constant");
Line 331 
Line 331 
         p++;          p++;
         size = p - *str;          size = p - *str;
         *val = alloc(size + 1);          *val = alloc(size + 1);
           if (val == NULL)
                   error("alloc failed");
         (void) strncpy(*val, *str, size);          (void) strncpy(*val, *str, size);
         (*val)[size] = 0;          (*val)[size] = 0;
         *str = p;          *str = p;
 }  }
   
 static  static void
 findchrconst(str, val)  findchrconst(str, val)
         char **str;          char **str;
         char **val;          char **val;
Line 346 
Line 348 
   
         p = *str;          p = *str;
         do {          do {
                 *p++;                  p++;
         } while (*p && *p != '\'');          } while (*p && *p != '\'');
         if (*p == 0) {          if (*p == 0) {
                 error("unterminated string constant");                  error("unterminated string constant");
Line 357 
Line 359 
                 error("empty char string");                  error("empty char string");
         }          }
         *val = alloc(size + 1);          *val = alloc(size + 1);
           if (val == NULL)
                   error("alloc failed");
         (void) strncpy(*val, *str, size);          (void) strncpy(*val, *str, size);
         (*val)[size] = 0;          (*val)[size] = 0;
         *str = p;          *str = p;
 }  }
   
 static  static void
 findconst(str, val)  findconst(str, val)
         char **str;          char **str;
         char **val;          char **val;
Line 383 
Line 387 
         }          }
         size = p - *str;          size = p - *str;
         *val = alloc(size + 1);          *val = alloc(size + 1);
           if (val == NULL)
                   error("alloc failed");
         (void) strncpy(*val, *str, size);          (void) strncpy(*val, *str, size);
         (*val)[size] = 0;          (*val)[size] = 0;
         *str = p;          *str = p;
Line 413 
Line 419 
         {TOK_EOF, "??????"},          {TOK_EOF, "??????"},
 };  };
   
 static  static void
 findkind(mark, tokp)  findkind(mark, tokp)
         char **mark;          char **mark;
         token *tokp;          token *tokp;
Line 437 
Line 443 
         tokp->kind = TOK_IDENT;          tokp->kind = TOK_IDENT;
         for (len = 0; isalnum(str[len]) || str[len] == '_'; len++);          for (len = 0; isalnum(str[len]) || str[len] == '_'; len++);
         tokp->str = alloc(len + 1);          tokp->str = alloc(len + 1);
           if (tokp->str == NULL)
                   error("alloc failed");
         (void) strncpy(tokp->str, str, len);          (void) strncpy(tokp->str, str, len);
         tokp->str[len] = 0;          tokp->str[len] = 0;
         *mark = str + len;          *mark = str + len;
 }  }
   
 static  static int
 cppline(line)  cppline(line)
         char *line;          char *line;
 {  {
         return (line == curline && *line == '#');          return (line == curline && *line == '#');
 }  }
   
 static  static int
 directive(line)  directive(line)
         char *line;          char *line;
 {  {
         return (line == curline && *line == '%');          return (line == curline && *line == '%');
 }  }
   
 static  static void
 printdirective(line)  printdirective(line)
         char *line;          char *line;
 {  {
         fprintf(fout, "%s", line + 1);          fprintf(fout, "%s", line + 1);
 }  }
   
 static  static void
 docppline(line, lineno, fname)  docppline(line, lineno, fname)
         char *line;          char *line;
         int *lineno;          int *lineno;
Line 489 
Line 497 
         }          }
         line++;          line++;
         p = file = alloc(strlen(line) + 1);          p = file = alloc(strlen(line) + 1);
           if (p == NULL)
                   error("alloc failed");
         while (*line && *line != '"') {          while (*line && *line != '"') {
                 *p++ = *line++;                  *p++ = *line++;
         }          }

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10