lib: Change 'program_name' macro to avoid conflict with gnulib.

The gnulib 'error' module uses 'program_name'.  On some platforms --
but not Linux / glibc -- it references it as:

  extern char *program_name;

This means when you compile libguestfs on non-glibc (eg. Mac OS X)
gnulib requires 'program_name' as an external string reference, which
we don't provide.

This change doesn't define this string reference for gnulib, but it
does change the name of the macro we use to avoid conflicts if we
eventually need to export 'program_name' as a string.

Thanks: Margaret Lewicka
This commit is contained in:
Richard W.M. Jones
2015-02-07 16:27:03 +00:00
parent 7ddf6bcbfd
commit 5cafedaa45
41 changed files with 244 additions and 244 deletions

View File

@@ -90,7 +90,7 @@ usage (int status)
{
if (status != EXIT_SUCCESS)
fprintf (stderr, _("Try `%s --help' for more information.\n"),
program_name);
guestfs___program_name);
else {
fprintf (stdout,
_("%s: list differences between virtual machines\n"
@@ -126,8 +126,8 @@ usage (int status)
" -x Trace libguestfs API calls\n"
" --xattrs Display extended attributes\n"
"For more information, see the manpage %s(1).\n"),
program_name, program_name, program_name,
program_name);
guestfs___program_name, guestfs___program_name, guestfs___program_name,
guestfs___program_name);
}
exit (status);
}
@@ -262,7 +262,7 @@ main (int argc, char *argv[])
enable_xattrs = 1;
} else {
fprintf (stderr, _("%s: unknown long option: %s (%d)\n"),
program_name, long_options[option_index].name, option_index);
guestfs___program_name, long_options[option_index].name, option_index);
exit (EXIT_FAILURE);
}
break;
@@ -319,7 +319,7 @@ main (int argc, char *argv[])
if (drvs == NULL || drvs2 == NULL) {
fprintf (stderr,
_("%s: you must specify some -a|-A|-d|-D options, see %s(1)\n"),
program_name, program_name);
guestfs___program_name, guestfs___program_name);
usage (EXIT_FAILURE);
}
@@ -328,13 +328,13 @@ main (int argc, char *argv[])
*/
if (human && csv) {
fprintf (stderr, _("%s: you cannot use -h and --csv options together.\n"),
program_name);
guestfs___program_name);
exit (EXIT_FAILURE);
}
if (optind != argc) {
fprintf (stderr, _("%s: extra arguments on the command line\n"),
program_name);
guestfs___program_name);
usage (EXIT_FAILURE);
}
@@ -741,7 +741,7 @@ diff (struct file *file1, guestfs_h *g1, struct file *file2, guestfs_h *g2)
fprintf (stderr, "%s\n", cmd);
r = system (cmd);
if (!WIFEXITED (r) || WEXITSTATUS (r) != 0) {
fprintf (stderr, _("%s: external diff command failed\n"), program_name);
fprintf (stderr, _("%s: external diff command failed\n"), guestfs___program_name);
goto out;
}