20 lines · cpp
1// Helper binary for2// lit_tests/TestCases/Darwin/unset-insert-libraries-on-exec.cpp3// Prints the environment variable with the given name.4#include <stdio.h>5#include <stdlib.h>6 7int main(int argc, char *argv[]) {8 if (argc != 2) {9 printf("Usage: %s ENVNAME\n", argv[0]);10 exit(1);11 }12 const char *value = getenv(argv[1]);13 if (value) {14 printf("%s = %s\n", argv[1], value);15 } else {16 printf("%s not set.\n", argv[1]);17 }18 return 0;19}20