139{
140 char *opt, *needle =
NULL;
142 TCHAR lpMessage[4096];
143
144 int invert_search = 0;
145 int count_lines = 0;
146 int number_output = 0;
147 int ignore_case = 0;
148 int at_start = 0;
149 int at_end = 0;
150 int reg_express = 0;
151 int exact_match = 0;
152 int sub_dirs= 0;
153 int only_fname= 0;
154 int literal_search=0;
155
157 int hfind;
159
160
161 while ((--
argc) && (needle ==
NULL))
162 {
163 if (*(opt = *++
argv) ==
'/')
164 {
165 switch (opt[1])
166 {
167 case 'b':
168 case 'B':
169 at_start = 1;
170 break;
171
172
173
174
175
176
177 case 'e':
178 case 'E':
179 at_end = 1;
180 break;
181
182 case 'i':
183 case 'I':
184 ignore_case = 1;
185 break;
186
187 case 'm':
188 case 'M':
189 only_fname = 1;
190 break;
191
192 case 'n':
193 case 'N':
194 number_output = 1;
195 break;
196
197 case 'r':
198 case 'R':
199 reg_express = 1;
200 break;
201
202 case 's':
203 case 'S':
204 sub_dirs = 1;
205 break;
206
207 case 'v':
208 case 'V':
209 invert_search = 1;
210 break;
211
212 case 'x':
213 case 'X':
214 exact_match = 1;
215 break;
216
217 default:
220 break;
221 }
222 }
223 else
224 {
225
227 {
228
230 }
231 }
232 }
233
234
236 {
237
240 }
241
242
244 {
246 number_output, ignore_case, at_start, literal_search, at_end, reg_express, exact_match,
247 sub_dirs, only_fname);
248 }
249
251 {
253 if (hfind < 0)
254 {
255
256
260 }
261 else
262 {
263
264 do
265 {
266
267 if ((pfile =
fopen (finddata.name,
"r")) !=
NULL)
268 {
269 printf (
"---------------- %s\n", finddata.name);
270 ret =
find_str (needle, pfile, invert_search, count_lines,
271 number_output, ignore_case, at_start, literal_search, at_end, reg_express, exact_match,
272 sub_dirs, only_fname);
274 }
275 else
276 {
281 }
282 }
284 }
286 }
287
288
289
290
291
293}
int find_str(char *sz, FILE *p, int invert_search, int count_lines, int number_output, int ignore_case, int at_start, int literal_search, int at_end, int reg_express, int exact_match, int sub_dirs, int only_fname)
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
_Check_return_ _CRTIMP FILE *__cdecl fopen(_In_z_ const char *_Filename, _In_z_ const char *_Mode)
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
_Check_return_opt_ _CRTIMP int __cdecl _findclose(_In_ intptr_t _FindHandle)