rendered paste body#include <stdio.h>#include <stdlib.h>#include <string.h>int main (int argc, char *argv[]){ FILE *fp1; FILE *fp2; int i=0,open1=0,open2=0,p=0,j=0; int is_file=0,is_out=0; char temp[20]; char c; int characters=0,lines=0,counter=0; int length,shift=13; int number_arg, length_text1=0,length_text2=0; int number_of_args=0; number_of_args = argc; printf("number of arguments %d \n", number_of_args); for (i=1; i<number_of_args; i++) { printf("Hello\n"); if(argv[i][1] == 70 && argv[i][2] == '\0') { printf("There is a F\n"); is_file=1; /* If there is a file then 1 is true*/ open1=i+1; } if(argv[i][1]== 70 && argv[i][2] !='\0') /* NOTE TO SELF remove -O and -F in these cases */ { printf("Shouldnt be in here"); is_file=1; open1=i; length_text1=strlen(argv[i]); for (p=2; p<=(length_text1);p++) { temp[j]= argv[i][p]; j++; } j=0; strcpy(argv[i],temp); } if(argv[i][1] == 79 && argv[i][2] == '\0') { is_out=1; open2=i+1; printf("is_out is %d\n", is_out); } } printf("We are outside the loop"); if(is_file == 1) { fp1 = fopen (argv[open1], "r"); if ( fp1 == NULL ) { printf( "Can't open fp1\n" ); } while ((c=getc(fp1))!=EOF) /* Count how many characters and new lines there are */ { if (c == '\n') lines++; characters++; } } if(is_out == 1) /* if there is a output file create the file pointer */ fp2 = fopen (argv[open2], "w"); if (is_file == 0 && is_out==1) /* if there isnt a file and there is a output */ { char words[80]; while (fgets(words,80,stdin) != NULL) { for(i=0; i<= characters; i++) { if(words[i] >= 65 && words[i] <=90) /*check for upper case letters to be shifted */ { words[i] = words[i] + shift; if (words[i] <= 64) words[i] = words[i] + 26; } if (words[i] >= 97 && words[i] <= 122) /*check for lower case letters to be shifted */ { words[i] = words[i] -32; /*convert to uppercase */ words[i] = words[i] + shift; if (words[i] <= 64) words[i] = words[i] +26; words[i] = words[i] + 32; } } fprintf(fp2,"%s", words); } } else if (is_file == 0 && is_out == 0) /* if there isnt a file or a output file */ { char words[80]; while (fgets(words,80,stdin) != NULL) { for(i=0; i<= characters; i++) { if(words[i] >= 65 && words[i] <=90) /*check for upper case letters to be shifted */ { words[i] = words[i] + shift; if (words[i] <= 64) words[i] = words[i] + 26; } if (words[i] >= 97 && words[i] <= 122) /*check for lower case letters to be shifted */ { words[i] = words[i] -32; /*convert to uppercase */ words[i] = words[i] + shift; if (words[i] <= 64) words[i] = words[i] +26; words[i] = words[i] + 32; } } printf("%s", words); } } if (is_file == 1 && is_out == 1) { fclose (fp1);/*close to start again at the top of the file */ fp1 = fopen (argv[open1], "r"); if (argv[number_arg][0] == '-') { char words[80]; while (counter != lines) /*shift every letter but keep spaces and numbers in their same positions */ { fgets(words,characters,fp1); for(i=0; i<= characters; i++) { if(words[i] >= 65 && words[i] <=90) /*check for upper case letters to be shifted */ { words[i] = words[i] + shift; if (words[i] <= 64) words[i] = words[i] + 26; } if (words[i] >= 97 && words[i] <= 122) /*check for lower case letters to be shifted */ { words[i] = words[i] -32; /*convert to uppercase */ words[i] = words[i] + shift; if (words[i] <= 64) words[i] = words[i] +26; words[i] = words[i] + 32; } } fprintf(fp2,"%s", words); counter++; } } else { char words[80]; while (counter != lines) /*shift every letter but keep spaces and numbers in their same positions */ { fgets(words,characters,fp1); for(i=0; i<= characters; i++) { if(words[i] >= 65 && words[i] <=90) /*check for upper case letters to be shifted */ { words[i] = words[i] + shift; if (words[i] >= 91) words[i] = words[i] -26; } if (words[i] >= 97 && words[i] <= 122) /*check for lower case letters to be shifted */ { words[i] = words[i] -32; words[i] = words[i] + shift; if (words[i] >= 91) words[i] = words[i] -26; words[i] = words[i] + 32; } } fprintf(fp2,"%s", words); counter++; } } } return 0;}