1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

libAButil: remove lt- prefix from program name

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.
This commit is contained in:
Adam Sampson 2021-07-04 15:22:47 +01:00 committed by Jon Trulson
parent d9769e4774
commit edf57b6db3

View file

@ -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;
}