wdvi

network DVI viewer
Log | Files | Refs

commit f9fd857ee23ee64d2a6b8b6c4e9242907868a3d9
parent 04001736d88e37baec97929d0efe9fc4073ffd93
Author: Kyle Milz <krwmilz@gmail.com>
Date:   Wed, 22 Sep 2021 02:15:18 +0000

fail more gracefully when roff2dvi is not found

Creating default.h from wdvi.1 is not mandatory as default.h ships
pre-created. But some systems may not have roff2dvi, but in that case
default.dvi will be created anyways as an empty file because of the
shell redirection. roff2dvi, and groffer, does not have an output option
that is not stdout, so the shell redirection must be used.

Then if xxd exists, it will create an empty default.h file from the
empty default.dvi, overwriting the shipped files contents, and causing
wdvi to not start.

The output of roff2dvi cannot be piped to xxd because it uses the filename
as variable names in the output default.h file.

Avoid this mess by only executing xxd after roff2dvi has exited 0.

Diffstat:
MMakefile | 3+--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/Makefile b/Makefile @@ -28,8 +28,7 @@ ${PROG}: ${SRCS:.c=.o} ${CC} -o ${PROG} ${SRCS:.c=.o} ${LDFLAGS} ${PKGS_LDFLAGS} default.h: wdvi.1 - -roff2dvi wdvi.1 > default.dvi - -xxd -i default.dvi $@ + -roff2dvi wdvi.1 > default.dvi && xxd -i default.dvi $@ install: @echo "Not yet."