xref: /original-bsd/usr.bin/hexdump/hexdump.h (revision abd50c55)
1 /*
2  * Copyright (c) 1989 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms are permitted
6  * provided that the above copyright notice and this paragraph are
7  * duplicated in all such forms and that any documentation,
8  * advertising materials, and other materials related to such
9  * distribution and use acknowledge that the software was developed
10  * by the University of California, Berkeley.  The name of the
11  * University may not be used to endorse or promote products derived
12  * from this software without specific prior written permission.
13  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16  *
17  *	@(#)hexdump.h	5.3 (Berkeley) 05/07/90
18  */
19 
20 typedef struct _pr {
21 	struct _pr *nextpr;		/* next print unit */
22 #define	F_ADDRESS	0x001		/* print offset */
23 #define	F_BPAD		0x002		/* blank pad */
24 #define	F_C		0x004		/* %_c */
25 #define	F_CHAR		0x008		/* %c */
26 #define	F_DBL		0x010		/* %[EefGf] */
27 #define	F_INT		0x020		/* %[di] */
28 #define	F_P		0x040		/* %_p */
29 #define	F_STR		0x080		/* %s */
30 #define	F_U		0x100		/* %_u */
31 #define	F_UINT		0x200		/* %[ouXx] */
32 #define	F_TEXT		0x400		/* no conversions */
33 	u_int flags;			/* flag values */
34 	int bcnt;			/* byte count */
35 	char *cchar;			/* conversion character */
36 	char *fmt;			/* printf format */
37 	char *nospace;			/* no whitespace version */
38 } PR;
39 
40 typedef struct _fu {
41 	struct _fu *nextfu;		/* next format unit */
42 	struct _pr *nextpr;		/* next print unit */
43 #define	F_IGNORE	0x01		/* %_A */
44 #define	F_SETREP	0x02		/* rep count set, not default */
45 	u_int flags;			/* flag values */
46 	int reps;			/* repetition count */
47 	int bcnt;			/* byte count */
48 	char *fmt;			/* format string */
49 } FU;
50 
51 typedef struct _fs {			/* format strings */
52 	struct _fs *nextfs;		/* linked list of format strings */
53 	struct _fu *nextfu;		/* linked list of format units */
54 	int bcnt;
55 } FS;
56 
57 extern FS *fshead;			/* head of format strings list */
58 extern int blocksize;			/* data block size */
59 enum _vflag { ALL, DUP, FIRST, WAIT };	/* -v values */
60 char *emalloc();
61