hexdump.h revision 80290
11590Srgrimes/* 21590Srgrimes * Copyright (c) 1989, 1993 31590Srgrimes * The Regents of the University of California. All rights reserved. 41590Srgrimes * 51590Srgrimes * Redistribution and use in source and binary forms, with or without 61590Srgrimes * modification, are permitted provided that the following conditions 71590Srgrimes * are met: 81590Srgrimes * 1. Redistributions of source code must retain the above copyright 91590Srgrimes * notice, this list of conditions and the following disclaimer. 101590Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 111590Srgrimes * notice, this list of conditions and the following disclaimer in the 121590Srgrimes * documentation and/or other materials provided with the distribution. 131590Srgrimes * 3. All advertising materials mentioning features or use of this software 141590Srgrimes * must display the following acknowledgement: 151590Srgrimes * This product includes software developed by the University of 161590Srgrimes * California, Berkeley and its contributors. 171590Srgrimes * 4. Neither the name of the University nor the names of its contributors 181590Srgrimes * may be used to endorse or promote products derived from this software 191590Srgrimes * without specific prior written permission. 201590Srgrimes * 211590Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 221590Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 231590Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 241590Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 251590Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 261590Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 271590Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 281590Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 291590Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 301590Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 311590Srgrimes * SUCH DAMAGE. 321590Srgrimes * 331590Srgrimes * @(#)hexdump.h 8.1 (Berkeley) 6/6/93 3480290Sobrien * $FreeBSD: head/usr.bin/hexdump/hexdump.h 80290 2001-07-24 14:11:09Z obrien $ 351590Srgrimes */ 361590Srgrimes 371590Srgrimestypedef struct _pr { 381590Srgrimes struct _pr *nextpr; /* next print unit */ 391590Srgrimes#define F_ADDRESS 0x001 /* print offset */ 401590Srgrimes#define F_BPAD 0x002 /* blank pad */ 411590Srgrimes#define F_C 0x004 /* %_c */ 421590Srgrimes#define F_CHAR 0x008 /* %c */ 431590Srgrimes#define F_DBL 0x010 /* %[EefGf] */ 441590Srgrimes#define F_INT 0x020 /* %[di] */ 451590Srgrimes#define F_P 0x040 /* %_p */ 461590Srgrimes#define F_STR 0x080 /* %s */ 471590Srgrimes#define F_U 0x100 /* %_u */ 481590Srgrimes#define F_UINT 0x200 /* %[ouXx] */ 491590Srgrimes#define F_TEXT 0x400 /* no conversions */ 501590Srgrimes u_int flags; /* flag values */ 511590Srgrimes int bcnt; /* byte count */ 521590Srgrimes char *cchar; /* conversion character */ 531590Srgrimes char *fmt; /* printf format */ 541590Srgrimes char *nospace; /* no whitespace version */ 551590Srgrimes} PR; 561590Srgrimes 571590Srgrimestypedef struct _fu { 581590Srgrimes struct _fu *nextfu; /* next format unit */ 591590Srgrimes struct _pr *nextpr; /* next print unit */ 601590Srgrimes#define F_IGNORE 0x01 /* %_A */ 611590Srgrimes#define F_SETREP 0x02 /* rep count set, not default */ 621590Srgrimes u_int flags; /* flag values */ 631590Srgrimes int reps; /* repetition count */ 641590Srgrimes int bcnt; /* byte count */ 651590Srgrimes char *fmt; /* format string */ 661590Srgrimes} FU; 671590Srgrimes 681590Srgrimestypedef struct _fs { /* format strings */ 691590Srgrimes struct _fs *nextfs; /* linked list of format strings */ 701590Srgrimes struct _fu *nextfu; /* linked list of format units */ 711590Srgrimes int bcnt; 721590Srgrimes} FS; 731590Srgrimes 741590Srgrimesextern FS *fshead; /* head of format strings list */ 751590Srgrimesextern int blocksize; /* data block size */ 761590Srgrimesenum _vflag { ALL, DUP, FIRST, WAIT }; /* -v values */ 771590Srgrimes 781590Srgrimesvoid add __P((char *)); 791590Srgrimesvoid addfile __P((char *)); 801590Srgrimesvoid badcnt __P((char *)); 811590Srgrimesvoid badconv __P((char *)); 821590Srgrimesvoid badfmt __P((char *)); 831590Srgrimesvoid badsfmt __P((void)); 841590Srgrimesvoid bpad __P((PR *)); 851590Srgrimesvoid conv_c __P((PR *, u_char *)); 861590Srgrimesvoid conv_u __P((PR *, u_char *)); 871590Srgrimesvoid display __P((void)); 881590Srgrimesvoid doskip __P((char *, int)); 891590Srgrimesvoid escape __P((char *)); 901590Srgrimesu_char *get __P((void)); 911590Srgrimesvoid newsyntax __P((int, char ***)); 921590Srgrimesint next __P((char **)); 931590Srgrimesvoid nomem __P((void)); 941590Srgrimesvoid oldsyntax __P((int, char ***)); 951590Srgrimesvoid rewrite __P((FS *)); 961590Srgrimesint size __P((FS *)); 971590Srgrimesvoid usage __P((void)); 98