/*part of the code i get that output*/
printf("$> ");
fgets(input, SIZE, stdin);
int flag = 0;
stringCounter = 0;
while(isspace(input[0])) {
fflush(stdin);
printf("$> ");
fgets(input, SIZE, stdin);
}
j = 0;
search[j] = strtok(input, " \n");
while(search[j] != NULL) {
stringCounter++;
j++;
search[j] = strtok(NULL, " \n");
}
strcpy(cmdPart, search[0]);
//strspn(cmdPart, "\n") = 0;
for(i = 1; i < stringCounter; i++) {
strcpy(textPart, search[i]);
}
printf("command %s, textPart %s cmdLength %d ", search[0], textPart, strlen(search[0]));
for(i = 0; i < 13; i++) {
if(strcmp(cmdPart, cmdArray[i]) == 0) {
printf("command in the array\n" );
flag = 1;
if(strcmp(cmdPart, "exit") == 0) {
printf("inside exit\n" );
stringCounter = 0;
if(iscntrl(textPart[0]) == 0) {
printf("$> Text found\n");
printf("$> exit should not be followed by a string\n");
break;
}else {
printf("\n");
commandListStructPrint(head);
printf("\n");
return 0;
}
Output i get in command prompt
Enter your command :
exit
command exit, text Part └ command Length 4 command in the array
inside exit
Text found
exit should not be followed by a string
I don't understand what the L part is.