commit 3e0f6e46f28d50e02c54f693195804a00935beaf
parent 2a398814b71e115ad49901e23f48f911f0b349e5
Author: Kyle Milz <kyle@getaddrinfo.net>
Date: Thu, 17 Mar 2016 21:18:19 -0600
instrument: add dirname/basename hacks
Diffstat:
1 file changed, 10 insertions(+), 0 deletions(-)
diff --git a/instrument/main.cxx b/instrument/main.cxx
@@ -121,12 +121,22 @@ main(int argc, char *argv[])
source_files.push_back(arg);
// Find original directory or "." if relative path
+#ifdef __APPLE__
+ // Apple's man page says it modifies the argument
+ // pointer and the argument signature loses 'const'
+ char *src_dir = dirname(strdup(arg.c_str()));
+#else
char *src_dir = dirname(arg.c_str());
+#endif
if (src_dir == NULL)
err(1, "dirname");
// Find original file name
+#ifdef __APPLE__
+ char *src_name = basename(strdup(arg.c_str()));
+#else
char *src_name = basename(arg.c_str());
+#endif
if (src_name == NULL)
err(1, "basename");