Created
July 24, 2018 12:21
-
-
Save davidfoerster/3df8b84a774d1a0ccb5a7b09e537ce9c to your computer and use it in GitHub Desktop.
Test expansion inside the value of the "PATH" environment variable by glibc
This file contains 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
#include <stdlib.h> | |
#include <stdio.h> | |
#include <unistd.h> | |
#include <string.h> | |
#include <errno.h> | |
int main(int argc, char *argv[]) | |
{ | |
if (argc <= 0) | |
abort(); | |
if (argc == 1) | |
{ | |
fprintf(stderr, "Usage: %s <command> [args...]\n", argv[0]); | |
return 2; | |
} | |
execvp(argv[1], &argv[1]); | |
fprintf(stderr, "%s: Can't execute \"%s\": %s\n", | |
argv[0], argv[1], strerror(errno)); | |
return EXIT_FAILURE; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment