annotate runtime/tools/ccfilter.c @ 25935:c90b8e41b10e v8.2.3501

patch 8.2.3501: tmux filetype dection is incomplete Commit: https://github.com/vim/vim/commit/e519eb41c1c12836b2d12aeb703bb04c7618a724 Author: Eric Pruitt <eric.pruitt@gmail.com> Date: Tue Oct 12 13:58:23 2021 +0100 patch 8.2.3501: tmux filetype dection is incomplete Problem: tmux filetype dection is incomplete Solution: Also use tmux for files having text after .conf. (Eric Pruitt, closes #8971)
author Bram Moolenaar <Bram@vim.org>
date Tue, 12 Oct 2021 15:00:06 +0200
parents 1c75e1974313
children 1629cc65d78d
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 )
7842
cf744110897d commit https://github.com/vim/vim/commit/779a7759ad03e6a3fb616828793512644390655a
Christian Brabandt <cb@256bit.org>
parents: 7
diff changeset
88 {
cf744110897d commit https://github.com/vim/vim/commit/779a7759ad03e6a3fb616828793512644390655a
Christian Brabandt <cb@256bit.org>
parents: 7
diff changeset
89 int i;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 fprintf( stderr, USAGE );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93 fprintf( stderr, "Current default <COMPILER>: %s\n",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94 COMPILER_Names[COMPILER_DEFAULT][0] );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96 fprintf( stderr, "Acceptable parameters for <COMPILER> are:\n" );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97 for (i=1; i < COMPILER_QTY; i++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 fprintf( stderr, " %-15.15s %s\n",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99 COMPILER_Names[i][0],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100 COMPILER_Names[i][1] );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101 fprintf(stderr, szError);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102 return 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104
7842
cf744110897d commit https://github.com/vim/vim/commit/779a7759ad03e6a3fb616828793512644390655a
Christian Brabandt <cb@256bit.org>
parents: 7
diff changeset
105 char *echogets(char *s, int echo)
cf744110897d commit https://github.com/vim/vim/commit/779a7759ad03e6a3fb616828793512644390655a
Christian Brabandt <cb@256bit.org>
parents: 7
diff changeset
106 {
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107 char * const retval=fgets(s, LINELENGTH, stdin);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108 if (echo!=0 && retval!=NULL) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109 fputs(retval, stderr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111 return retval;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114 int main( int argc, char *argv[] )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115 { int rv, i, j, ok;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
116 int stay;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117 int prefetch;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
118 char *p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
119 int dec_col = 0; /* Decrement column value by 1 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
120 int dec_row = 0; /* Decrement row value by 1 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121 int echo = 0; /* Echo stdin to stderr */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
122 int verbose = 0; /* Include Bad Formatted Lines */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
123 int CWDlen;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124 int COMPILER = COMPILER_DEFAULT;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
125
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126 getcwd( CWD, sizeof(CWD) );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127 CWDlen = strlen(CWD);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
129 for (i=1; i<argc; i++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
131 if (argv[i][0] != '-')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
132 return ShowUsage("");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
133 switch ( argv[i][1] )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
134 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
135 case 'c':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
136 dec_col = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
137 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
138 case 'r':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
139 dec_row = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
140 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
141 case 'e':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
142 echo = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
143 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
144 case 'v':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
145 verbose = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
146 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
147 case 'o':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
148 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
149 if (i+1 >= argc)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
150 return ShowUsage("Error: Missing parameter for -o\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
151 i++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
152 COMPILER = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
153 for (j=1; j<COMPILER_QTY; j++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
154 if ( (strcmp(argv[i], COMPILER_Names[j][0]) == 0) ||
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
155 ( (argv[i][0] == '_') &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
156 (strcmp(&argv[i][1], COMPILER_Names[j][0]) == 0) ) )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
157 COMPILER = j;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
158 if (COMPILER == -1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
159 return ShowUsage("Error: Invalid COMPILER specified\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
160 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
161 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
162 case 'h':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
163 return ShowUsage("");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
164 default:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
165 return ShowUsage("Error: Invalid option\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
166 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
167 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
168 if (COMPILER == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
169 return ShowUsage("Error: COMPILER must be specified in this system\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
170
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
171 stay = ( echogets(Line, echo) != NULL );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
172 prefetch = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
173
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
174 while( stay )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
175 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
176 *FileName = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
177 Row = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
178 Col = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
179 Severity = ' ';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
180 *Reason = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
181 ok = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
182 switch (COMPILER)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
183 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
184 case COMPILER_GCC:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
185 Severity = 'e';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
186 #ifdef GOTO_FROM_WHERE_INCLUDED
19091
1c75e1974313 patch 8.2.0106: printf formats are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 9097
diff changeset
187 rv = sscanf( Line, "In file included from %[^:]:%lu:",
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
188 FileName, &Row );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
189 if ( rv == 2 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
190 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
191 ok = (echogets(Reason, echo) != NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
192 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
193 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
194 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
195 {
19091
1c75e1974313 patch 8.2.0106: printf formats are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 9097
diff changeset
196 if ((rv = sscanf( Line, "%[^:]:%lu: warning: %[^\n]",
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
197 FileName, &Row, Reason ))==3) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
198 Severity = 'w';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
199 } else {
19091
1c75e1974313 patch 8.2.0106: printf formats are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 9097
diff changeset
200 rv = sscanf( Line, "%[^:]:%lu: %[^\n]",
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
201 FileName, &Row, Reason );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
202 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
203 ok = ( rv == 3 );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
204 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
205 Col = (dec_col ? 1 : 0 );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
206 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
207 case COMPILER_AIX:
19091
1c75e1974313 patch 8.2.0106: printf formats are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 9097
diff changeset
208 rv = sscanf( Line, "\"%[^\"]\", line %lu.%lu: %*s (%c) %[^\n]",
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
209 FileName, &Row, &Col, &Severity, Reason );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
210 ok = ( rv == 5 );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
211 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
212 case COMPILER_HPUX:
19091
1c75e1974313 patch 8.2.0106: printf formats are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 9097
diff changeset
213 rv = sscanf( Line, "cc: \"%[^\"]\", line %lu: %c%*[^:]: %[^\n]",
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
214 FileName, &Row, &Severity, Reason );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
215 ok = ( rv == 4 );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
216 Col = (dec_col ? 1 : 0 );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
217 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
218 case COMPILER_SOLARIS:
19091
1c75e1974313 patch 8.2.0106: printf formats are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 9097
diff changeset
219 rv = sscanf( Line, "\"%[^\"]\", line %lu: warning: %[^\n]",
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
220 FileName, &Row, Reason );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
221 Severity = 'w';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
222 ok = ( rv == 3 );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
223 if ( rv != 3 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
224 {
19091
1c75e1974313 patch 8.2.0106: printf formats are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 9097
diff changeset
225 rv = sscanf( Line, "\"%[^\"]\", line %lu: %[^\n]",
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
226 FileName, &Row, Reason );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
227 Severity = 'e';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
228 ok = ( rv == 3 );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
229 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
230 Col = (dec_col ? 1 : 0 );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
231 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
232 case COMPILER_ATT:
19091
1c75e1974313 patch 8.2.0106: printf formats are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 9097
diff changeset
233 rv = sscanf( Line, "%c \"%[^\"]\",L%lu/C%lu%*[^:]:%[^\n]",
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
234 &Severity, FileName, &Row, &Col, Reason );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
235 ok = ( rv == 5 );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
236
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
237 if (rv != 5)
19091
1c75e1974313 patch 8.2.0106: printf formats are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 9097
diff changeset
238 { rv = sscanf( Line, "%c \"%[^\"]\",L%lu/C%lu: %[^\n]",
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
239 &Severity, FileName, &Row, &Col, Reason );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
240 ok = ( rv == 5 );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
241 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
242
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
243 if (rv != 5)
19091
1c75e1974313 patch 8.2.0106: printf formats are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 9097
diff changeset
244 { rv = sscanf( Line, "%c \"%[^\"]\",L%lu: %[^\n]",
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
245 &Severity, FileName, &Row, Reason );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
246 ok = ( rv == 4 );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
247 Col = (dec_col ? 1 : 0 );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
248 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
249
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
250 stay = (echogets(Line2, echo) != NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
251 while ( stay && (Line2[0] == '|') )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
252 { for (p=&Line2[2]; (*p) && (isspace(*p)); p++);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
253 strcat( Reason, ": " );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
254 strcat( Reason, p );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
255 Line2[0] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
256 stay = (echogets(Line2, echo) != NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
257 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
258 prefetch = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
259 strcpy( Line, Line2 );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
260 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
261 case COMPILER_IRIX:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
262 Col = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
263 prefetch = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
264 rv = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
265 ok = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
266 if ( !strncmp(Line, "cfe: ", 5) )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
267 { p = &Line[5];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
268 Severity = tolower(*p);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
269 p = strchr( &Line[5], ':' );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
270 if (p == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
271 { ok = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
272 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
273 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
274 {
19091
1c75e1974313 patch 8.2.0106: printf formats are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 9097
diff changeset
275 rv = sscanf( p+2, "%[^:]: %lu: %[^\n]",
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
276 FileName, &Row, Reason );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
277 if (rv != 3)
19091
1c75e1974313 patch 8.2.0106: printf formats are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 9097
diff changeset
278 rv = sscanf( p+2, "%[^,], line %lu: %[^\n]",
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
279 FileName, &Row, Reason );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
280 ok = ( rv == 3 );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
281 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
282
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
283 if (ok)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
284 { prefetch = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
285 stay = (echogets(Line, echo) != NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
286 if (Line[0] == ' ')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
287 stay = (echogets(Line2, echo) != NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
288 if ( (Line2[0] == ' ') &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
289 ( (Line2[1] == '-') || (Line2[1] == '^') ) )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
290 { Col = strlen(Line2)-1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
291 prefetch = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
292 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
293 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
294 { strcat( Line, "\n" );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
295 strcat( Line, Line2 );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
296 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
297 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
298 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
299 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
300 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
301 if (dec_col) Col--;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
302 if (dec_row) Row--;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
303 if (!ok)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
304 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
305 if ( Line[0] == 'g' )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
306 p = &Line[1];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
307 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
308 p = &Line[0];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
309 ok = sscanf( p, "make[%*d]: Entering directory `%[^']",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
310 BasePath );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
311 if (verbose)
9097
071f9da012fb commit https://github.com/vim/vim/commit/06d2d38ab7564e1f784b1058a4ef4580cd6d1810
Christian Brabandt <cb@256bit.org>
parents: 7842
diff changeset
312 printf( "[%u]?%s\n", (unsigned)ok, Line );
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
313 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
314 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
315 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
316 for (p=Reason; (*p) && (isspace(*p)); p++);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
317 if ( BasePath[CWDlen] == 0 )
19091
1c75e1974313 patch 8.2.0106: printf formats are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 9097
diff changeset
318 printf( "%s:%lu:%lu:%c:%s\n", FileName, Row, Col, Severity, p );
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
319 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
320 {
19091
1c75e1974313 patch 8.2.0106: printf formats are not exactly right
Bram Moolenaar <Bram@vim.org>
parents: 9097
diff changeset
321 printf( "%s/%s:%lu:%lu:%c:%s\n", &BasePath[CWDlen+1], FileName, Row, Col, Severity, p );
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
322 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
323 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
324 if (!prefetch)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
325 stay = ( echogets(Line, echo) != NULL );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
326 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
327 return 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
328 }