comparison lib-src/hexl.c @ 412:697ef44129c6 r21-2-14

Import from CVS: tag r21-2-14
author cvs
date Mon, 13 Aug 2007 11:20:41 +0200
parents de805c49cfc1
children 11054d720c21
comparison
equal deleted inserted replaced
411:12e008d41344 412:697ef44129c6
1 /* Synched up with: FSF 19.28. */ 1 /* Synched up with: FSF 19.28. */
2 2
3 #include <config.h> 3 #include <../src/config.h>
4 4
5 #include <stdio.h> 5 #include <stdio.h>
6 #include <ctype.h> 6 #include <ctype.h>
7 #ifdef WIN32_NATIVE 7 #ifdef MSDOS
8 #include <io.h>
9 #include <fcntl.h> 8 #include <fcntl.h>
10 #endif 9 #endif
11 10
12 #if __STDC__ || defined(STDC_HEADERS) 11 #if __STDC__ || defined(STDC_HEADERS)
13 #include <stdlib.h> 12 #include <stdlib.h>
14 #ifdef HAVE_UNISTD_H
15 #include <unistd.h> 13 #include <unistd.h>
16 #endif
17 #include <string.h> 14 #include <string.h>
18 #endif 15 #endif
19 16
20 #define DEFAULT_GROUPING 0x01 17 #define DEFAULT_GROUPING 0x01
21 #define DEFAULT_BASE 16 18 #define DEFAULT_BASE 16
30 char *progname; 27 char *progname;
31 28
32 void usage (void); 29 void usage (void);
33 30
34 int 31 int
35 main (int argc, char *argv[]) 32 main(argc, argv)
33 int argc;
34 char *argv[];
36 { 35 {
37 register long address; 36 register long address;
38 char string[18]; 37 char string[18];
39 FILE *fp; 38 FILE *fp;
40 39
142 141
143 if (un_flag) 142 if (un_flag)
144 { 143 {
145 char buf[18]; 144 char buf[18];
146 145
147 #ifdef WIN32_NATIVE 146 #ifdef MSDOS
148 _setmode (_fileno (stdout), O_BINARY); 147 (stdout)->_flag &= ~_IOTEXT; /* print binary */
148 _setmode (fileno (stdout), O_BINARY);
149 #endif 149 #endif
150 for (;;) 150 for (;;)
151 { 151 {
152 register int i, c, d; 152 register int i, c, d;
153 153
185 } 185 }
186 } 186 }
187 } 187 }
188 else 188 else
189 { 189 {
190 #ifdef WIN32_NATIVE 190 #ifdef MSDOS
191 _setmode (_fileno (fp), O_BINARY); 191 (fp)->_flag &= ~_IOTEXT; /* read binary */
192 _setmode (fileno (fp), O_BINARY);
192 #endif 193 #endif
193 address = 0; 194 address = 0;
194 string[0] = ' '; 195 string[0] = ' ';
195 string[17] = '\0'; 196 string[17] = '\0';
196 for (;;) 197 for (;;)
242 } while (*argv != NULL); 243 } while (*argv != NULL);
243 return 0; 244 return 0;
244 } 245 }
245 246
246 void 247 void
247 usage (void) 248 usage ()
248 { 249 {
249 (void) fprintf (stderr, "usage: %s [-de] [-iso]\n", progname); 250 (void) fprintf (stderr, "usage: %s [-de] [-iso]\n", progname);
250 exit (1); 251 exit (1);
251 } 252 }