Are you trying to write your own strncmp function to perform case insensitive comparison?