blob: 925270d9ccbf63d5d8e75c20eaf4ab886ae3ba87 [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
Glenn L McGrath55b2ded2001-11-02 11:40:44 +00005#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
Denis Vlasenko55f79122008-07-16 11:00:16 +000019enum dump_vflag_t { ALL, DUP, FIRST, WAIT }; /* -v values */
Glenn L McGrath55b2ded2001-11-02 11:40:44 +000020
Denis Vlasenko55f79122008-07-16 11:00:16 +000021typedef struct PR {
22 struct PR *nextpr; /* next print unit */
Denis Vlasenkobd9874d2008-07-16 07:22:14 +000023 unsigned flags; /* flag values */
Glenn L McGrath55b2ded2001-11-02 11:40:44 +000024 int bcnt; /* byte count */
25 char *cchar; /* conversion character */
26 char *fmt; /* printf format */
27 char *nospace; /* no whitespace version */
28} PR;
29
Denis Vlasenko55f79122008-07-16 11:00:16 +000030typedef struct FU {
31 struct FU *nextfu; /* next format unit */
32 struct PR *nextpr; /* next print unit */
Denis Vlasenkobd9874d2008-07-16 07:22:14 +000033 unsigned flags; /* flag values */
Glenn L McGrath55b2ded2001-11-02 11:40:44 +000034 int reps; /* repetition count */
35 int bcnt; /* byte count */
36 char *fmt; /* format string */
37} FU;
38
Denis Vlasenko55f79122008-07-16 11:00:16 +000039typedef struct FS { /* format strings */
40 struct FS *nextfs; /* linked list of format strings */
41 struct FU *nextfu; /* linked list of format units */
Glenn L McGrath55b2ded2001-11-02 11:40:44 +000042 int bcnt;
43} FS;
44
Denis Vlasenko55f79122008-07-16 11:00:16 +000045typedef struct dumper_t {
46 off_t dump_skip; /* bytes to skip */
47 int dump_length; /* max bytes to read */
48 smallint dump_vflag; /*enum dump_vflag_t*/
49 FS *fshead;
50} dumper_t;
Manuel Novoa III cad53642003-03-19 09:13:01 +000051
Denis Vlasenko55f79122008-07-16 11:00:16 +000052dumper_t* alloc_dumper(void) FAST_FUNC;
53extern void bb_dump_add(dumper_t *dumper, const char *fmt) FAST_FUNC;
54extern int bb_dump_dump(dumper_t *dumper, char **argv) FAST_FUNC;
Denis Vlasenko98636eb2008-05-09 17:59:34 +000055
Denis Vlasenkof81e8db2009-04-09 12:35:13 +000056POP_SAVED_FUNCTION_VISIBILITY