From 9fa8486900284d78b8255b2116af9a0b0ef11a46 Mon Sep 17 00:00:00 2001 From: Christian Neukirchen Date: Fri, 31 Jul 2015 15:44:29 +0200 Subject: cleanups, usage --- nq.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'nq.c') diff --git a/nq.c b/nq.c index 69d478c..ccd3a7a 100644 --- a/nq.c +++ b/nq.c @@ -54,16 +54,21 @@ write_execline(int fd, int argc, char *argv[]) int main(int argc, char *argv[]) { - pid_t child; int dirfd, lockfd; - char lockfile[32]; int pipefd[2]; - struct timeval tv; + char lockfile[32]; + pid_t child; + struct timeval started; struct dirent *ent; /* timestamp is milliseconds since epoch. */ - gettimeofday(&tv, NULL); - int64_t ms = tv.tv_sec*1000 + tv.tv_usec/1000; + gettimeofday(&started, NULL); + int64_t ms = started.tv_sec*1000 + started.tv_usec/1000; + + if (argc <= 1) { + swrite(2, "usage: nq CMD...\n"); + exit(1); + } char *path = getenv("NQDIR"); if (!path) -- cgit 1.4.1