Main Page | Class Hierarchy | Data Structures | Directories | File List | Data Fields | Related Pages

t.c

00001 #include <sys/types.h>
00002 
00003 #include <ctype.h>
00004 #include <errno.h>
00005 #include <stdio.h>
00006 #include <stdlib.h>
00007 #include <string.h>
00008 
00009 int
00010 chk(f)
00011         char *f;
00012 {
00013         int ch, l, r;
00014 
00015         if (freopen(f, "r", stdin) == NULL) {
00016                 fprintf(stderr, "%s: %s\n", f, strerror(errno));
00017                 exit (1);
00018         }
00019         for (l = 1, r = 0; (ch = getchar()) != EOF;) {
00020                 if (ch != ',')
00021                         goto next;
00022                 do { ch = getchar(); } while (isblank(ch));
00023                 if (ch != '\n')
00024                         goto next;
00025                 ++l;
00026                 do { ch = getchar(); } while (isblank(ch));
00027                 if (ch != '}')
00028                         goto next;
00029                 r = 1;
00030                 printf("%s: line %d\n", f, l);
00031 
00032 next:           if (ch == '\n')
00033                         ++l;
00034         }
00035         return (r);
00036 }
00037 
00038 int
00039 main(int argc, char *argv[])
00040 {
00041         int r;
00042 
00043         for (r = 0; *++argv != NULL;)
00044                 if (chk(*argv))
00045                         r = 1;
00046         return (r);
00047 }

Generated on Sun Dec 25 12:14:52 2005 for Berkeley DB 4.4.16 by  doxygen 1.4.2