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.

ttail_search_std.h 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #ifndef _ttail_search_std_h__
  2. #define _ttail_search_std_h__
  3. #include <errno.h>
  4. #include <string.h>
  5. #include <stdlib.h>
  6. typedef struct _ttail_search_stdin_s ttail_search_stdin_t;
  7. /*<! Private search session for stdin */
  8. struct _ttail_search_stdin_s
  9. {
  10. char *buff;
  11. size_t buff_sz;
  12. };
  13. #include "config.h"
  14. #include "ttail.h"
  15. #include "ttail_search.h"
  16. /**@brief Convenient wrapper for getline
  17. *@param ttail_t* TTAIL
  18. *@param size_t ID file id
  19. *@return @ref getline()
  20. */
  21. #define ttail_std_getline(TTAIL) (getline(\
  22. &(TTAIL->session->std.buff), &(TTAIL->session->std.buff_sz), stdin))
  23. /*<!Accessor to getline wrapper buffer */
  24. #define ttail_std_getline_buff(TTAIL) (TTAIL->session->std.buff)
  25. /**@brief init private session members
  26. *@patam ttail_t* t
  27. *@return -1 on error else 0
  28. *@todo checks
  29. */
  30. int _ttail_search_closest_std_init(ttail_t* t);
  31. /**@brief @ref ttail_search_closest() implementation for stdin
  32. *@note when returns ttail->session->std.buff contains the first
  33. *line to print
  34. *@param ttail_t*
  35. *@param struct tm* tmin
  36. *@return 0 if ok -1 if fatal error 1 if not found
  37. *@todo checks
  38. */
  39. int _ttail_search_closest_stdin(ttail_t*);
  40. /**@brief Output result loglines to stdout
  41. *@param ttail_t*
  42. *@param int fd
  43. *@todo checks
  44. */
  45. void _ttail_search_print_stdin(ttail_t*, int);
  46. /**@brief free private session members
  47. *@patam ttail_t* t
  48. */
  49. void _ttail_search_stdin_free(ttail_t* t);
  50. #endif