Revision: 57858
http://sourceforge.net/p/brlcad/code/57858
Author: brlcad
Date: 2013-09-24 05:05:58 +0000 (Tue, 24 Sep 2013)
Log Message:
-----------
if basename is a relative path, we need to attach it to the cwd. this fixes
bu_argv0_full_path() if/when bu_setprogname() is set or we have access to
program_invocation_name (glibc)
Modified Paths:
--------------
brlcad/branches/RELEASE/src/libbu/progname.c
Modified: brlcad/branches/RELEASE/src/libbu/progname.c
===================================================================
--- brlcad/branches/RELEASE/src/libbu/progname.c 2013-09-24 05:04:22 UTC
(rev 57857)
+++ brlcad/branches/RELEASE/src/libbu/progname.c 2013-09-24 05:05:58 UTC
(rev 57858)
@@ -45,9 +45,15 @@
{
static char buffer[MAXPATHLEN] = {0};
- const char *argv0 = bu_getprogname();
- const char *which = bu_which(argv0);
+ const char *argv0 = bu_progname;
+ const char *which;
+#ifdef HAVE_PROGRAM_INVOCATION_NAME
+ /* GLIBC provides a way */
+ if (argv0[0] == BU_DIR_SEPARATOR && program_invocation_name)
+ argv0 = program_invocation_name;
+#endif
+
if (argv0[0] == BU_DIR_SEPARATOR) {
/* seems to already be a full path */
snprintf(buffer, MAXPATHLEN, "%s", argv0);
@@ -55,9 +61,9 @@
}
/* running from PATH */
- if (which) {
- snprintf(buffer, MAXPATHLEN, "%s", which);
- return buffer;
+ which = bu_which(argv0);
+ if (which && which[0] != '\0') {
+ argv0 = which;
}
while (argv0[0] == '.' && argv0[1] == BU_DIR_SEPARATOR) {
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits