rspan

Executes a given command after a randomized time span.
git clone git://git.noxz.tech/rspan
Log | Files | Refs | LICENSE

commit f4d132cb38a3569f1eeabaa2b9ade63e665d0467
parent 2f88ac67374b6be93175adfd44734c050d34997a
Author: Chris Noxz <chris@noxz.tech>
Date:   Thu,  3 Jan 2019 19:46:15 +0100

Minor formatting

Diffstat:
Mrspan.c | 15++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/rspan.c b/rspan.c @@ -20,7 +20,8 @@ static void handler(int); static void init_timer(int, void (*)(int)); static unsigned long mix(unsigned long, unsigned long, unsigned long); -unsigned long mix(unsigned long a, unsigned long b, unsigned long c) +unsigned long +mix(unsigned long a, unsigned long b, unsigned long c) { a=a-b; a=a-c; a=a^(c >> 13); b=b-c; b=b-a; b=b^(a << 8); @@ -32,7 +33,8 @@ unsigned long mix(unsigned long a, unsigned long b, unsigned long c) return c; } -void die(int code, const char *msg) +void +die(int code, const char *msg) { int i; @@ -48,7 +50,8 @@ void die(int code, const char *msg) exit(code); } -void init_timer(int timeout, void (*func)(int)) +void +init_timer(int timeout, void (*func)(int)) { struct itimerval it_val; @@ -63,13 +66,15 @@ void init_timer(int timeout, void (*func)(int)) die(1, "timer couldn't initialize"); } -void handler(int signum) +void +handler(int signum) { execvp(command[0], command); die(0, NULL); } -int main (int argc, char *argv[]) +int +main (int argc, char *argv[]) { unsigned long seed = mix(clock(), time(NULL), getpid()); int c, i, s;