blob: 10fc5d900137a939e174b704cd5ccafc60980df0 [file] [log] [blame]
"Robert P. J. Day"63fc1a92006-07-02 19:47:05 +00001/* vi: set sw=4 ts=4: */
Denis Vlasenko98636eb2008-05-09 17:59:34 +00002
Denis Vlasenkof81e8db2009-04-09 12:35:13 +00003PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
Denis Vlasenko98636eb2008-05-09 17:59:34 +00004
Denis Vlasenko55f79122008-07-16 11:00:16 +00005enum dump_vflag_t { ALL, DUP, FIRST, WAIT }; /* -v values */
Glenn L McGrath55b2ded2001-11-02 11:40:44 +00006
Denys Vlasenko112453a2020-10-25 23:44:22 +01007typedef 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
16typedef 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
25typedef 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 McGrath55b2ded2001-11-02 11:40:44 +000030
Denis Vlasenko55f79122008-07-16 11:00:16 +000031typedef struct dumper_t {
32 off_t dump_skip; /* bytes to skip */
33 int dump_length; /* max bytes to read */
Denys Vlasenkoe4dcba12010-10-28 18:57:19 +020034 smallint dump_vflag; /*enum dump_vflag_t*/
Denis Vlasenko55f79122008-07-16 11:00:16 +000035 FS *fshead;
Denys Vlasenko4d161612021-06-17 23:53:30 +020036 const char *xxd_eofstring;
Denys Vlasenko2c436672021-06-18 00:59:17 +020037 off_t address; /* address/offset in stream */
Denys Vlasenko4d161612021-06-17 23:53:30 +020038 long long xxd_displayoff;
Denis Vlasenko55f79122008-07-16 11:00:16 +000039} dumper_t;
Manuel Novoa III cad53642003-03-19 09:13:01 +000040
Denis Vlasenko55f79122008-07-16 11:00:16 +000041dumper_t* alloc_dumper(void) FAST_FUNC;
42extern void bb_dump_add(dumper_t *dumper, const char *fmt) FAST_FUNC;
43extern int bb_dump_dump(dumper_t *dumper, char **argv) FAST_FUNC;
Denis Vlasenko98636eb2008-05-09 17:59:34 +000044
Denis Vlasenkof81e8db2009-04-09 12:35:13 +000045POP_SAVED_FUNCTION_VISIBILITY