Reputation: 1
hi if i'm passing an unknown command to execvp i'm getting this error in the errno : "no such file or directory" when i should get this error: "command not found"
how can i get the second error?
Upvotes: 0
Views: 997
Reputation: 94834
There is no "command not found" error that can be returned from execvp. The closest is ENOENT, which means that the file specified (or its interpreter, or a required dynamic library) was not found.
If you want, your program could print out "command not found" rather than the text returned by strerror.
Upvotes: 1
Reputation: 272667
Because "command not found" does not correspond to a standard error code (see e.g. http://linux.die.net/man/3/errno).
Upvotes: 1