Created
June 7, 2012 12:57
-
-
Save deltheil/2888680 to your computer and use it in GitHub Desktop.
moreutils (errno): auto-generated errno-s header file via the preprocessor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Taken from http://joeyh.name/code/moreutils/ Makefile | |
# See http://blog.liw.fi/posts/errno/ for all the details about `errno` CLI tool | |
errno.o: errnos.h | |
errnos.h: | |
echo '#include <errno.h>' > dump.c | |
$(CC) -E -dD dump.c | awk '/^#define E/ { printf "{\"%s\",%d},\n", $$2, $$3 }' > errnos.h | |
rm -f dump.c | |
# On errno.c side this auto-generated header is used as follow | |
# -- | |
# static struct { | |
# const char *name; | |
# int code; | |
# } errnos[] = { | |
# #include "errnos.h" | |
# }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment