/* rrtab.c This program removes the TAB characters from a text file, substitutes the desired amount of spaces for each TAB, and writes the result back to the input file. usage: rtabb input_file output_file spaces If you do not enter spaces, then rtabb uses 5 spaces for each TAB. Dwayne Phillips 31 August 1991 You may use this code for non-commercial purposes */ #include main(argc, argv) int argc; char *argv[]; { char string[80]; char input_file_name[80], output_file_name[80]; FILE *input_file; FILE *output_file; short spaces; if(argc < 2){ printf("\nrrtab: no file specified"); printf("\nrrtab: correct usage is:"); printf("\n\trrtab input_file spaces\n"); printf("\n\nEnter the input file name: "); gets(input_file_name); printf("\nEnter the number of spaces to replace a tab: "); gets(string); spaces = atoi(string); exit (1); } if((input_file = fopen (input_file_name, "rt")) == NULL){ printf("\nrtabb: error opening file %s\n", input_file_name); exit(1); } if((output_file = fopen ("((((", "wt")) == NULL){ printf("\nrtabb: error opening file ((((\n"); exit(1); } remove_tab_file(input_file, output_file, spaces); fclose(input_file); fclose(output_file); /***** unlink(argv[1]); sprintf(string, "copy (((( %s", argv[1]); system(string); unlink("(((("); *****/ } /* ends main */ remove_tab_file (input_file, output_file, spaces) FILE *input_file; FILE *output_file; int spaces; { char outs[300]; char string[100]; int i, j, k; while(fgets(string, 100, input_file)){ k = 0; for(i=0; string[i] != '\n' && string[i] != '\0'; i++){ if(string[i] == 0x09){ for(j=0; j