|
@@ -63,16 +63,16 @@ to be > 0");
|
63
|
63
|
}
|
64
|
64
|
break;
|
65
|
65
|
case 'E':
|
|
66
|
+ if(ttail_set_flag_re_ex(res) < 0)
|
|
67
|
+ {
|
|
68
|
+ goto ttail_init_err;
|
|
69
|
+ }
|
|
70
|
+ break;
|
66
|
71
|
case 'I':
|
67
|
|
- /**@todo checks */
|
68
|
|
- if(res->flag & TTAIL_FLAG_PREFIX)
|
|
72
|
+ if(ttail_set_flag_re_ci(res) < 0)
|
69
|
73
|
{
|
70
|
|
- fprintf(stderr, "-E & -I options \
|
71
|
|
-have to be set BEFORE -r option\n");
|
72
|
74
|
goto ttail_init_err;
|
73
|
75
|
}
|
74
|
|
- res->flag |= c=='E'?TTAIL_FLAG_EXTENDED_RE:\
|
75
|
|
- REG_ICASE;
|
76
|
76
|
break;
|
77
|
77
|
case 'f':
|
78
|
78
|
if(res->flag & TTAIL_FLAG_FORMAT)
|
|
@@ -248,7 +248,7 @@ int ttail_set_prefix(ttail_t* res, const char* regex)
|
248
|
248
|
{
|
249
|
249
|
cflags |= REG_EXTENDED;
|
250
|
250
|
}
|
251
|
|
- if(res->flag & TTAIL_FLAG_EXTENDED_CI)
|
|
251
|
+ if(res->flag & TTAIL_FLAG_CI_RE)
|
252
|
252
|
{
|
253
|
253
|
cflags |= REG_ICASE;
|
254
|
254
|
}
|
|
@@ -298,6 +298,42 @@ int ttail_set_fmt(ttail_t* t, const char* fmt)
|
298
|
298
|
return 0;
|
299
|
299
|
}
|
300
|
300
|
|
|
301
|
+/**@brief This function is used by bot @ref ttail_set_flag_re_ex() and
|
|
302
|
+ *ttail_set_flag_re_ci() function
|
|
303
|
+ *@param t ttail_t*
|
|
304
|
+ *@return -1 on error else 0
|
|
305
|
+ */
|
|
306
|
+static int _ttail_common_set_flag_re(ttail_t* ttail)
|
|
307
|
+{
|
|
308
|
+ if(ttail->flag & TTAIL_FLAG_PREFIX)
|
|
309
|
+ {
|
|
310
|
+ fprintf(stderr, "Regex flags has to be set BEFORE the \
|
|
311
|
+prefix\n");
|
|
312
|
+ return -1;
|
|
313
|
+ }
|
|
314
|
+ return 0;
|
|
315
|
+}
|
|
316
|
+
|
|
317
|
+int ttail_set_flag_re_ex(ttail_t* ttail)
|
|
318
|
+{
|
|
319
|
+ if(_ttail_common_set_flag_re(ttail) < 0)
|
|
320
|
+ {
|
|
321
|
+ return -1;
|
|
322
|
+ }
|
|
323
|
+ ttail->flag |= TTAIL_FLAG_EXTENDED_RE;
|
|
324
|
+ return 0;
|
|
325
|
+}
|
|
326
|
+
|
|
327
|
+int ttail_set_flag_re_ci(ttail_t* ttail)
|
|
328
|
+{
|
|
329
|
+ if(_ttail_common_set_flag_re(ttail) < 0)
|
|
330
|
+ {
|
|
331
|
+ return -1;
|
|
332
|
+ }
|
|
333
|
+ ttail->flag |= TTAIL_FLAG_CI_RE;
|
|
334
|
+ return 0;
|
|
335
|
+}
|
|
336
|
+
|
301
|
337
|
int ttail_set_dates(ttail_t* res, char* dates[2])
|
302
|
338
|
{
|
303
|
339
|
int c, ret;
|