9 |
|
|
10 |
|
#include <stdio.h> |
11 |
|
|
12 |
< |
#ifdef MSDOS |
13 |
< |
#include <fcntl.h> |
14 |
< |
extern int _fmode; |
15 |
< |
#endif |
12 |
> |
#include "platform.h" |
13 |
|
|
17 |
– |
extern int fputs(); |
14 |
|
|
15 |
|
|
16 |
|
int |
38 |
|
if (argc > 1 && !strcmp(argv[1], "-d")) { |
39 |
|
argc--; argv++; |
40 |
|
dim = 1; |
41 |
< |
#ifdef MSDOS |
42 |
< |
setmode(fileno(stdin), _fmode = O_BINARY); |
47 |
< |
#endif |
41 |
> |
SET_DEFAULT_BINARY(); /* for output file */ |
42 |
> |
SET_FILE_BINARY(stdin); |
43 |
|
} else if (argc == 2 && !strcmp(argv[1], "-")) { |
44 |
< |
#ifdef MSDOS |
45 |
< |
setmode(fileno(stdin), O_BINARY); |
51 |
< |
setmode(fileno(stdout), O_BINARY); |
52 |
< |
#endif |
44 |
> |
SET_FILE_BINARY(stdin); |
45 |
> |
SET_FILE_BINARY(stdout); |
46 |
|
getheader(stdin, NULL, NULL); |
47 |
|
copycat(); |
48 |
|
exit(0); |
63 |
|
fclose(fp); |
64 |
|
} |
65 |
|
} |
66 |
< |
if (argc == 1) |
66 |
> |
if (argc == 1) { |
67 |
|
if (dim) { |
68 |
|
getdim(stdin); |
69 |
|
} else { |
70 |
|
getheader(stdin, fputs, stdout); |
71 |
|
putchar('\n'); |
72 |
|
} |
73 |
+ |
} |
74 |
|
exit(0); |
75 |
|
} |
76 |
|
|