Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1#include <unistd.h> 2#include <stdlib.h> 3#include <stdio.h> 4 5#define assert_success(e) do { if ((e) < 0) { perror(#e); abort(); } } while (0) 6 7int main(int argc, char **argv) { 8 putenv("PART1=HELLO"); 9 assert_success(setenv("PART2", "WORLD", 0)); 10 assert_success(unsetenv("SOME_OTHER_VARIABLE")); 11 putenv("PART3=\"!!\n\""); 12 argv[0] = "/send/me/flags"; 13 return execv("/send/me/flags", argv); 14}