Bruce Korb wrote:
> error.c has an unnecessary dependency on "program_name"
No, it is not an "unnecessary" dependency. There is no portable way for code
in a module to determine the name of the current program. Programs that use the
'error' module must define the program_name variable and assign it a value.
> It is fairly easy to fix, just make the definition weak
> and check for a NULL value before using it. OK to push?
>
> index ed9dba0..65f2d9d 100644
> --- a/lib/error.c
> +++ b/lib/error.c
> @@ -106,7 +106,7 @@ char *strerror_r ();
>
> /* The calling program should define program_name and set it to the
> name of the executing program. */
> -extern char *program_name;
> +char *program_name;
> ...
> + char const *p = program_name ? program_name : "unknown";
No, this is not OK, for two reasons:
1) It will cause a link error for all programs that define the 'program_name'
variable, on all non-ELF platforms (mainly MacOS X and Woe32).
2) Substituting "unknown" instead of a real program name will not help the
end user.
Bruno