1
0
Fork 0

Convert slstatus.1 to mandoc, simplify it and remove -h

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.
This commit is contained in:
Laslo Hunhold 2017-08-10 21:36:29 +02:00 committed by Aaron Marcher
parent 8dad4910bf
commit 958c34052a
No known key found for this signature in database
GPG key ID: 74B048E5C2474F9A
2 changed files with 42 additions and 40 deletions

View file

@ -1,34 +1,38 @@
.TH SLSTATUS 1 slstatus .Dd 2017-08-10
.SH NAME .Dt SLSTATUS 1
slstatus \- suckless status .Os suckless.org
.SH SYNOPSIS .Sh NAME
.B slstatus .Nm slstatus
.RB [ \-dhov ] .Nd suckless status monitor
.SH DESCRIPTION .Sh SYNOPSIS
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++). .Nm
.SH OPTIONS .Oo
.TP .Op Fl v
.B \-d |
run slstatus as daemon in background .Oo
.TP .Op Fl d
.B \-h .Op Fl o | n
display help .Oc
.TP .Oc
.B \-o .Sh DESCRIPTION
output continuously to console instead of WM_NAME .Nm
.TP is a suckless status monitor for window managers that use WM_NAME (e.g. dwm) or
.B \-n stdin to fill the status bar.
output to console once and exit By default,
.TP .Nm
.B \-v outputs to WM_NAME.
display version and copyright details .Sh OPTIONS
.SH CUSTOMIZATION .Bl -tag -width Ds
.B slstatus .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 can be customized by creating a custom config.h and (re)compiling the source
code. This keeps it fast, secure and simple. 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.

View 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_perc(const char *iface);
static const char *wifi_essid(const char *iface); static const char *wifi_essid(const char *iface);
static void sighandler(const int signo); static void sighandler(const int signo);
static void usage(const int eval); static void usage(void);
char *argv0; char *argv0;
static unsigned short int delay = 0; static unsigned short int delay = 0;
@ -838,10 +838,10 @@ sighandler(const int signo)
} }
static void static void
usage(const int eval) usage(void)
{ {
fprintf(stderr, "usage: %s [-d] [-o] [-n] [-v] [-h]\n", argv0); fprintf(stderr, "usage: %s [-d] [-o] [-n] [-v] [-h]\n", argv0);
exit(eval); exit(1);
} }
int int
@ -865,16 +865,14 @@ main(int argc, char *argv[])
nflag = 1; nflag = 1;
break; break;
case 'v': case 'v':
printf("slstatus (C) 2016-2017 slstatus engineers\n"); printf("slstatus-"VERSION"\n");
return 0; return 0;
case 'h':
usage(0);
default: default:
usage(1); usage();
} ARGEND } ARGEND
if ((dflag && oflag) || (dflag && nflag) || (oflag && nflag)) { if ((dflag && oflag) || (dflag && nflag) || (oflag && nflag)) {
usage(1); usage();
} }
if (dflag && daemon(1, 1) < 0) { if (dflag && daemon(1, 1) < 0) {
err(1, "daemon"); err(1, "daemon");