timed tail for logfiles. Display loglines given a minimum date and/or a maximum date.
c
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

ttail.h 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #ifndef _ttail_h__
  2. #define _ttail_h__
  3. #include <errno.h>
  4. #include <unistd.h>
  5. #include <stdlib.h>
  6. #include <stdio.h>
  7. #include <string.h>
  8. #include <ctype.h>
  9. #include <getopt.h>
  10. #include <time.h>
  11. #include <regex.h>
  12. #include <sys/types.h>
  13. struct _ttail_s
  14. {
  15. char **logfile_name; /*!< logfiles name */
  16. FILE **logfile; /*!< logfiles pointers */
  17. size_t logfile_sz; /*<! logfiles count */
  18. /*! A regex matching the datetime prefix in loglines */
  19. regex_t date_prefix;
  20. int date_prefix_flag;
  21. /*! A strptime format matching datetime in logfile */
  22. char *fmt;
  23. int verbose;
  24. };
  25. typedef struct _ttail_s ttail_t;
  26. /**@brief Parse cli arguments and return a ttail_t
  27. *@param int argc
  28. *@param char** argv
  29. *@return NULL on error
  30. */
  31. ttail_t *ttail_init(int argc, char **argv);
  32. /**@brief Add a logfile
  33. *@param ttail_t*
  34. *@param const char * filename
  35. *@return 0 if no errors -1 if fatal error
  36. */
  37. int ttail_add_logfile(ttail_t*, const char*);
  38. /**@brief Set a date prefix regex
  39. *@param ttail_t*
  40. *@param const char * regex
  41. *@return 0 if no errors
  42. */
  43. int ttail_set_prefix(ttail_t*, const char*);
  44. void ttail_free(ttail_t*);
  45. #endif