My code can count the occurrences of a string in a .txt file, but it is case sensitive. How can I add another option that does the same thing but is case insensitive?

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define size 1000
int main(int argc, char  *argv []){

int i,j;
FILE *fp;
char argtxt[]=".txt";
char txtfile[size]; /*Char array that holds .txt file*/
size_t br;

int stringcount=0, stringcount2=0;
char cmdline[size];
int l1=0,l2=0;
    for(i=0; i<argc; i++){/*loop thru all arguments*/
        if(argc > 1 && strstr(argv[i],argtxt)!=NULL){/*if argument exists and contains .txt, then copy that argument to a char array*/
            fp=fopen(argv[i],"r");
            br=fread(txtfile, 1,sizeof(txtfile), fp);
            printf("%s:\n", argv[i]);
            printf(txtfile);
        }
    }
 //feature 1 
    l1=strlen(txtfile);
    l2=strlen(argv[2]);
    if(argv[2]!=NULL){
                strcpy(cmdline, argv[2]);
        }
    if(strcmp(argv[1],"-c")==0){
        for(i=0; i< l1;){
        j=0;
        stringcount=0;
            while((txtfile[i]==cmdline[j])){
            stringcount++;
            i++;
            j++;
            }

        if(stringcount==l2){
        stringcount2++;
        stringcount=0;
        }

        else{
        i++;
        }   
        }

Expected Outcome: If my command is ./program -ci "This is a list of words." test.txt, the output should be 9

This is the contents of test.txt:

THis is a list of words.
    THis is a list of words.as
    THis is a list of words.as
                        as This is a list of words.
                        as This is a list of words.
                        This is a list of words.
                        as This is a list of words.
                        This is a list of words.
                       as This is a list of words.

0 Answers