3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/test/make-binary-wrapper/env.c
Tobias Bergkvist b7d36b8d59 Add golden tests for make-binary-wrapper.
To run tests after cloning on linux, use the following:
nix-build pkgs/top-level/release.nix -A tests.make-binary-wrapper.x86_64-linux
2021-10-04 22:35:09 +02:00

17 lines
421 B
C

// makeCWrapper /hello/world \
--set PART1 HELLO \
--set-default PART2 WORLD \
--unset SOME_OTHER_VARIABLE \
--set PART3 $'"!!\n"'
#include <unistd.h>
#include <stdlib.h>
int main(int argc, char **argv) {
putenv("PART1=HELLO");
setenv("PART2", "WORLD", 0);
unsetenv("SOME_OTHER_VARIABLE");
putenv("PART3=\"!!\n\"");
argv[0] = "/hello/world";
return execv("/hello/world", argv);
}