7 #if (defined(_WIN32) || defined(_MSDOS) || defined(__IBMC__))
15 extern int stgetopt(int, char *const *, const char *);
16 extern char *optarg
, rcsid
[];
19 int Pflag
= 0; /* print no line information */
20 int Iflag
= 0; /* print includes */
21 int Mflag
= 0; /* print macor expansion */
22 int Aflag
= 0; /* translate character sets */
23 int Xflag
= 0; /* print pragma for include/import */
24 int Vflag
= 0; /* verbose flag */
25 int Cflag
= 0; /* do not remove any comments */
26 int Dflag
= 0; /* add parameter check to delete op */
29 extern void setup_kwtab(void);
32 setup(int argc
, char **argv
)
39 while ((c
= stgetopt(argc
, argv
, "NOPV:I:D:U:F:A:X:u:l:+")) != -1)
43 for (i
= 0; i
< NINCLUDE
; i
++)
44 if (includelist
[i
].always
== 1)
45 includelist
[i
].deleted
= 1;
49 for (i
= NINCLUDE
- 2; i
>= 0; i
--)
51 if (includelist
[i
].file
== NULL
)
53 includelist
[i
].always
= 1;
54 includelist
[i
].file
= optarg
;
59 error(FATAL
, "Too many -I directives");
65 setsource("<cmdarg>", -1, -1, optarg
, 0);
72 case 'P': /* Lineinfo */
77 for (n
= 0; (c
= optarg
[n
]) != '\0'; n
++)
97 fprintf(stderr
, "%s %s\n", argv
[0], rcsid
);
101 error(WARNING
, "Unknown verbose option %c", c
);
106 for (n
= 0; (c
= optarg
[n
]) != '\0'; n
++)
128 while (isspace(*dp
)) dp
++;
130 for (i
= NINCLUDE
- 1; i
>= 0; i
--)
132 if (wraplist
[i
].file
== NULL
)
134 wraplist
[i
].file
= dp
;
139 error(WARNING
, "Too many -Xw directives");
143 error(WARNING
, "Unknown extension option %c", c
);
151 case 'u': /* -undef fuer GCC (dummy) */
152 case 'l': /* -lang-c++ fuer GCC (dummy) */
163 if ((fp
= strrchr(argv
[optind
], '/')) != NULL
)
165 int len
= fp
- argv
[optind
];
167 dp
= (char *) newstring((uchar
*) argv
[optind
], len
+ 1, 0);
170 fp
= (char *) newstring((uchar
*) argv
[optind
], strlen(argv
[optind
]), 0);
171 if ((fd
= open(fp
, O_RDONLY
)) <= 0)
172 error(FATAL
, "Can't open input file %s", fp
);
175 if (optind
+ 1 < argc
)
177 int fdo
= creat(argv
[optind
+ 1], 0666);
180 error(FATAL
, "Can't open output file %s", argv
[optind
+ 1]);
184 includelist
[NINCLUDE
- 1].always
= 0;
185 includelist
[NINCLUDE
- 1].file
= dp
;
186 setsource(fp
, -1, fd
, NULL
, 0);
190 /* memmove is defined here because some vendors don't provide it at
191 all and others do a terrible job (like calling malloc) */
193 #if !defined(__IBMC__) && !defined(_WIN32) && !defined(__GLIBC__)
196 memmove(void *dp
, const void *sp
, size_t n
)
198 unsigned char *cdp
, *csp
;
203 csp
= (unsigned char *) sp
;