rmpx.c
655 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <stdio.h>
main(argc,argv)
int argc;
char *argv[];
{
FILE *fp1,*fp2,*fopen();
short eflag,enout;
eflag = 0;
enout = 0;
if (argc !=3)
printf("rmpx <input_file> <output_file> \n");
else
if ((fp1= fopen(*++argv, "r")) == NULL)
{
printf("can't open %s\n", *argv);
}
else
{
pass(fp1,fp2,&eflag,&enout);
printf("end of error checking **pass1** \n");
fseek(fp1,0L,0);
if (!eflag)
{
fseek(fp1,0L,0);
fp2 = fopen(*++argv,"w");
enout = 1;
pass(fp1,fp2,&eflag,&enout);
printf("end of compilation **pass2** \n");
printf("Output file ** %s ** generated \n",*argv);
}
}
fclose(fp1);
fclose(fp2);
}