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.
X11LIB = /usr/X11R6/lib
# flags
X11LIB = /usr/X11R6/lib
# flags
-CPPFLAGS = -I$(X11INC) -DVERSION=\"$(VERSION)\" -D_DEFAULT_SOURCE
+CPPFLAGS = -I$(X11INC) -D_DEFAULT_SOURCE
CFLAGS = -std=c99 -pedantic -Wall -Wextra -Wno-unused -Os
LDFLAGS = -L$(X11LIB) -s
LDLIBS = -lX11
CFLAGS = -std=c99 -pedantic -Wall -Wextra -Wno-unused -Os
LDFLAGS = -L$(X11LIB) -s
LDLIBS = -lX11
.Nd suckless status monitor
.Sh SYNOPSIS
.Nm
.Nd suckless status monitor
.Sh SYNOPSIS
.Nm
-.Oo
-.Op Fl v
-|
-.Oo
-.Op Fl d
.Sh DESCRIPTION
.Nm
is a suckless status monitor for window managers that use WM_NAME (e.g. dwm) or
.Sh DESCRIPTION
.Nm
is a suckless status monitor for window managers that use WM_NAME (e.g. dwm) or
outputs to WM_NAME.
.Sh OPTIONS
.Bl -tag -width Ds
outputs to WM_NAME.
.Sh OPTIONS
.Bl -tag -width Ds
.It Fl n
Write to stdout once and exit.
.It Fl o
Write to stdout continuously.
.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
.El
.Sh CUSTOMIZATION
.Nm
char *argv0;
static unsigned short int delay = 0;
static unsigned short int done;
char *argv0;
static unsigned short int delay = 0;
static unsigned short int done;
-static unsigned short int dflag, oflag, nflag;
+static unsigned short int oflag, nflag;
static Display *dpy;
#include "config.h"
static Display *dpy;
#include "config.h"
static void
usage(void)
{
static void
usage(void)
{
- fprintf(stderr, "usage: %s [-d] [-o] [-n] [-v] [-h]\n", argv0);
+ fprintf(stderr, "usage: %s [-o | -n]\n", argv0);
- case 'd':
- dflag = 1;
- break;
case 'o':
oflag = 1;
break;
case 'n':
nflag = 1;
break;
case 'o':
oflag = 1;
break;
case 'n':
nflag = 1;
break;
- case 'v':
- printf("slstatus-"VERSION"\n");
- return 0;
default:
usage();
} ARGEND
default:
usage();
} ARGEND
- if ((dflag && oflag) || (dflag && nflag) || (oflag && nflag)) {
- if (dflag && daemon(1, 1) < 0) {
- err(1, "daemon");
- }
memset(&act, 0, sizeof(act));
act.sa_handler = sighandler;
memset(&act, 0, sizeof(act));
act.sa_handler = sighandler;