"Robert P. J. Day" | 63fc1a9 | 2006-07-02 19:47:05 +0000 | [diff] [blame] | 1 | /* vi: set sw=4 ts=4: */ |
Denis Vlasenko | 98636eb | 2008-05-09 17:59:34 +0000 | [diff] [blame] | 2 | |
Denis Vlasenko | f81e8db | 2009-04-09 12:35:13 +0000 | [diff] [blame] | 3 | PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN |
Denis Vlasenko | 98636eb | 2008-05-09 17:59:34 +0000 | [diff] [blame] | 4 | |
Denis Vlasenko | 55f7912 | 2008-07-16 11:00:16 +0000 | [diff] [blame] | 5 | enum dump_vflag_t { ALL, DUP, FIRST, WAIT }; /* -v values */ |
Glenn L McGrath | 55b2ded | 2001-11-02 11:40:44 +0000 | [diff] [blame] | 6 | |
Denys Vlasenko | 112453a | 2020-10-25 23:44:22 +0100 | [diff] [blame] | 7 | typedef struct PR { |
| 8 | struct PR *nextpr; /* next print unit */ |
| 9 | unsigned flags; /* flag values */ |
| 10 | int bcnt; /* byte count */ |
| 11 | char *cchar; /* conversion character */ |
| 12 | char *fmt; /* printf format */ |
| 13 | char *nospace; /* no whitespace version */ |
| 14 | } PR; |
| 15 | |
| 16 | typedef struct FU { |
| 17 | struct FU *nextfu; /* next format unit */ |
| 18 | struct PR *nextpr; /* next print unit */ |
| 19 | unsigned flags; /* flag values */ |
| 20 | int reps; /* repetition count */ |
| 21 | int bcnt; /* byte count */ |
| 22 | char *fmt; /* format string */ |
| 23 | } FU; |
| 24 | |
| 25 | typedef struct FS { /* format strings */ |
| 26 | struct FS *nextfs; /* linked list of format strings */ |
| 27 | struct FU *nextfu; /* linked list of format units */ |
| 28 | int bcnt; |
| 29 | } FS; |
Glenn L McGrath | 55b2ded | 2001-11-02 11:40:44 +0000 | [diff] [blame] | 30 | |
Denis Vlasenko | 55f7912 | 2008-07-16 11:00:16 +0000 | [diff] [blame] | 31 | typedef struct dumper_t { |
| 32 | off_t dump_skip; /* bytes to skip */ |
| 33 | int dump_length; /* max bytes to read */ |
Denys Vlasenko | e4dcba1 | 2010-10-28 18:57:19 +0200 | [diff] [blame] | 34 | smallint dump_vflag; /*enum dump_vflag_t*/ |
Denis Vlasenko | 55f7912 | 2008-07-16 11:00:16 +0000 | [diff] [blame] | 35 | FS *fshead; |
Denys Vlasenko | 4d16161 | 2021-06-17 23:53:30 +0200 | [diff] [blame] | 36 | const char *xxd_eofstring; |
Denys Vlasenko | 2c43667 | 2021-06-18 00:59:17 +0200 | [diff] [blame] | 37 | off_t address; /* address/offset in stream */ |
Denys Vlasenko | 4d16161 | 2021-06-17 23:53:30 +0200 | [diff] [blame] | 38 | long long xxd_displayoff; |
Denis Vlasenko | 55f7912 | 2008-07-16 11:00:16 +0000 | [diff] [blame] | 39 | } dumper_t; |
Manuel Novoa III | cad5364 | 2003-03-19 09:13:01 +0000 | [diff] [blame] | 40 | |
Denis Vlasenko | 55f7912 | 2008-07-16 11:00:16 +0000 | [diff] [blame] | 41 | dumper_t* alloc_dumper(void) FAST_FUNC; |
| 42 | extern void bb_dump_add(dumper_t *dumper, const char *fmt) FAST_FUNC; |
| 43 | extern int bb_dump_dump(dumper_t *dumper, char **argv) FAST_FUNC; |
Denis Vlasenko | 98636eb | 2008-05-09 17:59:34 +0000 | [diff] [blame] | 44 | |
Denis Vlasenko | f81e8db | 2009-04-09 12:35:13 +0000 | [diff] [blame] | 45 | POP_SAVED_FUNCTION_VISIBILITY |