chiark / gitweb /
finalise changelog prep. for cvs-buildpackage
[userv.git] / parser.c
index b2c2b03896c41bb3c3450cf8d12d08d1b8f6128e..3f40ffb71ed99b8eec4cb7c83861f1637306897c 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -6,7 +6,7 @@
  * about m4 quoting &c., but we have to #include it so that the C
  * objects from the lexer are available.
  *
- * Copyright (C)1996-1999 Ian Jackson
+ * Copyright (C)1996-1999,2001 Ian Jackson
  *
  * This is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by
@@ -167,15 +167,15 @@ static int dequote(char *inplace) {
       *q++= v;
       continue;
     default:
-      if (isalpha(*p))
+      if (ISCHAR(isalpha,*p))
         return parseerrprint("unknown \\<letter> sequence \\%c in quoted string",*p);
-      if (isdigit(*p)) {
+      if (ISCHAR(isdigit,*p)) {
         if (!((buf[0]= *p++) && (buf[1]= *p++) && (buf[2]= *p++))) abort();
         buf[3]= 0; v= strtoul(buf,&bep,8);
         if (bep != buf+3 || (v & ~0xff))
           return parseerrprint("invalid \\<octal> sequence \\%s in quoted string",buf);
         *q++= v; continue;
-      } else if (ispunct(*p)) {
+      } else if (ISCHAR(ispunct,*p)) {
         *q++= *p++; continue;
       } else {
        while (*p==' ' || *p=='\t') p++;
@@ -223,8 +223,8 @@ const char *printtoken(int token) {
     l= strlen(buf); i= sizeof(buf)-l-2; p= yytext; q= buf+l;
     while ((c= *p++)) {
       if (i-- <= 0) { q--; strcpy(q-3,"..."); break; }
-      if (isspace(c)) c= ' ';
-      else if (!isprint(c) || iscntrl(c)) c= '?';
+      if (ISCHAR(isspace,c)) c= ' ';
+      else if (!ISCHAR(isprint,c) || ISCHAR(iscntrl,c)) c= '?';
       else *q++= c;
     }
     strcpy(q,"'");
@@ -619,11 +619,11 @@ int pcf_grep(int ctoken, char *const *pv, int *rtrue) {
   buf= xmalloc(maxlen+2); actrue= 0; c= 0;
   while (!actrue && c!=EOF) {
     c= getc(file); if (c==EOF) break;
-    if (isspace(c)) continue;
+    if (ISCHAR(isspace,c)) continue;
     l= maxlen+1; p= buf;
     while (l>0 && c!='\n' && c!=EOF) { *p++= c; l--; c= getc(file); } 
-    if (c=='\n' || c==EOF || isspace(c)) {
-      while (p>buf && isspace(p[-1])) --p;
+    if (c=='\n' || c==EOF || ISCHAR(isspace,c)) {
+      while (p>buf && ISCHAR(isspace,p[-1])) --p;
       *p= 0; posstrue= 0;
       for (pp= pv; !posstrue && *pp; pp++)
        if (!strcmp(*pp,buf)) posstrue= 1;
@@ -634,7 +634,7 @@ int pcf_grep(int ctoken, char *const *pv, int *rtrue) {
       for (;;) {
         c= getc(file);
         if (c==EOF || c=='\n') break;
-        if (!isspace(c)) posstrue= 0;
+        if (!ISCHAR(isspace,c)) posstrue= 0;
       }
     }
     if (posstrue) actrue= 1;
@@ -751,7 +751,7 @@ int df_executefromdirectory(int dtoken) {
 
   r= paa_pathargs(&rv,&newargs); if (r) return r;
   p= strrchr(service,'/'); if (p) p++; else p= service;
-  if (!*p || !isalnum(*p)) {
+  if (!*p || !ISCHAR(isalnum,*p)) {
     parseerrprint("execute-from-directory requires initial char of service "
                  "portion to be alphanumeric (service portion was `%s')",
                  p);
@@ -759,7 +759,7 @@ int df_executefromdirectory(int dtoken) {
     return tokv_error;
   }
   for (q=p+1; *q; q++) {
-    if (!isalnum(*q) && *q != '-') {
+    if (!ISCHAR(isalnum,*q) && *q != '-') {
       parseerrprint("execute-from-directory requires service portion to "
                    "contain only alphanumerics and hyphens (was `%s')",
                    p);
@@ -999,8 +999,8 @@ int df_includedirectory(int dtoken) {
     tel= strlen(de->d_name);
     if (!tel) continue;
     p= de->d_name;
-    if (!*p || !isalnum(*p)) continue;
-    while ((c= *++p)) if (!(isalnum(c) || c=='-')) break;
+    if (!*p || !ISCHAR(isalnum,*p)) continue;
+    while ((c= *++p)) if (!(ISCHAR(isalnum,c) || c=='-')) break;
     if (c) continue;
     if (makeroom(&buildbuf,&buildbuflen,cpl+1+tel+1)) {
       stringoverflow("pathname in directory");