Skip to content

Instantly share code, notes, and snippets.

@floam
Last active July 27, 2016 13:33
Show Gist options
  • Save floam/e5b34ed1fe3f92de7109661c6d2c3673 to your computer and use it in GitHub Desktop.
Save floam/e5b34ed1fe3f92de7109661c6d2c3673 to your computer and use it in GitHub Desktop.
argouch: exec a program with NULL argv
/* 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