I have an array of all some permutations of the word exit in different cases and some of the time it works and some of the time it doesn't. What am I missing?
// Define all possible case permutations of exit
char *exitStrings[16] = {
"exit",
"exiT",
"exIt",
"eXit",
"exIT",
"eXiT",
"eXIt",
"eXIT",
"EXIT",
"Exit",
"EXit",
"ExIt",
"ExiT",
"EXiT",
"EXIt",
"ExIT"};
// read the message from client and copy it in buffer
read(sockfd, buff, sizeof(buff));
// if read message is one of the permuations of exit strings
// exit client
for (int i = 0; i < sizeof(*exitStrings); i++)
{
if (strncmp(buff, exitStrings[i], 4) == 0)
{
printf("Client Exit and the Connection is still open\n");
printf("Listening for new client...\n");
}
}
tia