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:
committed by
Jon Trulson
parent
d9769e4774
commit
edf57b6db3
@@ -187,7 +187,17 @@ util_set_program_name_from_argv0(STRING argv0)
|
|||||||
util_get_file_name_from_path(argv0, progName, MAXPATHLEN);
|
util_get_file_name_from_path(argv0, progName, MAXPATHLEN);
|
||||||
if (strlen(progName) > (size_t)0)
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user