diff options
author | Christian Neukirchen <chneukirchen@gmail.com> | 2015-11-02 22:39:30 +0100 |
---|---|---|
committer | Christian Neukirchen <chneukirchen@gmail.com> | 2015-11-02 22:39:30 +0100 |
commit | c438603af996e5ac65d3eb92fd9489257178a5e0 (patch) | |
tree | 18ce85ec6af44602a5b948ae4e2de5c1a071b480 /xe.c | |
parent | 9a2bef433271cd830d318e5b17efc38ac74e34a3 (diff) | |
download | xe-c438603af996e5ac65d3eb92fd9489257178a5e0.tar.gz xe-c438603af996e5ac65d3eb92fd9489257178a5e0.tar.xz xe-c438603af996e5ac65d3eb92fd9489257178a5e0.zip |
export iteration count as $ITER to the child process
Diffstat (limited to 'xe.c')
-rw-r--r-- | xe.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/xe.c b/xe.c index f9c7206..a17f1a4 100644 --- a/xe.c +++ b/xe.c @@ -30,7 +30,7 @@ static int maxatonce = 1; static int maxjobs = 1; static int runjobs = 0; static int Rflag, aflag, kflag, nflag, vflag; -static int iterations = 0; +static long iterations = 0; static char * xstrdup(const char *s) @@ -155,6 +155,9 @@ run(char *cmd[]) pid = fork(); if (pid == 0) { // in child + char iter[32]; + snprintf(iter, sizeof iter, "%ld", iterations); + setenv("ITER", iter, 1); // redirect stdin to /dev/null int fd = open("/dev/null", O_RDONLY); if (fd >= 0) { |