From: Lars Wirzenius Date: Tue, 5 Jun 2012 17:09:29 +0000 (+0100) Subject: Change how errno values are printed, for portability X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=65c141be411582e64baac599b2901741bcda5305;p=moreutils Change how errno values are printed, for portability Reported and suggested by Pino Toscano: The Hurd does not #define the EFOO constants as simple integers, but as expressions. This made the code that generates errnos.h to misinterpret the value, and always print 0 for every error code. We fix this by instead using the EFOO macro in errnos.h, so that the preprocessor evaluates it correctly. This is the right thing to do anyway, for every platform. Thus the table changes from {"EFOO",42} to {"EFOO",EFOO} for each entry. --- diff --git a/Makefile b/Makefile index e798a98..21af683 100644 --- a/Makefile +++ b/Makefile @@ -50,7 +50,7 @@ parallel.1: parallel.docbook errno.o: errnos.h errnos.h: echo '#include ' > dump.c - $(CC) -E -dD dump.c | awk '/^#define E/ { printf "{\"%s\",%d},\n", $$2, $$3 }' > errnos.h + $(CC) -E -dD dump.c | awk '/^#define E/ { printf "{\"%s\",%s},\n", $$2, $$2 }' > errnos.h rm -f dump.c errno.1: errno.docbook