Skip to content

Instantly share code, notes, and snippets.

@ob
Created December 19, 2019 06:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ob/4e4ffac04ab2ba0e9b619172294eafcf to your computer and use it in GitHub Desktop.
Save ob/4e4ffac04ab2ba0e9b619172294eafcf to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int
main(int ac, char *av[])
{
while (getopt(ac, av, "f:n:p:D:") != -1) {
// skip args
}
ac -= optind;
av += optind;
if (ac == 0) exit(1);
execvp(av[0], av);
// exec failed
perror("execvp");
exit(1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment