home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
-
- #define MAXLEN 450
-
- char quotebuf[MAXLEN];
- char line[MAXLEN];
- int numq = 0;
-
- char *strcat();
- char *strcpy();
-
- main()
- {
-
- char *c, *index();
- int endit = 0;
-
- while (gets(line)) {
- if (line[0] == '%' && (line[1] == '%' || line[1] == '-')) {
-
- if (strlen(quotebuf)) {
- numq++;
-
- /*
- * mark all newlines and tabs with special character flags so
- * you don't confuse makedbm
- */
-
- while ((c = index(quotebuf, '\n')))
- *c = '\001';
-
- while ((c = index(quotebuf, '\t')))
- *c = '\002';
-
- printf("%d\t%s\n", numq, quotebuf);
- strcpy(quotebuf, "");
- }
- } else {
-
- if ((strlen(line) + strlen(quotebuf)) > MAXLEN) {
- /* fprintf(stderr, "\nLong quote:\n%s\n", quotebuf); */
- strcpy(quotebuf, "");
- } else {
- strcat(quotebuf, line);
- strcat(quotebuf, "\001");
- }
- }
- }
- printf("MAX\t%d\n", numq);
- }
-