% Save file as: CHK.C                  Source: [email protected]
#include <stdio.h>
main(argc,argv)
int argc,*argv[];
{char ch;
int check;
FILE *fp1,*fp2,*fopen();
if(argc<3)
{printf("useage: chk inputfile outputfile");
exit(1);
}
fp1=fopen(argv[1],"r");
fp2=fopen(argv[2],"w");
if(fp1==NULL){printf("chk:input file not found");exit(1);}
if(fp2==NULL){printf("chk:output file cannot be created");exit(1);}
/* printf("%s",argv[2]);*/
for(;ch!=EOF;)
{ ch=fgetc(fp1);
 switch(ch)
 {case '\\':
             fputc(ch,fp2);
            check=1;
            while(check!=0)
            {ch=fgetc(fp1);
             switch(ch)
             {case ' ':fputc(ch,fp2);check=0; break;
              case '{':fputc(ch,fp2);check=0; break;
              case '\n':fputc(ch,fp2);check=0;break;
              case '\t':fputc(ch,fp2);check=0;break;
              case '\\':fputc(ch,fp2);
              case EOF:break;
             }
            }
            break;
  default:fputc(ch,fp2);
 }
}

}