123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- /*
- * Copyright 2017 Yann Weber
- *
- * This file is part of Ttail.
- *
- * Ttail is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * any later version.
- *
- * Ttail is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Ttail. If not, see <http://www.gnu.org/licenses/>.
- */
- #ifndef _ttail_h__
- #define _ttail_h__
-
- #include <ctype.h>
- #include <errno.h>
- #include <getopt.h>
- #include <regex.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <sys/types.h>
- #include <time.h>
- #include <unistd.h>
-
- typedef struct _ttail_s ttail_t;
-
- #include "config.h"
- #include "ttail_search.h"
-
- #define TTAIL_FLAG_PREFIX 1
- #define TTAIL_FLAG_DATE_MIN 2
- #define TTAIL_FLAG_DATE_MAX 4
- #define TTAIL_FLAG_FORMAT 8
- #define TTAIL_FLAG_EXTENDED_RE 16
- #define TTAIL_FLAG_CI_RE 32
- /**! When set indicate that ttail is in permissive mode */
- #define TTAIL_FLAG_PERMISSIVE 64
-
- #define TTAIL_DEFAULT_FORMATS {"%m",\
- "%A %B %d, %Y %H:%M:%S",\
- "%A",\
- "%B%n%d %H:%M:%S",\
- "%B%n%d %H:%M",\
- "%m/%d/%y %I %p",\
- "%d,%m,%Y %H:%M",\
- "at %A the %dst of %B in %Y",\
- "run job at %I %p,%B %dnd",\
- "%A den %d. %B %Y %H.%M Uhr",\
- "%c",\
- "%d/%B/%Y:%H:%M:%S",\
- "%d/%B/%Y:%H:%M",\
- "%d/%m/%Y:%H:%M:%S",\
- "%d/%m/%Y:%H:%M",\
- "%y/%m/%d",\
- "%Y/%m/%d",\
- "%y-%m-%d",\
- "%Y/%m/%d:%H:%M",NULL}
-
- #define ttail_permissive(t) ( t->flag & TTAIL_FLAG_PERMISSIVE )
- #define ttail_strict_msg() fprintf(stderr, "This error can be non-fatal using \
- -P --permissive flag\n")
-
-
- struct _ttail_s
- {
- char **logfile_name; /*!< logfiles name */
- FILE **logfile; /*!< logfiles pointers */
- size_t logfile_sz; /*<! logfiles count */
-
- /*! A regex matching the datetime prefix in loglines */
- regex_t date_prefix;
- /*! An alternative to regex is to give a constant number of char
- to delete */
- int prefix_sz;
-
- /*! A strptime format matching datetime in logfile */
- char *fmt;
-
- /*! Date min set from cli */
- struct tm date_min;
- struct tm date_max;
-
- int verbose;
- /**@brief Status flag
- *
- *see TTAIL_FLAG_*
- */
- int flag;
-
- ttail_search_t *session;
- };
-
- #endif
|