timed tail for logfiles. Display loglines given a minimum date and/or a maximum date.
c
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

dateformats.c 626B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #include "include/dateformats.h"
  2. ttail_datefmt** ttail_date_fmt_init(ttail_options *options)
  3. {
  4. ttail_datefmt **res;
  5. size_t i;
  6. i = 1;
  7. #ifdef TTAIL_FMT_REGEX
  8. i++;
  9. #endif
  10. res = malloc(sizeof(ttail_datefmt*)*i);
  11. if(!res)
  12. {
  13. perror("Fails to allocate formats");
  14. goto ttail_date_fmt_init_alloc_err;
  15. }
  16. i--;
  17. res[i] = NULL;
  18. #ifdef TTAIL_FMT_REGEX
  19. res[i] = ttail_fmt_regex_init(options);
  20. if(!res[i])
  21. {
  22. goto ttail_date_fmt_init_err;
  23. }
  24. i--;
  25. #endif
  26. return res;
  27. ttail_date_fmt_init_err:
  28. i++;
  29. while(res[i]!=NULL)
  30. {
  31. res[i]->cleanup(res[i]);
  32. }
  33. free(res);
  34. ttail_date_fmt_init_alloc_err:
  35. return NULL;
  36. }