Convert slstatus.1 to mandoc, simplify it and remove -h
authorLaslo Hunhold <dev@frign.de>
Thu, 10 Aug 2017 19:36:29 +0000 (21:36 +0200)
committerAaron Marcher <me@drkhsh.at>
Thu, 10 Aug 2017 20:32:28 +0000 (22:32 +0200)
We also change the semantics of -v to only return the version
information.
There is now no need for usage() to exit with anything other than 1.

slstatus.1
slstatus.c

index de5d0e8e7121e870e459e6b83e804c2cfea0b8f4..bc2727108854da2dc01a50e88248110268686c9e 100644 (file)
@@ -1,34 +1,38 @@
-.TH SLSTATUS 1 slstatus
-.SH NAME
-slstatus \- suckless status
-.SH SYNOPSIS
-.B slstatus
-.RB [ \-dhov ]
-.SH DESCRIPTION
-slstatus is a suckless and lightweight status monitor for window managers that use WM_NAME as statusbar (e.g. DWM) or any other status bars as long as they support reading from stdin. It is written in pure C without any extern programs being executed and only reads from files most of the time. slstatus is meant to be a better alternative to Bash scripts (inefficient) and Conky (bloated and written in C++).
-.SH OPTIONS
-.TP
-.B \-d
-run slstatus as daemon in background
-.TP
-.B \-h
-display help
-.TP
-.B \-o
-output continuously to console instead of WM_NAME
-.TP
-.B \-n
-output to console once and exit
-.TP
-.B \-v
-display version and copyright details
-.SH CUSTOMIZATION
-.B slstatus
+.Dd 2017-08-10
+.Dt SLSTATUS 1
+.Os suckless.org
+.Sh NAME
+.Nm slstatus
+.Nd suckless status monitor
+.Sh SYNOPSIS
+.Nm
+.Oo
+.Op Fl v
+|
+.Oo
+.Op Fl d
+.Op Fl o | n
+.Oc
+.Oc
+.Sh DESCRIPTION
+.Nm
+is a suckless status monitor for window managers that use WM_NAME (e.g. dwm) or
+stdin to fill the status bar.
+By default,
+.Nm
+outputs to WM_NAME.
+.Sh OPTIONS
+.Bl -tag -width Ds
+.It Fl d
+Daemonize.
+.It Fl n
+Write to stdout once and exit.
+.It Fl o
+Write to stdout continuously.
+.It Fl v
+Write version information to stdout and exit.
+.El
+.Sh CUSTOMIZATION
+.Nm
 can be customized by creating a custom config.h and (re)compiling the source
 code. This keeps it fast, secure and simple.
-.SH AUTHORS
-See the LICENSE file for the authors.
-.SH LICENSE
-See the LICENSE file for the terms of redistribution.
-.SH BUGS
-See the FIXME's in the code.
index 556477172c02a414768e46ac2613d6cdac014388..9a4831d7e36a40c84eeb4c242c5d24962601ed3c 100644 (file)
@@ -70,7 +70,7 @@ static const char *vol_perc(const char *card);
 static const char *wifi_perc(const char *iface);
 static const char *wifi_essid(const char *iface);
 static void sighandler(const int signo);
-static void usage(const int eval);
+static void usage(void);
 
 char *argv0;
 static unsigned short int delay = 0;
@@ -838,10 +838,10 @@ sighandler(const int signo)
 }
 
 static void
-usage(const int eval)
+usage(void)
 {
        fprintf(stderr, "usage: %s [-d] [-o] [-n] [-v] [-h]\n", argv0);
-       exit(eval);
+       exit(1);
 }
 
 int
@@ -865,16 +865,14 @@ main(int argc, char *argv[])
                        nflag = 1;
                        break;
                case 'v':
-                       printf("slstatus (C) 2016-2017 slstatus engineers\n");
+                       printf("slstatus-"VERSION"\n");
                        return 0;
-               case 'h':
-                       usage(0);
                default:
-                       usage(1);
+                       usage();
        } ARGEND
 
        if ((dflag && oflag) || (dflag && nflag) || (oflag && nflag)) {
-               usage(1);
+               usage();
        }
        if (dflag && daemon(1, 1) < 0) {
                err(1, "daemon");