dump.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /* vi: set sw=4 ts=4: */
  2. PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
  3. #define F_IGNORE 0x01 /* %_A */
  4. #define F_SETREP 0x02 /* rep count set, not default */
  5. #define F_ADDRESS 0x001 /* print offset */
  6. #define F_BPAD 0x002 /* blank pad */
  7. #define F_C 0x004 /* %_c */
  8. #define F_CHAR 0x008 /* %c */
  9. #define F_DBL 0x010 /* %[EefGf] */
  10. #define F_INT 0x020 /* %[di] */
  11. #define F_P 0x040 /* %_p */
  12. #define F_STR 0x080 /* %s */
  13. #define F_U 0x100 /* %_u */
  14. #define F_UINT 0x200 /* %[ouXx] */
  15. #define F_TEXT 0x400 /* no conversions */
  16. enum dump_vflag_t { ALL, DUP, FIRST, WAIT }; /* -v values */
  17. typedef struct PR {
  18. struct PR *nextpr; /* next print unit */
  19. unsigned flags; /* flag values */
  20. int bcnt; /* byte count */
  21. char *cchar; /* conversion character */
  22. char *fmt; /* printf format */
  23. char *nospace; /* no whitespace version */
  24. } PR;
  25. typedef struct FU {
  26. struct FU *nextfu; /* next format unit */
  27. struct PR *nextpr; /* next print unit */
  28. unsigned flags; /* flag values */
  29. int reps; /* repetition count */
  30. int bcnt; /* byte count */
  31. char *fmt; /* format string */
  32. } FU;
  33. typedef struct FS { /* format strings */
  34. struct FS *nextfs; /* linked list of format strings */
  35. struct FU *nextfu; /* linked list of format units */
  36. int bcnt;
  37. } FS;
  38. typedef struct dumper_t {
  39. off_t dump_skip; /* bytes to skip */
  40. int dump_length; /* max bytes to read */
  41. smallint dump_vflag; /*enum dump_vflag_t*/
  42. FS *fshead;
  43. } dumper_t;
  44. dumper_t* alloc_dumper(void) FAST_FUNC;
  45. extern void bb_dump_add(dumper_t *dumper, const char *fmt) FAST_FUNC;
  46. extern int bb_dump_dump(dumper_t *dumper, char **argv) FAST_FUNC;
  47. POP_SAVED_FUNCTION_VISIBILITY