hexdump.h revision 1591
1100138Sume/* 2100138Sume * Copyright (c) 1989, 1993 3100138Sume * The Regents of the University of California. All rights reserved. 4100138Sume * 5100138Sume * Redistribution and use in source and binary forms, with or without 6100138Sume * modification, are permitted provided that the following conditions 7100138Sume * are met: 8100138Sume * 1. Redistributions of source code must retain the above copyright 9100138Sume * notice, this list of conditions and the following disclaimer. 10100138Sume * 2. Redistributions in binary form must reproduce the above copyright 11100138Sume * notice, this list of conditions and the following disclaimer in the 12100138Sume * documentation and/or other materials provided with the distribution. 13100138Sume * 3. All advertising materials mentioning features or use of this software 14100138Sume * must display the following acknowledgement: 15100138Sume * This product includes software developed by the University of 16100138Sume * California, Berkeley and its contributors. 17100138Sume * 4. Neither the name of the University nor the names of its contributors 18100138Sume * may be used to endorse or promote products derived from this software 19100138Sume * without specific prior written permission. 20100138Sume * 21100138Sume * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22100138Sume * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23100138Sume * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24100138Sume * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25100138Sume * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26100138Sume * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27100138Sume * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28100138Sume * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29100138Sume * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30100138Sume * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31111010Snectar * SUCH DAMAGE. 32100138Sume * 33100138Sume * @(#)hexdump.h 8.1 (Berkeley) 6/6/93 34107378Sume */ 35100138Sume 36100138Sumetypedef struct _pr { 37100138Sume struct _pr *nextpr; /* next print unit */ 38100138Sume#define F_ADDRESS 0x001 /* print offset */ 39100138Sume#define F_BPAD 0x002 /* blank pad */ 40100138Sume#define F_C 0x004 /* %_c */ 41111010Snectar#define F_CHAR 0x008 /* %c */ 42111010Snectar#define F_DBL 0x010 /* %[EefGf] */ 43100138Sume#define F_INT 0x020 /* %[di] */ 44100138Sume#define F_P 0x040 /* %_p */ 45100138Sume#define F_STR 0x080 /* %s */ 46100138Sume#define F_U 0x100 /* %_u */ 47100138Sume#define F_UINT 0x200 /* %[ouXx] */ 48100138Sume#define F_TEXT 0x400 /* no conversions */ 49100138Sume u_int flags; /* flag values */ 50100138Sume int bcnt; /* byte count */ 51100138Sume char *cchar; /* conversion character */ 52100138Sume char *fmt; /* printf format */ 53100138Sume char *nospace; /* no whitespace version */ 54100138Sume} PR; 55100138Sume 56100138Sumetypedef struct _fu { 57100138Sume struct _fu *nextfu; /* next format unit */ 58100138Sume struct _pr *nextpr; /* next print unit */ 59100138Sume#define F_IGNORE 0x01 /* %_A */ 60100138Sume#define F_SETREP 0x02 /* rep count set, not default */ 61100138Sume u_int flags; /* flag values */ 62100138Sume int reps; /* repetition count */ 63100138Sume int bcnt; /* byte count */ 64100138Sume char *fmt; /* format string */ 65100138Sume} FU; 66107378Sume 67107378Sumetypedef struct _fs { /* format strings */ 68100138Sume struct _fs *nextfs; /* linked list of format strings */ 69100138Sume struct _fu *nextfu; /* linked list of format units */ 70100138Sume int bcnt; 71255328Sjilles} FS; 72107378Sume 73234329Seadlerextern FS *fshead; /* head of format strings list */ 74114443Snectarextern int blocksize; /* data block size */ 75107378Sumeenum _vflag { ALL, DUP, FIRST, WAIT }; /* -v values */ 76107378Sume 77107378Sumevoid add __P((char *)); 78107378Sumevoid addfile __P((char *)); 79107378Sumevoid badcnt __P((char *)); 80107378Sumevoid badconv __P((char *)); 81107378Sumevoid badfmt __P((char *)); 82100138Sumevoid badsfmt __P((void)); 83100138Sumevoid bpad __P((PR *)); 84100138Sumevoid conv_c __P((PR *, u_char *)); 85100138Sumevoid conv_u __P((PR *, u_char *)); 86100138Sumevoid display __P((void)); 87100138Sumevoid doskip __P((char *, int)); 88100138Sumevoid err __P((const char *, ...)); 89100138Sumevoid *emalloc __P((int)); 90100138Sumevoid escape __P((char *)); 91235640Smarcelu_char *get __P((void)); 92100138Sumevoid newsyntax __P((int, char ***)); 93100138Sumeint next __P((char **)); 94100138Sumevoid nomem __P((void)); 95100138Sumevoid oldsyntax __P((int, char ***)); 96100138Sumevoid rewrite __P((FS *)); 97100138Sumeint size __P((FS *)); 98100138Sumevoid usage __P((void)); 99100138Sume