dump.h 1.7 KB

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