Created
March 25, 2015 22:39
-
-
Save shulima/d851f8f35526db5e2fe9 to your computer and use it in GitHub Desktop.
Monkey-patch program_name into gnulib
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
diff --git a/gnulib/lib/error.c b/gnulib/lib/error.c | |
index 18ff5db..d8c5acb 100644 | |
--- a/gnulib/lib/error.c | |
+++ b/gnulib/lib/error.c | |
@@ -113,9 +113,13 @@ int strerror_r (); | |
# endif | |
# endif | |
+#if defined __APPLE__ && defined __MACH__ | |
+#define program_name (((char **)*_NSGetArgv())[0]) | |
+#else | |
/* The calling program should define program_name and set it to the | |
name of the executing program. */ | |
extern char *program_name; | |
+#endif | |
# if HAVE_STRERROR_R || defined strerror_r | |
# define __strerror_r strerror_r |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment