blob: 44f2082b7c40ff868948d72909300caf379f549b [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
3#if __GNUC_PREREQ(4,1)
4# pragma GCC visibility push(hidden)
5#endif
6
Glenn L McGrath55b2ded2001-11-02 11:40:44 +00007#define F_IGNORE 0x01 /* %_A */
8#define F_SETREP 0x02 /* rep count set, not default */
9#define F_ADDRESS 0x001 /* print offset */
10#define F_BPAD 0x002 /* blank pad */
11#define F_C 0x004 /* %_c */
12#define F_CHAR 0x008 /* %c */
13#define F_DBL 0x010 /* %[EefGf] */
14#define F_INT 0x020 /* %[di] */
15#define F_P 0x040 /* %_p */
16#define F_STR 0x080 /* %s */
17#define F_U 0x100 /* %_u */
18#define F_UINT 0x200 /* %[ouXx] */
19#define F_TEXT 0x400 /* no conversions */
20
Denis Vlasenko55f79122008-07-16 11:00:16 +000021enum dump_vflag_t { ALL, DUP, FIRST, WAIT }; /* -v values */
Glenn L McGrath55b2ded2001-11-02 11:40:44 +000022
Denis Vlasenko55f79122008-07-16 11:00:16 +000023typedef struct PR {
24 struct PR *nextpr; /* next print unit */
Denis Vlasenkobd9874d2008-07-16 07:22:14 +000025 unsigned flags; /* flag values */
Glenn L McGrath55b2ded2001-11-02 11:40:44 +000026 int bcnt; /* byte count */
27 char *cchar; /* conversion character */
28 char *fmt; /* printf format */
29 char *nospace; /* no whitespace version */
30} PR;
31
Denis Vlasenko55f79122008-07-16 11:00:16 +000032typedef struct FU {
33 struct FU *nextfu; /* next format unit */
34 struct PR *nextpr; /* next print unit */
Denis Vlasenkobd9874d2008-07-16 07:22:14 +000035 unsigned flags; /* flag values */
Glenn L McGrath55b2ded2001-11-02 11:40:44 +000036 int reps; /* repetition count */
37 int bcnt; /* byte count */
38 char *fmt; /* format string */
39} FU;
40
Denis Vlasenko55f79122008-07-16 11:00:16 +000041typedef struct FS { /* format strings */
42 struct FS *nextfs; /* linked list of format strings */
43 struct FU *nextfu; /* linked list of format units */
Glenn L McGrath55b2ded2001-11-02 11:40:44 +000044 int bcnt;
45} FS;
46
Denis Vlasenko55f79122008-07-16 11:00:16 +000047typedef struct dumper_t {
48 off_t dump_skip; /* bytes to skip */
49 int dump_length; /* max bytes to read */
50 smallint dump_vflag; /*enum dump_vflag_t*/
51 FS *fshead;
52} dumper_t;
Manuel Novoa III cad53642003-03-19 09:13:01 +000053
Denis Vlasenko55f79122008-07-16 11:00:16 +000054dumper_t* alloc_dumper(void) FAST_FUNC;
55extern void bb_dump_add(dumper_t *dumper, const char *fmt) FAST_FUNC;
56extern int bb_dump_dump(dumper_t *dumper, char **argv) FAST_FUNC;
Denis Vlasenko98636eb2008-05-09 17:59:34 +000057
58#if __GNUC_PREREQ(4,1)
59# pragma GCC visibility pop
60#endif