xref: /original-bsd/usr.bin/hexdump/hexdump.h (revision 044d1bee)
1 /*
2  * Copyright (c) 1989 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  *
7  *	@(#)hexdump.h	5.6 (Berkeley) 09/13/92
8  */
9 
10 typedef struct _pr {
11 	struct _pr *nextpr;		/* next print unit */
12 #define	F_ADDRESS	0x001		/* print offset */
13 #define	F_BPAD		0x002		/* blank pad */
14 #define	F_C		0x004		/* %_c */
15 #define	F_CHAR		0x008		/* %c */
16 #define	F_DBL		0x010		/* %[EefGf] */
17 #define	F_INT		0x020		/* %[di] */
18 #define	F_P		0x040		/* %_p */
19 #define	F_STR		0x080		/* %s */
20 #define	F_U		0x100		/* %_u */
21 #define	F_UINT		0x200		/* %[ouXx] */
22 #define	F_TEXT		0x400		/* no conversions */
23 	u_int flags;			/* flag values */
24 	int bcnt;			/* byte count */
25 	char *cchar;			/* conversion character */
26 	char *fmt;			/* printf format */
27 	char *nospace;			/* no whitespace version */
28 } PR;
29 
30 typedef struct _fu {
31 	struct _fu *nextfu;		/* next format unit */
32 	struct _pr *nextpr;		/* next print unit */
33 #define	F_IGNORE	0x01		/* %_A */
34 #define	F_SETREP	0x02		/* rep count set, not default */
35 	u_int flags;			/* flag values */
36 	int reps;			/* repetition count */
37 	int bcnt;			/* byte count */
38 	char *fmt;			/* format string */
39 } FU;
40 
41 typedef struct _fs {			/* format strings */
42 	struct _fs *nextfs;		/* linked list of format strings */
43 	struct _fu *nextfu;		/* linked list of format units */
44 	int bcnt;
45 } FS;
46 
47 extern FS *fshead;			/* head of format strings list */
48 extern int blocksize;			/* data block size */
49 enum _vflag { ALL, DUP, FIRST, WAIT };	/* -v values */
50 
51 void	 add __P((char *));
52 void	 addfile __P((char *));
53 void	 badcnt __P((char *));
54 void	 badconv __P((char *));
55 void	 badfmt __P((char *));
56 void	 badsfmt __P((void));
57 void	 bpad __P((PR *));
58 void	 conv_c __P((PR *, u_char *));
59 void	 conv_u __P((PR *, u_char *));
60 void	 display __P((void));
61 void	 doskip __P((char *, int));
62 void	 err __P((const char *, ...));
63 void	*emalloc __P((int));
64 void	 escape __P((char *));
65 u_char	*get __P((void));
66 void	 newsyntax __P((int, char ***));
67 int	 next __P((char **));
68 void	 nomem __P((void));
69 void	 oldsyntax __P((int, char ***));
70 void	 rewrite __P((FS *));
71 int	 size __P((FS *));
72 void	 usage __P((void));
73