When building a program foo in-tree, libtool 2.4.6 generates an
executable called lt-foo with a wrapper script called foo. This
means that argv[0] inside the program is lt-foo rather than foo.

This is a problem for dtcodegen, which uses the program name for various
purposes including the "generated by" banner and the logfile name.
Remove the lt- prefix if present to avoid this.
---
 cde/programs/dtappbuilder/src/libAButil/util.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/cde/programs/dtappbuilder/src/libAButil/util.c 
b/cde/programs/dtappbuilder/src/libAButil/util.c
index e9ea84942..b7e62c336 100644
--- a/cde/programs/dtappbuilder/src/libAButil/util.c
+++ b/cde/programs/dtappbuilder/src/libAButil/util.c
@@ -187,7 +187,17 @@ util_set_program_name_from_argv0(STRING argv0)
     util_get_file_name_from_path(argv0, progName, MAXPATHLEN);
     if (strlen(progName) > (size_t)0)
     {
-       util_set_program_name(progName);
+       STRING  progNameStart = progName;
+
+       /*
+        * Remove the lt- prefix added by libtool to helper programs.
+        */
+       if (strncmp(progNameStart, "lt-", 3) == 0)
+       {
+           progNameStart += 3;
+       }
+
+       util_set_program_name(progNameStart);
     }
     return 0;
 }
-- 
2.32.0



_______________________________________________
cdesktopenv-devel mailing list
cdesktopenv-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdesktopenv-devel

Reply via email to