Use the getprogname gnulib module

Make use of the recently added 'getprogname' module in gnulib: replace
our guestfs_int_program_name with the getprogname() provided by the
module, since it does the same thing, and in a portable way.
As consequence of the above, use gnulib in a couple of tests that use
getprogname().

Since guestfs_int_program_name is gone, drop the configure checks
associated with it.
This commit is contained in:
Pino Toscano
2016-09-07 19:20:21 +02:00
parent 1f65143a42
commit eea210dbf7
47 changed files with 252 additions and 206 deletions

View File

@@ -32,6 +32,7 @@
#include "ignore-value.h"
#include "xvasprintf.h"
#include "getprogname.h"
#include "guestfs.h"
#include "options.h"
@@ -56,7 +57,7 @@ usage (int status)
{
if (status != EXIT_SUCCESS)
fprintf (stderr, _("Try `%s --help' for more information.\n"),
guestfs_int_program_name);
getprogname ());
else {
printf (_("%s: Run a rescue shell on a virtual machine\n"
"Copyright (C) 2009-2016 Red Hat Inc.\n"
@@ -82,8 +83,8 @@ usage (int status)
" -w|--rw Mount read-write\n"
" -x Trace libguestfs API calls\n"
"For more information, see the manpage %s(1).\n"),
guestfs_int_program_name, guestfs_int_program_name,
guestfs_int_program_name, guestfs_int_program_name);
getprogname (), getprogname (),
getprogname (), getprogname ());
}
exit (status);
}
@@ -279,7 +280,7 @@ main (int argc, char *argv[])
fprintf (stderr, _("%s: error: extra argument '%s' on command line.\n"
"Make sure to specify the argument for --format or --scratch "
"like '--format=%s'.\n"),
guestfs_int_program_name, argv[optind], argv[optind]);
getprogname (), argv[optind], argv[optind]);
usage (EXIT_FAILURE);
}
@@ -288,7 +289,7 @@ main (int argc, char *argv[])
/* User must have specified some drives. */
if (drvs == NULL) {
fprintf (stderr, _("%s: error: you must specify at least one -a or -d option.\n"),
guestfs_int_program_name);
getprogname ());
usage (EXIT_FAILURE);
}
@@ -306,7 +307,7 @@ main (int argc, char *argv[])
STRPREFIX (backend, "libvirt:")) {
fprintf (stderr, _("%s: warning: virt-rescue doesn't work with the libvirt backend\n"
"at the moment. As a workaround, forcing backend = 'direct'.\n"),
guestfs_int_program_name);
getprogname ());
if (guestfs_set_backend (g, "direct") == -1)
exit (EXIT_FAILURE);
}