dump.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /* vi: set sw=4 ts=4: */
  2. PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
  3. enum dump_vflag_t { ALL, DUP, FIRST, WAIT }; /* -v values */
  4. typedef struct PR {
  5. struct PR *nextpr; /* next print unit */
  6. unsigned flags; /* flag values */
  7. int bcnt; /* byte count */
  8. char *cchar; /* conversion character */
  9. char *fmt; /* printf format */
  10. char *nospace; /* no whitespace version */
  11. } PR;
  12. typedef struct FU {
  13. struct FU *nextfu; /* next format unit */
  14. struct PR *nextpr; /* next print unit */
  15. unsigned flags; /* flag values */
  16. int reps; /* repetition count */
  17. int bcnt; /* byte count */
  18. char *fmt; /* format string */
  19. } FU;
  20. typedef struct FS { /* format strings */
  21. struct FS *nextfs; /* linked list of format strings */
  22. struct FU *nextfu; /* linked list of format units */
  23. int bcnt;
  24. } FS;
  25. typedef struct dumper_t {
  26. off_t dump_skip; /* bytes to skip */
  27. int dump_length; /* max bytes to read */
  28. smallint dump_vflag; /*enum dump_vflag_t*/
  29. FS *fshead;
  30. #if ENABLE_OD
  31. const char *od_eofstring;
  32. #endif
  33. #if ENABLE_XXD
  34. const char *xxd_eofstring;
  35. long long xxd_displayoff;
  36. #endif
  37. off_t address; /* address/offset in stream */
  38. } dumper_t;
  39. dumper_t* alloc_dumper(void) FAST_FUNC;
  40. extern void bb_dump_add(dumper_t *dumper, const char *fmt) FAST_FUNC;
  41. extern int bb_dump_dump(dumper_t *dumper, char **argv) FAST_FUNC;
  42. POP_SAVED_FUNCTION_VISIBILITY