commit 7ab29a2b12d05fd8c0b29f35be4048a2ae215d53 from: Alexander Arkhipov date: Fri Sep 30 13:16:47 2022 UTC remove BSD dependencies commit - 699d07dde281064877fe7ac92c64d7e191fefe8b commit + 7ab29a2b12d05fd8c0b29f35be4048a2ae215d53 blob - abe49be3e04acd217cf177e886d17518c3755a63 blob + 4298884bfe9b15ed76eb202a3d82f1c0aa0d843f --- config.mk +++ config.mk @@ -6,7 +6,7 @@ MANPREFIX = $(PREFIX)/man #MANPREFIX = $(PREFIX)/share/man LIBS = -lm -lsodium -# OpenBSD +# BSD #INCS = -I/usr/local/include #LIBS = -L/usr/local/lib -lm -lsodium @@ -15,11 +15,5 @@ CPPFLAGS = -D_DEFAULT_SOURCE CFLAGS = -std=c99 -Wall -pedantic $(INCS) -O2 LDFLAGS = $(LIBS) -# Libbsd -#CFLAGS = -std=c99 -Wall -pedantic -O2 -DLIBBSD_OVERLAY -isystem /usr/include/bsd $(INCS) -#LDFLAGS = -lbsd $(LIBS) - # Debug #CFLAGS = -std=c99 -Wall -pedantic $(INCS) -Wextra -O0 -g -# Libbsd+debug -#CFLAGS = -std=c99 -Wall -pedantic -DLIBBSD_OVERLAY -isystem /usr/include/bsd $(INCS) -Wextra -O0 -g blob - e6b7c8cce70607c58a34b7ee80822da2ce4858e0 blob + d6eaa6c8f4de5096e2a704a9e135f40610c9ee95 --- gpass.c +++ gpass.c @@ -1,13 +1,13 @@ +#include #include #include #include -#include #include +#include +#include #include #include -#include - #include #define MAXWORDS 128 @@ -20,10 +20,41 @@ FILE *dicfp; int plen = 70; uint32_t nlines = 0; +void +errx(int eval, const char *fmt, ...) +{ + fputs("gpass: ", stderr); + if (fmt != NULL) { + va_list argp; + va_start(argp, fmt); + vfprintf(stderr, fmt, argp); + va_end(argp); + } + fputc('\n', stderr); + exit(eval); +} + +void +err(int eval, const char *fmt, ...) +{ + char *e = strerror(errno); + fputs("gpass: ", stderr); + if (fmt != NULL) { + va_list argp; + va_start(argp, fmt); + vfprintf(stderr, fmt, argp); + va_end(argp); + } + fputs(": ", stderr); + fputs(e, stderr); + fputc('\n', stderr); + exit(eval); +} + int usage(void) { - fprintf(stderr, "%s [-d dict] [-e bits] [-n count]\n", getprogname()); + fprintf(stderr, "usage: gpass [-d dict] [-e bits] [-n count]\n"); exit(EXIT_FAILURE); }