annotate runtime/tools/ccfilter.c @ 2943:be6b65096362 v7.3.244

updated for version 7.3.244 Problem: MS-Windows: Build problem with old compiler. (John Beckett) Solution: Only use HandleToLong() when available. (Mike Williams)
author Bram Moolenaar <bram@vim.org>
date Thu, 07 Jul 2011 17:43:41 +0200
parents 3fc0f57ecb91
children cf744110897d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 /* ======================================================================= */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 /* Project : VIM */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3 /* Module : ccfilter Version: 02.01.01 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4 /* File : ccfilter.c */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5 /* Purpose : Filter gmake/cc output into a standardized form */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 /* ======================================================================= */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 /* Created On: 12-Sep-95 20:32 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 /* Last modification: 03-Feb-98 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 /* -e option added by Bernd Feige */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 /* ======================================================================= */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 /* Copyright : */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 /* This source file is copyright (c) to Pablo Ariel Kohan */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 /* ======================================================================= */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 #define __CCFILTER_C__
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 #include <ctype.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 #include <stdio.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 #include <string.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 #include <unistd.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 #define LINELENGTH 2048
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 /* Collector(s) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 char Line[LINELENGTH];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 char Line2[LINELENGTH];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 /* Components */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 char FileName[1024];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 char BasePath[1024];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 char CWD[1024];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 unsigned long Row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 unsigned long Col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 char Severity;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 char Reason[LINELENGTH];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 #define COMPILER_UNKNOWN 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 #define COMPILER_GCC 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 #define COMPILER_AIX 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 #define COMPILER_ATT 3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 #define COMPILER_IRIX 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 #define COMPILER_SOLARIS 5
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 #define COMPILER_HPUX 6
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 char *COMPILER_Names[][2] =
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 /* Name Description */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 { "N/A", "" },
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 { "GCC", "GCC compiler" },
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 { "AIX", "AIX's C compiler" },
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 { "ATT", "AT&T/NCR's High Performance C Compiler" },
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 { "IRIX", "IRIX's MIPS/MIPSpro C compiler" },
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 { "SOLARIS", "SOLARIS's SparcWorks C compiler" },
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 { "HPUX", "HPUX's C compiler" }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 };
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 #define COMPILER_QTY (sizeof(COMPILER_Names)/sizeof(COMPILER_Names[0]))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 #if defined(_GCC)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 # define COMPILER_DEFAULT COMPILER_GCC
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 #elif defined(_AIX)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 # define COMPILER_DEFAULT COMPILER_AIX
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 #elif defined(_ATT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 # define COMPILER_DEFAULT COMPILER_ATT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62 #elif defined(_IRIX)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 # define COMPILER_DEFAULT COMPILER_IRIX
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 #elif defined(_SOLARIS)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 # define COMPILER_DEFAULT COMPILER_SOLARIS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 #elif defined(_HPUX)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 # define COMPILER_DEFAULT COMPILER_HPUX
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 # define COMPILER_DEFAULT COMPILER_UNKNOWN
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 const char USAGE[] =
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 "ccfilter v2.1 (c)1994-1997 by Pablo Ariel Kohan\n"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74 "Filter Out compiler's output, and converts it to fit VIM\n\n"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 "Usage:\n"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 " ccfilter [<options>]\n"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77 "Where: <options> is one or more of:\n"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78 " -c Decrement column by one\n"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 " -r Decrement row by one\n"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80 " -e Echo stdin to stderr\n"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 " -v Verbose (Outputs also invalid lines)\n"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 " -o <COMPILER> Treat input as <COMPILER>'s output\n"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 " Note: COMPILER may be preceded by an _\n"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 " -h This usage.\n";
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87 int ShowUsage( char *szError )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88 { int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 fprintf( stderr, USAGE );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92 fprintf( stderr, "Current default <COMPILER>: %s\n",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93 COMPILER_Names[COMPILER_DEFAULT][0] );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95 fprintf( stderr, "Acceptable parameters for <COMPILER> are:\n" );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96 for (i=1; i < COMPILER_QTY; i++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97 fprintf( stderr, " %-15.15s %s\n",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 COMPILER_Names[i][0],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99 COMPILER_Names[i][1] );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100 fprintf(stderr, szError);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101 return 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104 char *echogets(char *s, int echo) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105 char * const retval=fgets(s, LINELENGTH, stdin);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106 if (echo!=0 && retval!=NULL) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107 fputs(retval, stderr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109 return retval;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112 int main( int argc, char *argv[] )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113 { int rv, i, j, ok;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114 int stay;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115 int prefetch;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
116 char *p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117 int dec_col = 0; /* Decrement column value by 1 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
118 int dec_row = 0; /* Decrement row value by 1 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
119 int echo = 0; /* Echo stdin to stderr */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
120 int verbose = 0; /* Include Bad Formatted Lines */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121 int CWDlen;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
122 int COMPILER = COMPILER_DEFAULT;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
123
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124 getcwd( CWD, sizeof(CWD) );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
125 CWDlen = strlen(CWD);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127 for (i=1; i<argc; i++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
128 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
129 if (argv[i][0] != '-')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130 return ShowUsage("");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
131 switch ( argv[i][1] )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
132 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
133 case 'c':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
134 dec_col = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
135 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
136 case 'r':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
137 dec_row = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
138 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
139 case 'e':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
140 echo = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
141 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
142 case 'v':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
143 verbose = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
144 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
145 case 'o':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
146 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
147 if (i+1 >= argc)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
148 return ShowUsage("Error: Missing parameter for -o\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
149 i++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
150 COMPILER = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
151 for (j=1; j<COMPILER_QTY; j++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
152 if ( (strcmp(argv[i], COMPILER_Names[j][0]) == 0) ||
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
153 ( (argv[i][0] == '_') &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
154 (strcmp(&argv[i][1], COMPILER_Names[j][0]) == 0) ) )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
155 COMPILER = j;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
156 if (COMPILER == -1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
157 return ShowUsage("Error: Invalid COMPILER specified\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
158 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
159 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
160 case 'h':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
161 return ShowUsage("");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
162 default:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
163 return ShowUsage("Error: Invalid option\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
164 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
165 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
166 if (COMPILER == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
167 return ShowUsage("Error: COMPILER must be specified in this system\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
168
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
169 stay = ( echogets(Line, echo) != NULL );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
170 prefetch = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
171
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
172 while( stay )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
173 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
174 *FileName = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
175 Row = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
176 Col = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
177 Severity = ' ';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
178 *Reason = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
179 ok = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
180 switch (COMPILER)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
181 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
182 case COMPILER_GCC:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
183 Severity = 'e';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
184 #ifdef GOTO_FROM_WHERE_INCLUDED
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
185 rv = sscanf( Line, "In file included from %[^:]:%u:",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
186 FileName, &Row );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
187 if ( rv == 2 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
188 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
189 ok = (echogets(Reason, echo) != NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
190 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
191 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
192 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
193 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
194 if ((rv = sscanf( Line, "%[^:]:%u: warning: %[^\n]",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
195 FileName, &Row, Reason ))==3) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
196 Severity = 'w';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
197 } else {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
198 rv = sscanf( Line, "%[^:]:%u: %[^\n]",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
199 FileName, &Row, Reason );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
200 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
201 ok = ( rv == 3 );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
202 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
203 Col = (dec_col ? 1 : 0 );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
204 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
205 case COMPILER_AIX:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
206 rv = sscanf( Line, "\"%[^\"]\", line %u.%u: %*s (%c) %[^\n]",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
207 FileName, &Row, &Col, &Severity, Reason );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
208 ok = ( rv == 5 );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
209 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
210 case COMPILER_HPUX:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
211 rv = sscanf( Line, "cc: \"%[^\"]\", line %u: %c%*[^:]: %[^\n]",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
212 FileName, &Row, &Severity, Reason );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
213 ok = ( rv == 4 );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
214 Col = (dec_col ? 1 : 0 );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
215 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
216 case COMPILER_SOLARIS:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
217 rv = sscanf( Line, "\"%[^\"]\", line %u: warning: %[^\n]",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
218 FileName, &Row, Reason );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
219 Severity = 'w';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
220 ok = ( rv == 3 );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
221 if ( rv != 3 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
222 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
223 rv = sscanf( Line, "\"%[^\"]\", line %u: %[^\n]",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
224 FileName, &Row, Reason );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
225 Severity = 'e';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
226 ok = ( rv == 3 );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
227 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
228 Col = (dec_col ? 1 : 0 );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
229 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
230 case COMPILER_ATT:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
231 rv = sscanf( Line, "%c \"%[^\"]\",L%u/C%u%*[^:]:%[^\n]",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
232 &Severity, FileName, &Row, &Col, Reason );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
233 ok = ( rv == 5 );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
234
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
235 if (rv != 5)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
236 { rv = sscanf( Line, "%c \"%[^\"]\",L%u/C%u: %[^\n]",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
237 &Severity, FileName, &Row, &Col, Reason );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
238 ok = ( rv == 5 );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
239 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
240
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
241 if (rv != 5)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
242 { rv = sscanf( Line, "%c \"%[^\"]\",L%u: %[^\n]",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
243 &Severity, FileName, &Row, Reason );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
244 ok = ( rv == 4 );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
245 Col = (dec_col ? 1 : 0 );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
246 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
247
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
248 stay = (echogets(Line2, echo) != NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
249 while ( stay && (Line2[0] == '|') )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
250 { for (p=&Line2[2]; (*p) && (isspace(*p)); p++);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
251 strcat( Reason, ": " );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
252 strcat( Reason, p );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
253 Line2[0] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
254 stay = (echogets(Line2, echo) != NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
255 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
256 prefetch = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
257 strcpy( Line, Line2 );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
258 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
259 case COMPILER_IRIX:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
260 Col = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
261 prefetch = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
262 rv = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
263 ok = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
264 if ( !strncmp(Line, "cfe: ", 5) )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
265 { p = &Line[5];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
266 Severity = tolower(*p);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
267 p = strchr( &Line[5], ':' );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
268 if (p == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
269 { ok = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
270 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
271 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
272 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
273 rv = sscanf( p+2, "%[^:]: %u: %[^\n]",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
274 FileName, &Row, Reason );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
275 if (rv != 3)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
276 rv = sscanf( p+2, "%[^,], line %u: %[^\n]",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
277 FileName, &Row, Reason );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
278 ok = ( rv == 3 );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
279 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
280
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
281 if (ok)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
282 { prefetch = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
283 stay = (echogets(Line, echo) != NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
284 if (Line[0] == ' ')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
285 stay = (echogets(Line2, echo) != NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
286 if ( (Line2[0] == ' ') &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
287 ( (Line2[1] == '-') || (Line2[1] == '^') ) )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
288 { Col = strlen(Line2)-1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
289 prefetch = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
290 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
291 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
292 { strcat( Line, "\n" );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
293 strcat( Line, Line2 );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
294 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
295 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
296 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
297 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
298 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
299 if (dec_col) Col--;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
300 if (dec_row) Row--;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
301 if (!ok)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
302 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
303 if ( Line[0] == 'g' )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
304 p = &Line[1];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
305 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
306 p = &Line[0];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
307 ok = sscanf( p, "make[%*d]: Entering directory `%[^']",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
308 BasePath );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
309 if (verbose)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
310 printf( "[%u]?%s\n", ok, Line );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
311 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
312 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
313 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
314 for (p=Reason; (*p) && (isspace(*p)); p++);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
315 if ( BasePath[CWDlen] == 0 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
316 printf( "%s:%u:%u:%c:%s\n", FileName, Row, Col, Severity, p );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
317 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
318 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
319 printf( "%s/%s:%u:%u:%c:%s\n", &BasePath[CWDlen+1], FileName, Row, Col, Severity, p );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
320 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
321 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
322 if (!prefetch)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
323 stay = ( echogets(Line, echo) != NULL );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
324 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
325 return 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
326 }