Hi, I have this program which gets two arguments as parameters and runs it in linux:
Code:
int main(int argc, char *argv[])
{
int status;
pid_t pid;
pid = fork();
if(pid == 0)
execvp(argv[1],argv+1);
else if (pid >0) {
/*this is the part of the code I'm missing*/
}
return 0;
}
I need to capture if the parameters passed are not a valid UX command.
I've tried WIFEXITED and WEXISTSTATUS but they always return "1" whether it's a valid linux command or not. Is there a way to know if the linux command wwhich the child process is running doesn't exist?