Introduction
Introduction Statistics Contact Development Disclaimer Help
tstopwatch.c: store program name globally - stopwatch - simple timer for consol…
git clone git://src.adamsgaard.dk/stopwatch
Log
Files
Refs
README
LICENSE
---
commit 4f6e38d9d743040a27ac5fdc0f49dbe5d53ec2af
parent 1e0f2abc8c9a86278d85ddc424d639343c0359dc
Author: Anders Damsgaard <[email protected]>
Date: Thu, 5 Nov 2020 08:57:59 +0100
stopwatch.c: store program name globally
Diffstat:
M stopwatch.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/stopwatch.c b/stopwatch.c
t@@ -9,8 +9,10 @@
#include "timeutil.h"
+char *argv0;
+
void
-usage(char *argv0)
+usage()
{
errx(1, "usage: %s [-p prefix] [-P postfix] [-i interval] [-x]", argv0…
}
t@@ -55,6 +57,8 @@ main(int argc, char *argv[])
char prefix[LINE_MAX] = "", postfix[LINE_MAX] = "";
const char *errstr;
+ argv0 = *argv;
+
while ((ch = getopt(argc, argv, "p:P:i:x")) != -1) {
switch (ch) {
case 'p':
t@@ -72,13 +76,13 @@ main(int argc, char *argv[])
xflag = 1;
break;
default:
- usage(argv[0]);
+ usage();
}
}
argc -= optind;
argv += optind;
if (argc > 0)
- usage(argv[0]);
+ usage();
if (xflag)
xroot_loop(interval, prefix, postfix);
You are viewing proxied material from mx1.adamsgaard.dk. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.