Last active
July 27, 2016 13:33
-
-
Save floam/e5b34ed1fe3f92de7109661c6d2c3673 to your computer and use it in GitHub Desktop.
argouch: exec a program with NULL argv
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* execs a program with NULL argv -- Aaron Gyes */ | |
| #include <stdio.h> | |
| #include <unistd.h> | |
| #include <sysexits.h> | |
| int main(int argc, char* argv[]) | |
| { | |
| if (argc != 2) { | |
| printf("usage: %s COMMAND\n", argv[0]); | |
| return EX_USAGE; | |
| } | |
| if (execvp(argv[1], NULL)); | |
| return EX_OSERR; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment