home *** CD-ROM | disk | FTP | other *** search
- /* Z editor options
- :ma=1
- :ts=6
- :bk=0
- :wm=0
- */
-
- /*
- This program, both executable and sources, are
-
- Copyright 1986, Jay Ts
-
- Box 890
- West Oneonta NY 13861
-
- You may copy, distribute, alter, and use them, but absolutely no
- permission is granted to remove copyright notices from them or
- distribute them, in whole or in part, as, or as part of, a
- commercial product.
- */
-
- #include "stdio.h"
-
- #define MAXERRS 20
- #define FOUND_ERROR -1
-
- extern char errfile[];
-
- /*
- The first few characters of the annoying lines that the
- compiler/linker produces every time it runs.
- These will be filtered out!
- */
-
- char t[3][5] =
- {
- {'A', 'z', 't', 'e', 'c'},
- {'C', 'o', 'd', 'e', ':'},
- {'A', 'b', 'o', 'r', 't'}
- };
-
- FILE *fp, *fopen();
-
- /* print error messages from Compiler's redirected output file */
-
- int geterrs()
- {
- int numerrs = 0, getline();
- char s[128];
-
- if( (fp = fopen(errfile, "r")) == NULL)
- {
- printf("cc: open failed on error file %s\n", errfile);
- return(1);
- }
-
- while(getline(s)) if( ! fits(s))
- {
- printf("%s\n", s);
- if(++numerrs > MAXERRS) break;
- }
-
- if(fclose(fp) == -1) printf("can't close error file!\n");
- return(numerrs);
- }
-
- int getline(s)
- char *s;
- {
- int i = 0, c;
-
- while((c = getc(fp)) != '\n' && c != EOF) s[i++] = c;
- s[i] = '\0';
- return(c == EOF ? 0 : 1);
- }
-
- /*
- check to see if line matches one of the messages
- that the C compiler ALWAYS produces
- */
-
- int fits(s)
- char *s;
- {
- int i, j;
-
- for(i = 0; i < 3; i++)
- {
- for(j = 0; j < 5; j++) if(t[i][j] != s[j]) break;
- if(j == 5) return(1);
- }
- return(0);
- }
-