when input has "|" the string splits normally, when str does not have "|" it seg faults
char **cmds;
if (strchr(input, '|'))
cmds = split(input,'|');
else
cmds[0] = strdup(input);
when input has "|" the string splits normally, when str does not have "|" it seg faults
char **cmds;
if (strchr(input, '|'))
cmds = split(input,'|');
else
cmds[0] = strdup(input);
Copyright © 2021 Jogjafile Inc.
You need to allocate an array to store the pointer: