I am unsure why I am receiving a segmentation fault when my program hits the first if
statement.
This is a method in a simpleShell program that's sole purpose is parsing stdin input stored in cmd
and parse by whitespace into separate arguments in args
It will never print the if
statement
void parseCmd(char* cmd, char** args)
{
int i;
printf("----------> Parsed here \n");
for(i = 0; i < MAX_LINE; i++) {
args[i] = strsep(&cmd, " ");
if (args[i][0] == '-') {
printf("I was here... \n");
}
if(args[i] == NULL) break;
}
}