annotate lib-src/hexl.c @ 363:972bbb6d6ca2 r21-1-11

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