Mercurial > hg > xemacs-beta
comparison lib-src/hexl.c @ 442:abe6d1db359e r21-2-36
Import from CVS: tag r21-2-36
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:35:02 +0200 |
parents | 8de8e3f6228a |
children | 061f4f90f874 06dd936cde16 |
comparison
equal
deleted
inserted
replaced
441:72a7cfa4a488 | 442:abe6d1db359e |
---|---|
2 | 2 |
3 #include <config.h> | 3 #include <config.h> |
4 | 4 |
5 #include <stdio.h> | 5 #include <stdio.h> |
6 #include <ctype.h> | 6 #include <ctype.h> |
7 #ifdef WINDOWSNT | 7 #ifdef WIN32_NATIVE |
8 #include <io.h> | 8 #include <io.h> |
9 #include <fcntl.h> | 9 #include <fcntl.h> |
10 #endif | 10 #endif |
11 | 11 |
12 #if __STDC__ || defined(STDC_HEADERS) | 12 #if __STDC__ || defined(STDC_HEADERS) |
13 #include <stdlib.h> | 13 #include <stdlib.h> |
14 #ifdef HAVE_UNISTD_H | |
14 #include <unistd.h> | 15 #include <unistd.h> |
16 #endif | |
15 #include <string.h> | 17 #include <string.h> |
16 #endif | 18 #endif |
17 | 19 |
18 #define DEFAULT_GROUPING 0x01 | 20 #define DEFAULT_GROUPING 0x01 |
19 #define DEFAULT_BASE 16 | 21 #define DEFAULT_BASE 16 |
140 | 142 |
141 if (un_flag) | 143 if (un_flag) |
142 { | 144 { |
143 char buf[18]; | 145 char buf[18]; |
144 | 146 |
145 #ifdef WINDOWSNT | 147 #ifdef WIN32_NATIVE |
146 _setmode (_fileno (stdout), O_BINARY); | 148 _setmode (_fileno (stdout), O_BINARY); |
147 #endif | 149 #endif |
148 for (;;) | 150 for (;;) |
149 { | 151 { |
150 register int i, c, d; | 152 register int i, c = 0, d; |
151 | 153 |
152 #define hexchar(x) (isdigit (x) ? x - '0' : x - 'a' + 10) | 154 #define hexchar(x) (isdigit (x) ? x - '0' : x - 'a' + 10) |
153 | 155 |
154 fread (buf, 1, 10, fp); /* skip 10 bytes */ | 156 fread (buf, 1, 10, fp); /* skip 10 bytes */ |
155 | 157 |
183 } | 185 } |
184 } | 186 } |
185 } | 187 } |
186 else | 188 else |
187 { | 189 { |
188 #ifdef WINDOWSNT | 190 #ifdef WIN32_NATIVE |
189 _setmode (_fileno (fp), O_BINARY); | 191 _setmode (_fileno (fp), O_BINARY); |
190 #endif | 192 #endif |
191 address = 0; | 193 address = 0; |
192 string[0] = ' '; | 194 string[0] = ' '; |
193 string[17] = '\0'; | 195 string[17] = '\0'; |
194 for (;;) | 196 for (;;) |
195 { | 197 { |
196 register int i, c; | 198 register int i, c = 0; |
197 | 199 |
198 for (i=0; i < 16; ++i) | 200 for (i=0; i < 16; ++i) |
199 { | 201 { |
200 if ((c = getc (fp)) == EOF) | 202 if ((c = getc (fp)) == EOF) |
201 { | 203 { |
240 } while (*argv != NULL); | 242 } while (*argv != NULL); |
241 return 0; | 243 return 0; |
242 } | 244 } |
243 | 245 |
244 void | 246 void |
245 usage () | 247 usage (void) |
246 { | 248 { |
247 (void) fprintf (stderr, "usage: %s [-de] [-iso]\n", progname); | 249 fprintf (stderr, "Usage: %s [-de] [-iso]\n", progname); |
248 exit (1); | 250 exit (1); |
249 } | 251 } |