Remove d- and v-flags
d-flag: There's no need for that, use the &-operator or fork+exec in a non-shell-context. In the latter case you get the PID for free. v-flag: If you want to find out which version of a package is installed, consult your package manager. That's his job.
This commit is contained in:
parent
958c34052a
commit
4d33c36014
|
@ -11,7 +11,7 @@ X11INC = /usr/X11R6/include
|
||||||
X11LIB = /usr/X11R6/lib
|
X11LIB = /usr/X11R6/lib
|
||||||
|
|
||||||
# flags
|
# flags
|
||||||
CPPFLAGS = -I$(X11INC) -DVERSION=\"$(VERSION)\" -D_DEFAULT_SOURCE
|
CPPFLAGS = -I$(X11INC) -D_DEFAULT_SOURCE
|
||||||
CFLAGS = -std=c99 -pedantic -Wall -Wextra -Wno-unused -Os
|
CFLAGS = -std=c99 -pedantic -Wall -Wextra -Wno-unused -Os
|
||||||
LDFLAGS = -L$(X11LIB) -s
|
LDFLAGS = -L$(X11LIB) -s
|
||||||
LDLIBS = -lX11
|
LDLIBS = -lX11
|
||||||
|
|
11
slstatus.1
11
slstatus.1
|
@ -6,14 +6,7 @@
|
||||||
.Nd suckless status monitor
|
.Nd suckless status monitor
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Nm
|
.Nm
|
||||||
.Oo
|
|
||||||
.Op Fl v
|
|
||||||
|
|
|
||||||
.Oo
|
|
||||||
.Op Fl d
|
|
||||||
.Op Fl o | n
|
.Op Fl o | n
|
||||||
.Oc
|
|
||||||
.Oc
|
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
.Nm
|
.Nm
|
||||||
is a suckless status monitor for window managers that use WM_NAME (e.g. dwm) or
|
is a suckless status monitor for window managers that use WM_NAME (e.g. dwm) or
|
||||||
|
@ -23,14 +16,10 @@ By default,
|
||||||
outputs to WM_NAME.
|
outputs to WM_NAME.
|
||||||
.Sh OPTIONS
|
.Sh OPTIONS
|
||||||
.Bl -tag -width Ds
|
.Bl -tag -width Ds
|
||||||
.It Fl d
|
|
||||||
Daemonize.
|
|
||||||
.It Fl n
|
.It Fl n
|
||||||
Write to stdout once and exit.
|
Write to stdout once and exit.
|
||||||
.It Fl o
|
.It Fl o
|
||||||
Write to stdout continuously.
|
Write to stdout continuously.
|
||||||
.It Fl v
|
|
||||||
Write version information to stdout and exit.
|
|
||||||
.El
|
.El
|
||||||
.Sh CUSTOMIZATION
|
.Sh CUSTOMIZATION
|
||||||
.Nm
|
.Nm
|
||||||
|
|
15
slstatus.c
15
slstatus.c
|
@ -75,7 +75,7 @@ static void usage(void);
|
||||||
char *argv0;
|
char *argv0;
|
||||||
static unsigned short int delay = 0;
|
static unsigned short int delay = 0;
|
||||||
static unsigned short int done;
|
static unsigned short int done;
|
||||||
static unsigned short int dflag, oflag, nflag;
|
static unsigned short int oflag, nflag;
|
||||||
static Display *dpy;
|
static Display *dpy;
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
@ -840,7 +840,7 @@ sighandler(const int signo)
|
||||||
static void
|
static void
|
||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "usage: %s [-d] [-o] [-n] [-v] [-h]\n", argv0);
|
fprintf(stderr, "usage: %s [-o | -n]\n", argv0);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -855,28 +855,19 @@ main(int argc, char *argv[])
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
ARGBEGIN {
|
ARGBEGIN {
|
||||||
case 'd':
|
|
||||||
dflag = 1;
|
|
||||||
break;
|
|
||||||
case 'o':
|
case 'o':
|
||||||
oflag = 1;
|
oflag = 1;
|
||||||
break;
|
break;
|
||||||
case 'n':
|
case 'n':
|
||||||
nflag = 1;
|
nflag = 1;
|
||||||
break;
|
break;
|
||||||
case 'v':
|
|
||||||
printf("slstatus-"VERSION"\n");
|
|
||||||
return 0;
|
|
||||||
default:
|
default:
|
||||||
usage();
|
usage();
|
||||||
} ARGEND
|
} ARGEND
|
||||||
|
|
||||||
if ((dflag && oflag) || (dflag && nflag) || (oflag && nflag)) {
|
if (oflag && nflag) {
|
||||||
usage();
|
usage();
|
||||||
}
|
}
|
||||||
if (dflag && daemon(1, 1) < 0) {
|
|
||||||
err(1, "daemon");
|
|
||||||
}
|
|
||||||
|
|
||||||
memset(&act, 0, sizeof(act));
|
memset(&act, 0, sizeof(act));
|
||||||
act.sa_handler = sighandler;
|
act.sa_handler = sighandler;
|
||||||
|
|
Loading…
Reference in New Issue