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.

main.c 538B

1234567891011121314151617181920212223242526272829303132
  1. #include "include/ttail.h"
  2. #include "include/ttail_init.h"
  3. int main(int argc, char **argv)
  4. {
  5. int res;
  6. ttail_t *ttail;
  7. if(!(ttail = ttail_init(argc, argv)))
  8. {
  9. usage();
  10. return 1;
  11. }
  12. if(ttail_init_check(ttail) < 0)
  13. {
  14. usage();
  15. ttail_free(ttail);
  16. return 1;
  17. }
  18. res = ttail_search_closest(ttail);
  19. if(res < 0)
  20. {
  21. fprintf(stderr, "Error while searching through files\n");
  22. return 1;
  23. }
  24. else if (res == 1)
  25. {
  26. return 0; /* not found, no line to print */
  27. }
  28. ttail_search_print_res(ttail);
  29. ttail_free(ttail);
  30. return res;
  31. }