6 |
|
*/ |
7 |
|
|
8 |
|
#include <string.h> |
9 |
< |
|
9 |
> |
#include "paths.h" |
10 |
|
#include "platform.h" |
11 |
|
#include "rterror.h" |
12 |
|
#include "rholo.h" |
13 |
|
|
14 |
– |
char *progname; /* our program name */ |
14 |
|
char *hdkfile; /* holodeck file name */ |
15 |
|
char gargc; /* global argc */ |
16 |
|
char **gargv; /* global argv */ |
49 |
|
int i, rval; |
50 |
|
|
51 |
|
gargc = argc; gargv = argv; |
52 |
< |
progname = argv[0]; /* get arguments */ |
52 |
> |
fixargv0(argv[0]); /* get arguments */ |
53 |
|
for (i = 1; i < argc && argv[i][0] == '-'; i++) { |
54 |
|
rval = getviewopt(&myview, argc-i, argv+i); |
55 |
|
if (rval >= 0) { /* view option */ |
215 |
|
/* prepare output */ |
216 |
|
if (outspec != NULL) { |
217 |
|
sprintf(fname, outspec, fn); |
218 |
< |
if (freopen(fname, "w", stdout) == NULL) { |
218 |
> |
if (freopen(fname, "wb", stdout) == NULL) { |
219 |
|
sprintf(errmsg, "cannot open output \"%s\"", fname); |
220 |
|
error(SYSTEM, errmsg); |
221 |
|
} |
286 |
|
int n; |
287 |
|
off_t nextloc; |
288 |
|
/* open holodeck file */ |
289 |
< |
if ((fp = fopen(hdkfile, "r")) == NULL) { |
289 |
> |
if ((fp = fopen(hdkfile, "rb")) == NULL) { |
290 |
|
sprintf(errmsg, "cannot open \"%s\" for reading", hdkfile); |
291 |
|
error(SYSTEM, errmsg); |
292 |
|
} |
316 |
|
|
317 |
|
|
318 |
|
void |
319 |
< |
eputs(s) /* put error message to stderr */ |
321 |
< |
char *s; |
319 |
> |
eputs(const char *s) /* put error message to stderr */ |
320 |
|
{ |
321 |
|
static int midline = 0; |
322 |
|
|