annotate lib-src/hexl.c @ 96:dbb370e3c29e r20-0final

Import from CVS: tag r20-0final
author cvs
date Mon, 13 Aug 2007 09:12:40 +0200
parents 376386a54a3c
children 972bbb6d6ca2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 /* Synched up with: FSF 19.28. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 #include <../src/config.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 #include <stdio.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 #include <ctype.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 #ifdef MSDOS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 #include <fcntl.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 #if __STDC__ || defined(STDC_HEADERS)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 #include <stdlib.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 #include <unistd.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 #include <string.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 #define DEFAULT_GROUPING 0x01
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 #define DEFAULT_BASE 16
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 #undef TRUE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 #undef FALSE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 #define TRUE (1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 #define FALSE (0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 int base = DEFAULT_BASE, un_flag = FALSE, iso_flag = FALSE, endian = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 int group_by = DEFAULT_GROUPING;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 char *progname;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 void usage (void);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 main(argc, argv)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 int argc;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 char *argv[];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 register long address;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 char string[18];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 FILE *fp;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 progname = *argv++; --argc;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 ** -hex hex dump
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 ** -oct Octal dump
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 ** -group-by-8-bits
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 ** -group-by-16-bits
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 ** -group-by-32-bits
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 ** -group-by-64-bits
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 ** -iso iso character set.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 ** -big-endian Big Endian
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 ** -little-endian Little Endian
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 ** -un || -de from hexl format to binary.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 ** -- End switch list.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 ** <filename> dump filename
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 ** - (as filename == stdin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 while (*argv && *argv[0] == '-' && (*argv)[1])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 /* A switch! */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 if (!strcmp (*argv, "--"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 --argc; argv++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 else if (!strcmp (*argv, "-un") || !strcmp (*argv, "-de"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 un_flag = TRUE;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 --argc; argv++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 else if (!strcmp (*argv, "-hex"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 base = 16;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 --argc; argv++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 else if (!strcmp (*argv, "-iso"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 iso_flag = TRUE;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 --argc; argv++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 else if (!strcmp (*argv, "-oct"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 base = 8;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 --argc; argv++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 else if (!strcmp (*argv, "-big-endian"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 endian = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 --argc; argv++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 else if (!strcmp (*argv, "-little-endian"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 endian = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 --argc; argv++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 else if (!strcmp (*argv, "-group-by-8-bits"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 group_by = 0x00;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 --argc; argv++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 else if (!strcmp (*argv, "-group-by-16-bits"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 group_by = 0x01;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 --argc; argv++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 else if (!strcmp (*argv, "-group-by-32-bits"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 group_by = 0x03;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 --argc; argv++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 else if (!strcmp (*argv, "-group-by-64-bits"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 group_by = 0x07;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 endian = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 --argc; argv++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 (void) fprintf (stderr, "%s: invalid switch: \"%s\".\n", progname,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 *argv);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 usage ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 do
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 if (*argv == NULL)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 fp = stdin;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 char *filename = *argv++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 if (!strcmp (filename, "-"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 fp = stdin;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 else if ((fp = fopen (filename, "r")) == NULL)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 perror (filename);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 continue;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 if (un_flag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 char buf[18];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 #ifdef MSDOS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 (stdout)->_flag &= ~_IOTEXT; /* print binary */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 _setmode (fileno (stdout), O_BINARY);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 for (;;)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 register int i, c, d;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 #define hexchar(x) (isdigit (x) ? x - '0' : x - 'a' + 10)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 fread (buf, 1, 10, fp); /* skip 10 bytes */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 for (i=0; i < 16; ++i)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 if ((c = getc (fp)) == ' ' || c == EOF)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 d = getc (fp);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 c = hexchar (c) * 0x10 + hexchar (d);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 putchar (c);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 if ((i&group_by) == group_by)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 getc (fp);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 if (c == ' ')
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 while ((c = getc (fp)) != '\n' && c != EOF)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 if (c == EOF)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 if (i < 16)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 fread (buf, 1, 18, fp); /* skip 18 bytes */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 #ifdef MSDOS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 (fp)->_flag &= ~_IOTEXT; /* read binary */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 _setmode (fileno (fp), O_BINARY);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 address = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 string[0] = ' ';
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 string[17] = '\0';
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 for (;;)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 register int i, c;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 for (i=0; i < 16; ++i)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 if ((c = getc (fp)) == EOF)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 if (!i)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 fputs (" ", stdout);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 string[i+1] = '\0';
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 if (!i)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 (void) printf ("%08lx: ", address);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 if (iso_flag)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 string[i+1] =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 (c < 0x20 || (c >= 0x7F && c < 0xa0)) ? '.' :c;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 string[i+1] = (c < 0x20 || c >= 0x7F) ? '.' : c;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 (void) printf ("%02x", c);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 if ((i&group_by) == group_by)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 putchar (' ');
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 if (i)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 puts (string);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 if (c == EOF)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 address += 0x10;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 if (fp != stdin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 (void) fclose (fp);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 } while (*argv != NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 return 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 usage ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 (void) fprintf (stderr, "usage: %s [-de] [-iso]\n", progname);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 exit (1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 }