summaryrefslogtreecommitdiff
path: root/slstatus.c
diff options
context:
space:
mode:
authorraiz <raiz@firemail.cc>2016-12-27 20:41:40 +0300
committerraiz <raiz@firemail.cc>2016-12-27 20:41:40 +0300
commitcfb4a5d3ffeec74722101f394a1a3f0856217210 (patch)
tree33967e62e3bf4ee0b0aed358bee17d29760db22a /slstatus.c
parentd1dd72bae955d8f2c0861db5a8c449e423ee3495 (diff)
usage(): return success if -h is called && print more appropriate usage, opts can't be all called at the same time, that's why a separator is required
Diffstat (limited to 'slstatus.c')
-rw-r--r--slstatus.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/slstatus.c b/slstatus.c
index 6a338f9..1f08514 100644
--- a/slstatus.c
+++ b/slstatus.c
@@ -70,7 +70,7 @@ static char *wifi_perc(const char *iface);
static char *wifi_essid(const char *iface);
static char *kernel_release(void);
static void sighandler(const int signo);
-static void usage(void);
+static void usage(int);
char *argv0;
char concat[];
@@ -756,10 +756,10 @@ sighandler(const int signo)
}
static void
-usage(void)
+usage(int eval)
{
- fprintf(stderr, "usage: %s [-dhov]\n", argv0);
- exit(1);
+ fprintf(stderr, "usage: %s [-d] [-o] [-v] [-h]\n", argv0);
+ exit(eval);
}
int
@@ -781,12 +781,14 @@ main(int argc, char *argv[])
case 'v':
printf("slstatus %s (C) 2016 slstatus engineers\n", VERSION);
return 0;
+ case 'h':
+ usage(0);
default:
- usage();
+ usage(1);
} ARGEND
if (dflag && oflag) {
- usage();
+ usage(1);
}
if (dflag && daemon(1, 1) < 0) {
err(1, "daemon");