commit: 9f6f97bb6724cf7780a25d2e34379fc77baec581
parent 0b09cf601eeeb5bf0511d0c928a9f443f9197fd9
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Sat,  7 Dec 2024 05:05:28 +0100
cmd/tr: switch from <err.h> to ./lib/err.h
Diffstat:
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/Makefile b/Makefile
@@ -165,9 +165,9 @@ cmd/split: cmd/split.c lib/truncation.c lib/truncation.h lib/fs.c lib/fs.h Makef
 	$(RM) -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno}
 	$(CC) -std=c99 $(CFLAGS) -o $@ cmd/split.c lib/truncation.c lib/fs.c $(LDFLAGS) $(LDSTATIC)
 
-cmd/tr: cmd/tr.c lib/tr_str.c lib/tr_str.h Makefile
+cmd/tr: cmd/tr.c lib/tr_str.c lib/tr_str.h lib/err.c lib/err.h Makefile
 	$(RM) -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno}
-	$(CC) -std=c99 $(CFLAGS) -o $@ cmd/tr.c lib/tr_str.c $(LDFLAGS) $(LDSTATIC)
+	$(CC) -std=c99 $(CFLAGS) -o $@ cmd/tr.c lib/tr_str.c lib/err.c $(LDFLAGS) $(LDSTATIC)
 
 cmd/chown: cmd/chown.c lib/fs.c lib/fs.h lib/user_group_parse.c lib/user_group_parse.h Makefile
 	$(RM) -f ${<:=.gcov} ${@:=.gcda} ${@:=.gcno}
diff --git a/bootstrap.sh b/bootstrap.sh
@@ -13,7 +13,7 @@ $CC -std=c99 $CFLAGS -o cmd/echo cmd/echo.c $LDFLAGS $LDSTATIC
 $CC -std=c99 $CFLAGS -o cmd/printf cmd/printf.c lib/err.c $LDFLAGS $LDSTATIC
 $CC -std=c99 $CFLAGS -o cmd/rm cmd/rm.c lib/consent.c $LDFLAGS $LDSTATIC
 $CC -std=c99 $CFLAGS -o cmd/test cmd/test.c $LDFLAGS $LDSTATIC
-$CC -std=c99 $CFLAGS -o cmd/tr cmd/tr.c lib/tr_str.c $LDFLAGS $LDSTATIC
+$CC -std=c99 $CFLAGS -o cmd/tr cmd/tr.c lib/tr_str.c lib/err.c $LDFLAGS $LDSTATIC
 
 ./cmd/printf '
 Done, you should now be able to run PATH=cmd/:$PATH ./configure && make clean && make
diff --git a/cmd/tr.c b/cmd/tr.c
@@ -32,9 +32,9 @@
 
 #define _DEFAULT_SOURCE
 
+#include "../lib/err.h"
 #include "../lib/tr_str.h"
 
-#include <err.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -179,7 +179,7 @@ main(int argc, char *argv[])
 		for(cnt = NCHARS, p = translate; cnt--;)
 			*p++ = OOBCH;
 
-	if(!next(&s2)) errx(1, "error: empty string2");
+	if(!next(&s2)) errx(1, "empty string2");
 
 	/* If string2 runs out of characters, use the last one specified. */
 	ch = s2.lastch;
diff --git a/lib/tr_str.c b/lib/tr_str.c
@@ -34,11 +34,11 @@
 #define _POSIX_C_SOURCE 202405L
 #include "./tr_str.h"
 
+#include "./err.h"
 #include "./reallocarray.h"
 
 #include <assert.h>
 #include <ctype.h>
-#include <err.h>
 #include <errno.h>
 #include <stddef.h>
 #include <stdio.h>