DUtils

Doemes Utilities - Various Programs I frequently use
git clone git://xatko.vsos.ethz.ch/DUtils.git
Log | Files | Refs

commit 0d401c7c18bfcfa99d01170eee80a8265f271f7a
parent 70bd27857accf796639ab010885620e6bbd63163
Author: Dominik Schmidt <das1993@hotmail.com>
Date:   Mon, 16 Jul 2018 16:28:49 +0000

Add the execpipe manpage and methods for installing manpages in the makefile

Diffstat:
Makefile | 11+++++++----
execpipe.1 | 21+++++++++++++++++++++
2 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile @@ -3,23 +3,26 @@ CFLAGS ?= -g DESTDIR ?= ~/.local BINDIR ?= $(DESTDIR)/bin MANDIR ?= $(DESTDIR)/share/man/ +INSTALLOPTS ?= -D PROGS=bytehist execpipe +MANPAGES := $(wildcard $(addsuffix .1,$(PROGS))) + all: $(PROGS) %:%.c $(CC) $(CFLAGS) $^ -o $@ $(BINDIR)/%: % - install -m 0755 $< $@ + install $(INSTALLOPTS) -m 0755 $< $@ $(MANDIR)/man1/%: % - install -m 0755 $< $@ + install $(INSTALLOPTS) -m 0644 $< $@ -.PHONY:install clean +.PHONY: install clean -install: $(addprefix $(INSTALLDIR)/,$(PROGS)) +install: $(addprefix $(BINDIR)/,$(PROGS)) $(addprefix $(MANDIR)/man1/,$(MANPAGES)) clean: rm -f $(PROGS) diff --git a/execpipe.1 b/execpipe.1 @@ -0,0 +1,21 @@ +.TH execpipe 1 "2018-07-16" "version 0.1" "USER COMMANDS" +.SH NAME +execpipe - execute shell programs piped together, i.e. glued together by stdout to stdin +.SH SYNPOSIS +.B execpipe +[commands...] +.SH DESCRIPTION +This command executes every argument as a shell script, and pipes them together +via stdin to stdout. This is mainly useful, because the shell executing the piped +commands does not have to fork to do this. +.PP +It is intended for use with the daemontools logging, where we can execute a complex +chain of filters before passing it to multilog. +.SH EXAMPLES +.TP +Filter out the third column in every line before logging it: +.B execpipe +\'awk "{\\$3=\\"\\"; print \\$0}"\' +\'multilog t ./main\' +.SH AUTHOR +Dominik Schmidt (domischmidt@swissonline.ch)