|
@@ -42,11 +42,8 @@ int _ttail_search_closest_files(ttail_t* t)
|
42
|
42
|
}
|
43
|
43
|
else if (ret == 1)
|
44
|
44
|
{
|
45
|
|
- if(t->verbose)
|
46
|
|
- {
|
47
|
|
- fprintf(stderr, "Warning : unable to find \
|
48
|
|
-a valid date in '%s'\n", t->logfile_name[i]);
|
49
|
|
- }
|
|
45
|
+ fprintf(stderr, "Warning : unable to find a valid date \
|
|
46
|
+in '%s'\n", t->logfile_name[i]);
|
50
|
47
|
free(ftm[i]);
|
51
|
48
|
ftm[i] = NULL;
|
52
|
49
|
fclose(t->logfile[i]);
|
|
@@ -231,12 +228,7 @@ int _ttail_search_files_binary_search(ttail_t* t, const struct tm* in,
|
231
|
228
|
|
232
|
229
|
*id = *off = 0;
|
233
|
230
|
valid = 0;
|
234
|
|
- if(ttail_tm_cmp(&(ftm[0][0]), in) > 0)
|
235
|
|
- {
|
236
|
|
- *off = *id = 0;
|
237
|
|
- return 0;
|
238
|
|
- }
|
239
|
|
- while(1)
|
|
231
|
+ while(*id < t->logfile_sz)
|
240
|
232
|
{
|
241
|
233
|
if(!ftm[*id])
|
242
|
234
|
{
|
|
@@ -327,7 +319,8 @@ running binary search algorithm in '%s'\n", t->logfile_name[*id]);
|
327
|
319
|
}
|
328
|
320
|
if(!valid)
|
329
|
321
|
{
|
330
|
|
- fprintf(stderr, "No files to scan");
|
|
322
|
+ fprintf(stderr, "No files to scan\n");
|
|
323
|
+ return 0;
|
331
|
324
|
}
|
332
|
325
|
/* the answer is somewhere in *id file */
|
333
|
326
|
*off = _ttail_from_search_from_end(t, *id, in);
|