RTEMS 6.1-rc6
Loading...
Searching...
No Matches
hexdump.h
1/*
2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by the University of
16 * California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)hexdump.h 8.1 (Berkeley) 6/6/93
34 * $FreeBSD: src/usr.bin/hexdump/hexdump.h,v 1.9 2004/07/11 01:11:12 tjr Exp $
35 */
36
37#include <wchar.h>
38
39typedef struct _pr {
40 struct _pr *nextpr; /* next print unit */
41#define F_ADDRESS 0x001 /* print offset */
42#define F_BPAD 0x002 /* blank pad */
43#define F_C 0x004 /* %_c */
44#define F_CHAR 0x008 /* %c */
45#define F_DBL 0x010 /* %[EefGf] */
46#define F_INT 0x020 /* %[di] */
47#define F_P 0x040 /* %_p */
48#define F_STR 0x080 /* %s */
49#define F_U 0x100 /* %_u */
50#define F_UINT 0x200 /* %[ouXx] */
51#define F_TEXT 0x400 /* no conversions */
52 u_int flags; /* flag values */
53 int bcnt; /* byte count */
54 char *cchar; /* conversion character */
55 char *fmt; /* printf format */
56 char *nospace; /* no whitespace version */
57 int mbleft; /* bytes left of multibyte char. */
58 mbstate_t mbstate; /* conversion state */
59} PR;
60
61typedef struct _fu {
62 struct _fu *nextfu; /* next format unit */
63 struct _pr *nextpr; /* next print unit */
64#define F_IGNORE 0x01 /* %_A */
65#define F_SETREP 0x02 /* rep count set, not default */
66 u_int flags; /* flag values */
67 int reps; /* repetition count */
68 int bcnt; /* byte count */
69 char *fmt; /* format string */
70} FU;
71
72typedef struct _fs { /* format strings */
73 struct _fs *nextfs; /* linked list of format strings */
74 struct _fu *nextfu; /* linked list of format units */
75 int bcnt;
76} FS;
77
78#if 0
79extern FS *fshead; /* head of format strings list */
80extern FU *endfu; /* format at end-of-data */
81extern int blocksize; /* data block size */
82extern int exitval; /* final exit value */
83extern int odmode; /* are we acting as od(1)? */
84extern int length; /* amount of data to read */
85extern off_t skip; /* amount of data to skip at start */
86enum _vflag { ALL, DUP, FIRST, WAIT }; /* -v values */
87extern enum _vflag vflag;
88#endif
89
90#include <setjmp.h>
91#include <stdio.h>
92
93enum _vflag { ALL, DUP, FIRST, WAIT }; /* -v values */
95 FS *fshead; /* head of format strings list */
96 FU *endfu; /* format at end-of-data */
97 int blocksize; /* data block size */
98 int exitval; /* final exit value */
99 int odmode; /* are we acting as od(1)? */
100 int length; /* amount of data to read */
101 off_t skip; /* amount of data to skip at start */
102 enum _vflag vflag;
103
104 off_t address;
105 off_t eaddress;
106 int ateof;
107 u_char *curp;
108 u_char *savp;
109 int done;
110
111 FILE* hdstdin;
112
113 int exit_code;
114 jmp_buf exit_jmp;
116
117#define fshead globals->fshead
118#define endfu globals->endfu
119#define blocksize globals->blocksize
120#define exitval globals->exitval
121#define odmode globals->odmode
122#define length globals->length
123#define skip globals->skip
124#define vflag globals->vflag
125
126#define address globals->address
127#define eaddress globals->eaddress
128#define ateof globals->ateof
129#define curp globals->curp
130#define savp globals->savp
131#define done globals->done
132
133#define hdstdin globals->hdstdin
134
135#define exit_jump &(globals->exit_jmp)
136
137#define add rtems_shell_hexdump_add
138#define addfile rtems_shell_hexdump_addfile
139#define badcnt rtems_shell_hexdump_badcnt
140#define badconv rtems_shell_hexdump_badconv
141#define badfmt rtems_shell_hexdump_badfmt
142#define badsfmt rtems_shell_hexdump_badsfmt
143#define bpad rtems_shell_hexdump_bpad
144#define conv_c rtems_shell_hexdump_conv_c
145#define conv_u rtems_shell_hexdump_conv_u
146#define display rtems_shell_hexdump_display
147#define doskip rtems_shell_hexdump_doskip
148#define escape rtems_shell_hexdump_escape
149#define get rtems_shell_hexdump_get
150#define newsyntax rtems_shell_hexdump_newsyntax
151#define next rtems_shell_hexdump_next
152#define nomem rtems_shell_hexdump_nomem
153#define oldsyntax rtems_shell_hexdump_oldsyntax
154#define peek rtems_shell_hexdump_peek
155#define rewrite rtems_shell_hexdump_rewrite
156#define size rtems_shell_hexdump_size
157#define usage rtems_shell_hexdump_usage
158
159void add(rtems_shell_hexdump_globals*, const char *);
160void addfile(rtems_shell_hexdump_globals*, char *);
161void badcnt(rtems_shell_hexdump_globals*, char *);
162void badconv(rtems_shell_hexdump_globals*, char *);
163void badfmt(rtems_shell_hexdump_globals*, const char *);
164void badsfmt(rtems_shell_hexdump_globals*);
165void bpad(PR *);
166void conv_c(rtems_shell_hexdump_globals*, PR *, u_char *, size_t);
167void conv_u(rtems_shell_hexdump_globals*, PR *, u_char *);
168void display(rtems_shell_hexdump_globals*);
169void doskip(rtems_shell_hexdump_globals*, const char *, int);
170void escape(char *);
171u_char *get(rtems_shell_hexdump_globals*);
172void newsyntax(rtems_shell_hexdump_globals*, int, char ***);
173int next(rtems_shell_hexdump_globals*, char **);
174void nomem(void);
175void oldsyntax(rtems_shell_hexdump_globals*, int, char ***);
176size_t peek(rtems_shell_hexdump_globals*, u_char *, size_t);
177void rewrite(rtems_shell_hexdump_globals*, FS *);
178int size(rtems_shell_hexdump_globals*, FS *);
179void usage(rtems_shell_hexdump_globals*);
180
181#define exit(ec) rtems_shell_hexdump_exit(globals, ec)
182
183void rtems_shell_hexdump_exit(rtems_shell_hexdump_globals* globals, int code);
Definition: hexdump.h:72
Definition: hexdump.h:61
Definition: hexdump.h:39
Definition: inftrees.h:24
Definition: hexdump.h:94