bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] gnulib: Define argv[0] as program_name for error.c on Darwin


From: Richard W.M. Jones
Subject: [PATCH] gnulib: Define argv[0] as program_name for error.c on Darwin
Date: Fri, 13 Feb 2015 11:58:17 +0000

From: Margaret Lewicka <address@hidden>

---
 lib/error.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/error.c b/lib/error.c
index 6683197..36a3db7 100644
--- a/lib/error.c
+++ b/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
-- 
2.1.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]