rendered paste body#include <stdio.h>#include <stdlib.h>#include <stddef.h>#include <string.h>#include <ctype.h>#define MAX_LINE_SIZE 100#define MAX_WORD_SIZE 100/* globals */char wordBuffer[MAX_WORD_SIZE + 1] = {'\0'};char* readWord(FILE* fp, int retainCase){ int i = 0; int charCount = 0; char current = getc(fp); while(current != ' ' && current != EOF && charCount < MAX_WORD_SIZE){ if(current != ' '){ if(!retainCase) current = tolower(current); if(isalpha(current)){ wordBuffer[i++] = current; charCount++; } current = getc(fp); } } if(i == 0) return NULL; else{ wordBuffer[i] = '\0'; return wordBuffer; }}int main(int argc, char *argv[]){ int returnValue = EXIT_SUCCESS; int retainCase = 0; int error = 0; char *currentStr = NULL; FILE* fileIn = stdin; if(argc > 3) error = 1; else if(argc == 3){ if(strcmp(argv[1], "-c") == 0) { retainCase = 1; fileIn = fopen(argv[2], "r"); } else error = 1; } else if(argc == 2){ if(strcmp(argv[1], "-c") == 0){ error = 1; } else{ fileIn = fopen(argv[1], "r"); } } if(error || fileIn == NULL){ fprintf(stderr,"Usage: countWords [-c] [file]\n"); returnValue = EXIT_FAILURE; } else{ currentStr = readWord(fileIn,retainCase); while(currentStr != NULL){ fputs(currentStr, stdout); fprintf(stdout,"\n"); currentStr = readWord(fileIn,retainCase); } } return returnValue;}