rmpx.c 655 Bytes

#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);

	}