rse 98/03/27 02:06:55
Modified: src/main gen_test_char.c gen_uri_delims.c util_uri.c Makefile.tmpl Log: Dr. Cosmetics: - avoid gcc complains by define main as at the other places in the two new generation programs - make uri_delim as all-in-one as test_char (#include in the middle of a struct definition is a little bit ugly) - make the generated files readable even not editable - remove double-defined dependencies in Makefile.tmpl (because they are already part of the "make depend" generated list) PS: There seems to be another problem here: The files are generated in main/ and included with #include "...". Although we only have -I../include and -I../os/unix but not -I. ! Is it really portable for all compilers to assume the CWD is searched for #include "..." even if no -I. is used? I personally would change it so that the files are generated in ../include/. Comments? Revision Changes Path 1.2 +7 -4 apache-1.3/src/main/gen_test_char.c Index: gen_test_char.c =================================================================== RCS file: /export/home/cvs/apache-1.3/src/main/gen_test_char.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- gen_test_char.c 1998/03/26 04:58:39 1.1 +++ gen_test_char.c 1998/03/27 10:06:49 1.2 @@ -9,7 +9,7 @@ #define T_OS_ESCAPE_PATH (0x04) #define T_HTTP_TOKEN_STOP (0x08) -void main(void) +int main(int argc, char *argv[]) { unsigned c; unsigned char flags; @@ -22,7 +22,7 @@ "#define T_HTTP_TOKEN_STOP (%u)\n" "\n" "static const unsigned char test_char_table[256] = {\n" -"0,\n", +" 0,", T_ESCAPE_SHELL_CMD, T_ESCAPE_PATH_SEGMENT, T_OS_ESCAPE_PATH, @@ -33,6 +33,8 @@ for (c = 1; c < 256; ++c) { flags = 0; + if (c % 20 == 0) + printf("\n "); /* escape_shell_cmd */ if (strchr("&;`'\"|*?~<>^()[]{}$\\\n", c)) { @@ -51,8 +53,9 @@ if (iscntrl(c) || strchr(" \t()<>@,;:\\/[]?={}", c)) { flags |= T_HTTP_TOKEN_STOP; } - printf("%u%c\n", flags, (c < 255) ? ',' : ' '); + printf("%u%c", flags, (c < 255) ? ',' : ' '); + } - printf("};\n"); + printf("\n};\n"); exit(0); } 1.2 +6 -2 apache-1.3/src/main/gen_uri_delims.c Index: gen_uri_delims.c =================================================================== RCS file: /export/home/cvs/apache-1.3/src/main/gen_uri_delims.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- gen_uri_delims.c 1998/03/26 04:58:39 1.1 +++ gen_uri_delims.c 1998/03/27 10:06:51 1.2 @@ -4,14 +4,17 @@ * marked "interesting"... for the uri parsing process. */ -void main(void) +int main(int argc, char *argv[]) { int i; char *value; printf("/* this file is automatically generated by " "gen_uri_delims, do not edit */\n"); + printf("static const unsigned char uri_delims[256] = {"); for (i = 0; i < 256; ++i) { + if (i % 20 == 0) + printf("\n "); switch (i) { case ':': value = "T_COLON"; break; case '/': value = "T_SLASH"; break; @@ -20,7 +23,8 @@ case '\0': value = "T_NUL"; break; default: value = "0"; break; } - printf("%s%c\n", value, (i < 255) ? ',' : ' '); + printf("%s%c", value, (i < 255) ? ',' : ' '); } + printf("\n};\n"); exit(0); } 1.16 +0 -2 apache-1.3/src/main/util_uri.c Index: util_uri.c =================================================================== RCS file: /export/home/cvs/apache-1.3/src/main/util_uri.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- util_uri.c 1998/03/26 04:58:41 1.15 +++ util_uri.c 1998/03/27 10:06:52 1.16 @@ -393,9 +393,7 @@ #define T_NUL 0x80 /* '\0' */ /* the uri_delims.h file is autogenerated by gen_uri_delims.c */ -static const unsigned char uri_delims[256] = { #include "uri_delims.h" -}; /* it works like this: if (uri_delims[ch] & NOTEND_foobar) { 1.21 +0 -4 apache-1.3/src/main/Makefile.tmpl Index: Makefile.tmpl =================================================================== RCS file: /export/home/cvs/apache-1.3/src/main/Makefile.tmpl,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- Makefile.tmpl 1998/03/26 04:58:39 1.20 +++ Makefile.tmpl 1998/03/27 10:06:53 1.21 @@ -36,15 +36,11 @@ uri_delims.h: gen_uri_delims ./gen_uri_delims >uri_delims.h -util_uri.o: uri_delims.h - gen_uri_delims: gen_uri_delims.o $(CC) $(CFLAGS) $(LDFLAGS) -o gen_uri_delims gen_uri_delims.o $(LIBS) test_char.h: gen_test_char ./gen_test_char >test_char.h - -util.o: test_char.h gen_test_char: gen_test_char.o $(CC) $(CFLAGS) $(LDFLAGS) -o gen_test_char gen_test_char.o $(LIBS)