5 |
|
* readobj2.c - routines for reading in object descriptions. |
6 |
|
*/ |
7 |
|
|
8 |
< |
#include "standard.h" |
8 |
> |
#include <ctype.h> |
9 |
> |
#include <stdio.h> |
10 |
|
|
11 |
+ |
#include "platform.h" |
12 |
+ |
#include "paths.h" |
13 |
+ |
#include "rtmath.h" |
14 |
+ |
#include "rtio.h" |
15 |
+ |
#include "rterror.h" |
16 |
|
#include "object.h" |
11 |
– |
|
17 |
|
#include "otypes.h" |
18 |
+ |
#include "oconv.h" |
19 |
|
|
14 |
– |
#include <ctype.h> |
20 |
|
|
21 |
< |
extern char *fgetword(); |
21 |
> |
static void getobject2(char *name, FILE *fp, ro_cbfunc f); |
22 |
|
|
23 |
< |
readobj2(input, callback) /* read in an object file or stream */ |
24 |
< |
char *input; |
25 |
< |
int (*callback)(); |
23 |
> |
|
24 |
> |
void |
25 |
> |
readobj2( /* read in an object file or stream */ |
26 |
> |
char *input, |
27 |
> |
ro_cbfunc callback |
28 |
> |
) |
29 |
|
{ |
22 |
– |
FILE *popen(); |
23 |
– |
char *fgetline(); |
30 |
|
FILE *infp; |
31 |
< |
char buf[512]; |
31 |
> |
char buf[2048]; |
32 |
|
register int c; |
33 |
|
|
34 |
|
if (input == NULL) { |
57 |
|
getobject2(input, infp, callback); |
58 |
|
} |
59 |
|
} |
60 |
< |
if (input[0] == '!') |
61 |
< |
pclose(infp); |
62 |
< |
else |
60 |
> |
if (input[0] == '!') { |
61 |
> |
if (pclose(infp) != 0) { |
62 |
> |
sprintf(errmsg, "bad status from \"%s\"", input); |
63 |
> |
error(SYSTEM, errmsg); |
64 |
> |
} |
65 |
> |
} else |
66 |
|
fclose(infp); |
67 |
|
} |
68 |
|
|
69 |
|
|
70 |
< |
getobject2(name, fp, f) /* read the next object */ |
71 |
< |
char *name; |
72 |
< |
FILE *fp; |
73 |
< |
int (*f)(); |
70 |
> |
static void |
71 |
> |
getobject2( /* read the next object */ |
72 |
> |
char *name, |
73 |
> |
FILE *fp, |
74 |
> |
ro_cbfunc f |
75 |
> |
) |
76 |
|
{ |
77 |
|
char sbuf[MAXSTR]; |
78 |
|
OBJREC thisobj; |