mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
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:
@@ -38,6 +38,8 @@
|
|||||||
#include <libvirt/virterror.h>
|
#include <libvirt/virterror.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "getprogname.h"
|
||||||
|
|
||||||
#include "guestfs.h"
|
#include "guestfs.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "display-options.h"
|
#include "display-options.h"
|
||||||
@@ -73,7 +75,7 @@ usage (int status)
|
|||||||
{
|
{
|
||||||
if (status != EXIT_SUCCESS)
|
if (status != EXIT_SUCCESS)
|
||||||
fprintf (stderr, _("Try `%s --help' for more information.\n"),
|
fprintf (stderr, _("Try `%s --help' for more information.\n"),
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
else {
|
else {
|
||||||
printf (_("%s: check alignment of virtual machine partitions\n"
|
printf (_("%s: check alignment of virtual machine partitions\n"
|
||||||
"Copyright (C) 2011 Red Hat Inc.\n"
|
"Copyright (C) 2011 Red Hat Inc.\n"
|
||||||
@@ -93,8 +95,8 @@ usage (int status)
|
|||||||
" -V|--version Display version and exit\n"
|
" -V|--version Display version and exit\n"
|
||||||
" -x Trace libguestfs API calls\n"
|
" -x Trace libguestfs API calls\n"
|
||||||
"For more information, see the manpage %s(1).\n"),
|
"For more information, see the manpage %s(1).\n"),
|
||||||
guestfs_int_program_name, guestfs_int_program_name,
|
getprogname (), getprogname (),
|
||||||
guestfs_int_program_name, guestfs_int_program_name);
|
getprogname (), getprogname ());
|
||||||
}
|
}
|
||||||
exit (status);
|
exit (status);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ full-write
|
|||||||
futimens
|
futimens
|
||||||
getaddrinfo
|
getaddrinfo
|
||||||
getline
|
getline
|
||||||
|
getprogname
|
||||||
gitlog-to-changelog
|
gitlog-to-changelog
|
||||||
glob
|
glob
|
||||||
gnu-make
|
gnu-make
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
|
|
||||||
#include <guestfs.h>
|
#include <guestfs.h>
|
||||||
|
|
||||||
|
#include "getprogname.h"
|
||||||
#include "guestfs-internal-frontend.h"
|
#include "guestfs-internal-frontend.h"
|
||||||
|
|
||||||
#include "index-struct.h"
|
#include "index-struct.h"
|
||||||
@@ -40,7 +41,7 @@ extern int do_parse (struct parse_context *context, FILE *in);
|
|||||||
static void
|
static void
|
||||||
usage (int exit_status)
|
usage (int exit_status)
|
||||||
{
|
{
|
||||||
printf ("%s index\n", guestfs_int_program_name);
|
printf ("%s index\n", getprogname ());
|
||||||
exit (exit_status);
|
exit (exit_status);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,7 +91,7 @@ main (int argc, char *argv[])
|
|||||||
|
|
||||||
case 'V':
|
case 'V':
|
||||||
printf ("%s %s%s\n",
|
printf ("%s %s%s\n",
|
||||||
guestfs_int_program_name,
|
getprogname (),
|
||||||
PACKAGE_VERSION, PACKAGE_VERSION_EXTRA);
|
PACKAGE_VERSION, PACKAGE_VERSION_EXTRA);
|
||||||
exit (EXIT_SUCCESS);
|
exit (EXIT_SUCCESS);
|
||||||
|
|
||||||
@@ -115,7 +116,7 @@ main (int argc, char *argv[])
|
|||||||
|
|
||||||
if (fclose (in) == EOF) {
|
if (fclose (in) == EOF) {
|
||||||
fprintf (stderr, _("%s: %s: error closing input file: %m (ignored)\n"),
|
fprintf (stderr, _("%s: %s: error closing input file: %m (ignored)\n"),
|
||||||
guestfs_int_program_name, input);
|
getprogname (), input);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
|
|||||||
10
cat/cat.c
10
cat/cat.c
@@ -30,6 +30,8 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <libintl.h>
|
#include <libintl.h>
|
||||||
|
|
||||||
|
#include "getprogname.h"
|
||||||
|
|
||||||
#include "guestfs.h"
|
#include "guestfs.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "display-options.h"
|
#include "display-options.h"
|
||||||
@@ -53,7 +55,7 @@ usage (int status)
|
|||||||
{
|
{
|
||||||
if (status != EXIT_SUCCESS)
|
if (status != EXIT_SUCCESS)
|
||||||
fprintf (stderr, _("Try `%s --help' for more information.\n"),
|
fprintf (stderr, _("Try `%s --help' for more information.\n"),
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
else {
|
else {
|
||||||
printf (_("%s: display files in a virtual machine\n"
|
printf (_("%s: display files in a virtual machine\n"
|
||||||
"Copyright (C) 2010 Red Hat Inc.\n"
|
"Copyright (C) 2010 Red Hat Inc.\n"
|
||||||
@@ -74,8 +76,8 @@ usage (int status)
|
|||||||
" -V|--version Display version and exit\n"
|
" -V|--version Display version and exit\n"
|
||||||
" -x Trace libguestfs API calls\n"
|
" -x Trace libguestfs API calls\n"
|
||||||
"For more information, see the manpage %s(1).\n"),
|
"For more information, see the manpage %s(1).\n"),
|
||||||
guestfs_int_program_name, guestfs_int_program_name,
|
getprogname (), getprogname (),
|
||||||
guestfs_int_program_name, guestfs_int_program_name);
|
getprogname (), getprogname ());
|
||||||
}
|
}
|
||||||
exit (status);
|
exit (status);
|
||||||
}
|
}
|
||||||
@@ -227,7 +229,7 @@ main (int argc, char *argv[])
|
|||||||
/* User must have specified some drives. */
|
/* User must have specified some drives. */
|
||||||
if (drvs == NULL) {
|
if (drvs == NULL) {
|
||||||
fprintf (stderr, _("%s: error: you must specify at least one -a or -d option.\n"),
|
fprintf (stderr, _("%s: error: you must specify at least one -a or -d option.\n"),
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
usage (EXIT_FAILURE);
|
usage (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
|
|
||||||
#include "c-ctype.h"
|
#include "c-ctype.h"
|
||||||
#include "human.h"
|
#include "human.h"
|
||||||
|
#include "getprogname.h"
|
||||||
|
|
||||||
#include "guestfs.h"
|
#include "guestfs.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
@@ -87,7 +88,7 @@ usage (int status)
|
|||||||
{
|
{
|
||||||
if (status != EXIT_SUCCESS)
|
if (status != EXIT_SUCCESS)
|
||||||
fprintf (stderr, _("Try `%s --help' for more information.\n"),
|
fprintf (stderr, _("Try `%s --help' for more information.\n"),
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
else {
|
else {
|
||||||
printf (_("%s: list filesystems, partitions, block devices, LVM in a VM\n"
|
printf (_("%s: list filesystems, partitions, block devices, LVM in a VM\n"
|
||||||
"Copyright (C) 2010 Red Hat Inc.\n"
|
"Copyright (C) 2010 Red Hat Inc.\n"
|
||||||
@@ -123,8 +124,8 @@ usage (int status)
|
|||||||
" Display LVM volume groups\n"
|
" Display LVM volume groups\n"
|
||||||
" -x Trace libguestfs API calls\n"
|
" -x Trace libguestfs API calls\n"
|
||||||
"For more information, see the manpage %s(1).\n"),
|
"For more information, see the manpage %s(1).\n"),
|
||||||
guestfs_int_program_name, guestfs_int_program_name,
|
getprogname (), getprogname (),
|
||||||
guestfs_int_program_name, guestfs_int_program_name);
|
getprogname (), getprogname ());
|
||||||
}
|
}
|
||||||
exit (status);
|
exit (status);
|
||||||
}
|
}
|
||||||
@@ -296,7 +297,7 @@ main (int argc, char *argv[])
|
|||||||
fprintf (stderr, _("%s: error: extra argument '%s' on command line.\n"
|
fprintf (stderr, _("%s: error: extra argument '%s' on command line.\n"
|
||||||
"Make sure to specify the argument for --format "
|
"Make sure to specify the argument for --format "
|
||||||
"like '--format=%s'.\n"),
|
"like '--format=%s'.\n"),
|
||||||
guestfs_int_program_name, argv[optind], argv[optind]);
|
getprogname (), argv[optind], argv[optind]);
|
||||||
usage (EXIT_FAILURE);
|
usage (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -337,7 +338,7 @@ main (int argc, char *argv[])
|
|||||||
/* User must have specified some drives. */
|
/* User must have specified some drives. */
|
||||||
if (drvs == NULL) {
|
if (drvs == NULL) {
|
||||||
fprintf (stderr, _("%s: error: you must specify at least one -a or -d option.\n"),
|
fprintf (stderr, _("%s: error: you must specify at least one -a or -d option.\n"),
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
usage (EXIT_FAILURE);
|
usage (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -486,7 +487,7 @@ do_output_filesystems (void)
|
|||||||
if (subvolume == NULL && guestfs_last_errno (g) != EINVAL) {
|
if (subvolume == NULL && guestfs_last_errno (g) != EINVAL) {
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_("%s: cannot determine the subvolume for %s: %s: %s\n"),
|
_("%s: cannot determine the subvolume for %s: %s: %s\n"),
|
||||||
guestfs_int_program_name, fses[i],
|
getprogname (), fses[i],
|
||||||
guestfs_last_error (g),
|
guestfs_last_error (g),
|
||||||
strerror (guestfs_last_errno (g)));
|
strerror (guestfs_last_errno (g)));
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
|
|||||||
22
cat/log.c
22
cat/log.c
@@ -35,6 +35,8 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
|
||||||
|
#include "getprogname.h"
|
||||||
|
|
||||||
#include "guestfs.h"
|
#include "guestfs.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "display-options.h"
|
#include "display-options.h"
|
||||||
@@ -62,7 +64,7 @@ usage (int status)
|
|||||||
{
|
{
|
||||||
if (status != EXIT_SUCCESS)
|
if (status != EXIT_SUCCESS)
|
||||||
fprintf (stderr, _("Try `%s --help' for more information.\n"),
|
fprintf (stderr, _("Try `%s --help' for more information.\n"),
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
else {
|
else {
|
||||||
printf (_("%s: display log files in a virtual machine\n"
|
printf (_("%s: display log files in a virtual machine\n"
|
||||||
"Copyright (C) 2010-2016 Red Hat Inc.\n"
|
"Copyright (C) 2010-2016 Red Hat Inc.\n"
|
||||||
@@ -81,8 +83,8 @@ usage (int status)
|
|||||||
" -V|--version Display version and exit\n"
|
" -V|--version Display version and exit\n"
|
||||||
" -x Trace libguestfs API calls\n"
|
" -x Trace libguestfs API calls\n"
|
||||||
"For more information, see the manpage %s(1).\n"),
|
"For more information, see the manpage %s(1).\n"),
|
||||||
guestfs_int_program_name, guestfs_int_program_name,
|
getprogname (), getprogname (),
|
||||||
guestfs_int_program_name, guestfs_int_program_name);
|
getprogname (), getprogname ());
|
||||||
}
|
}
|
||||||
exit (status);
|
exit (status);
|
||||||
}
|
}
|
||||||
@@ -189,7 +191,7 @@ main (int argc, char *argv[])
|
|||||||
fprintf (stderr, _("%s: error: extra argument '%s' on command line.\n"
|
fprintf (stderr, _("%s: error: extra argument '%s' on command line.\n"
|
||||||
"Make sure to specify the argument for --format "
|
"Make sure to specify the argument for --format "
|
||||||
"like '--format=%s'.\n"),
|
"like '--format=%s'.\n"),
|
||||||
guestfs_int_program_name, argv[optind], argv[optind]);
|
getprogname (), argv[optind], argv[optind]);
|
||||||
usage (EXIT_FAILURE);
|
usage (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,7 +200,7 @@ main (int argc, char *argv[])
|
|||||||
/* User must have specified some drives. */
|
/* User must have specified some drives. */
|
||||||
if (drvs == NULL) {
|
if (drvs == NULL) {
|
||||||
fprintf (stderr, _("%s: error: you must specify at least one -a or -d option.\n"),
|
fprintf (stderr, _("%s: error: you must specify at least one -a or -d option.\n"),
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
usage (EXIT_FAILURE);
|
usage (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -250,7 +252,7 @@ do_log (void)
|
|||||||
|
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_("%s: Windows Event Log for pre-Vista guests is not supported.\n"),
|
_("%s: Windows Event Log for pre-Vista guests is not supported.\n"),
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -358,7 +360,7 @@ do_log_journal (void)
|
|||||||
if (strftime (buf, sizeof buf, "%b %d %H:%M:%S",
|
if (strftime (buf, sizeof buf, "%b %d %H:%M:%S",
|
||||||
localtime_r (&t, &tm)) <= 0) {
|
localtime_r (&t, &tm)) <= 0) {
|
||||||
fprintf (stderr, _("%s: could not format journal entry timestamp\n"),
|
fprintf (stderr, _("%s: could not format journal entry timestamp\n"),
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
errors++;
|
errors++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -427,7 +429,7 @@ do_log_windows_evtx (void)
|
|||||||
"in order to parse Windows Event Logs. If you cannot install this, then\n"
|
"in order to parse Windows Event Logs. If you cannot install this, then\n"
|
||||||
"use virt-copy-out(1) to copy the contents of /Windows/System32/winevt/Logs\n"
|
"use virt-copy-out(1) to copy the contents of /Windows/System32/winevt/Logs\n"
|
||||||
"from this guest, and examine in a binary file viewer.\n"),
|
"from this guest, and examine in a binary file viewer.\n"),
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -443,7 +445,7 @@ do_log_windows_evtx (void)
|
|||||||
GUESTFS_IS_FILE_OPTS_FOLLOWSYMLINKS, 1,
|
GUESTFS_IS_FILE_OPTS_FOLLOWSYMLINKS, 1,
|
||||||
-1) <= 0) {
|
-1) <= 0) {
|
||||||
fprintf (stderr, _("%s: Windows Event Log file (%s) not found\n"),
|
fprintf (stderr, _("%s: Windows Event Log file (%s) not found\n"),
|
||||||
guestfs_int_program_name, filename);
|
getprogname (), filename);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -475,7 +477,7 @@ do_log_windows_evtx (void)
|
|||||||
if (status) {
|
if (status) {
|
||||||
char buf[256];
|
char buf[256];
|
||||||
fprintf (stderr, "%s: %s\n",
|
fprintf (stderr, "%s: %s\n",
|
||||||
guestfs_int_program_name,
|
getprogname (),
|
||||||
guestfs_int_exit_status_to_string (status, "evtxdump.py",
|
guestfs_int_exit_status_to_string (status, "evtxdump.py",
|
||||||
buf, sizeof buf));
|
buf, sizeof buf));
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
9
cat/ls.c
9
cat/ls.c
@@ -34,6 +34,7 @@
|
|||||||
#include <sys/sysmacros.h>
|
#include <sys/sysmacros.h>
|
||||||
|
|
||||||
#include "human.h"
|
#include "human.h"
|
||||||
|
#include "getprogname.h"
|
||||||
|
|
||||||
#include "guestfs.h"
|
#include "guestfs.h"
|
||||||
|
|
||||||
@@ -84,7 +85,7 @@ usage (int status)
|
|||||||
{
|
{
|
||||||
if (status != EXIT_SUCCESS)
|
if (status != EXIT_SUCCESS)
|
||||||
fprintf (stderr, _("Try `%s --help' for more information.\n"),
|
fprintf (stderr, _("Try `%s --help' for more information.\n"),
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
else {
|
else {
|
||||||
printf (_("%s: list files in a virtual machine\n"
|
printf (_("%s: list files in a virtual machine\n"
|
||||||
"Copyright (C) 2010-2012 Red Hat Inc.\n"
|
"Copyright (C) 2010-2012 Red Hat Inc.\n"
|
||||||
@@ -116,8 +117,8 @@ usage (int status)
|
|||||||
" -V|--version Display version and exit\n"
|
" -V|--version Display version and exit\n"
|
||||||
" -x Trace libguestfs API calls\n"
|
" -x Trace libguestfs API calls\n"
|
||||||
"For more information, see the manpage %s(1).\n"),
|
"For more information, see the manpage %s(1).\n"),
|
||||||
guestfs_int_program_name, guestfs_int_program_name,
|
getprogname (), getprogname (),
|
||||||
guestfs_int_program_name, guestfs_int_program_name);
|
getprogname (), getprogname ());
|
||||||
}
|
}
|
||||||
exit (status);
|
exit (status);
|
||||||
}
|
}
|
||||||
@@ -344,7 +345,7 @@ main (int argc, char *argv[])
|
|||||||
/* User must have specified some drives. */
|
/* User must have specified some drives. */
|
||||||
if (drvs == NULL) {
|
if (drvs == NULL) {
|
||||||
fprintf (stderr, _("%s: error: you must specify at least one -a or -d option.\n"),
|
fprintf (stderr, _("%s: error: you must specify at least one -a or -d option.\n"),
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
usage (EXIT_FAILURE);
|
usage (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,8 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <libintl.h>
|
#include <libintl.h>
|
||||||
|
|
||||||
|
#include "getprogname.h"
|
||||||
|
|
||||||
#include "guestfs.h"
|
#include "guestfs.h"
|
||||||
#include "guestfs-internal-frontend.h"
|
#include "guestfs-internal-frontend.h"
|
||||||
|
|
||||||
@@ -128,7 +130,7 @@ _visit (guestfs_h *g, int depth, const char *dir,
|
|||||||
|
|
||||||
if (xattrs->val[xattrp].attrval_len == 0) {
|
if (xattrs->val[xattrp].attrval_len == 0) {
|
||||||
fprintf (stderr, _("%s: error getting extended attrs for %s %s\n"),
|
fprintf (stderr, _("%s: error getting extended attrs for %s %s\n"),
|
||||||
guestfs_int_program_name, dir, names[i]);
|
getprogname (), dir, names[i]);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
/* attrval is not \0-terminated. */
|
/* attrval is not \0-terminated. */
|
||||||
@@ -142,7 +144,7 @@ _visit (guestfs_h *g, int depth, const char *dir,
|
|||||||
attrval[xattrs->val[xattrp].attrval_len] = '\0';
|
attrval[xattrs->val[xattrp].attrval_len] = '\0';
|
||||||
if (sscanf (attrval, "%zu", &nr_xattrs) != 1) {
|
if (sscanf (attrval, "%zu", &nr_xattrs) != 1) {
|
||||||
fprintf (stderr, _("%s: error: cannot parse xattr count for %s %s\n"),
|
fprintf (stderr, _("%s: error: cannot parse xattr count for %s %s\n"),
|
||||||
guestfs_int_program_name, dir, names[i]);
|
getprogname (), dir, names[i]);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,8 @@
|
|||||||
#include <libvirt/virterror.h>
|
#include <libvirt/virterror.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "getprogname.h"
|
||||||
|
|
||||||
#include "guestfs.h"
|
#include "guestfs.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "display-options.h"
|
#include "display-options.h"
|
||||||
@@ -66,7 +68,7 @@ usage (int status)
|
|||||||
{
|
{
|
||||||
if (status != EXIT_SUCCESS)
|
if (status != EXIT_SUCCESS)
|
||||||
fprintf (stderr, _("Try `%s --help' for more information.\n"),
|
fprintf (stderr, _("Try `%s --help' for more information.\n"),
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
else {
|
else {
|
||||||
printf (_("%s: display free space on virtual filesystems\n"
|
printf (_("%s: display free space on virtual filesystems\n"
|
||||||
"Copyright (C) 2010 Red Hat Inc.\n"
|
"Copyright (C) 2010 Red Hat Inc.\n"
|
||||||
@@ -89,8 +91,8 @@ usage (int status)
|
|||||||
" -V|--version Display version and exit\n"
|
" -V|--version Display version and exit\n"
|
||||||
" -x Trace libguestfs API calls\n"
|
" -x Trace libguestfs API calls\n"
|
||||||
"For more information, see the manpage %s(1).\n"),
|
"For more information, see the manpage %s(1).\n"),
|
||||||
guestfs_int_program_name, guestfs_int_program_name,
|
getprogname (), getprogname (),
|
||||||
guestfs_int_program_name, guestfs_int_program_name);
|
getprogname (), getprogname ());
|
||||||
}
|
}
|
||||||
exit (status);
|
exit (status);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,6 +44,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "ignore-value.h"
|
#include "ignore-value.h"
|
||||||
|
#include "getprogname.h"
|
||||||
|
|
||||||
#include "guestfs.h"
|
#include "guestfs.h"
|
||||||
#include "guestfs-internal-frontend.h"
|
#include "guestfs-internal-frontend.h"
|
||||||
@@ -298,7 +299,7 @@ static void
|
|||||||
thread_failure (const char *fn, int err)
|
thread_failure (const char *fn, int err)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "%s: %s: %s\n",
|
fprintf (stderr, "%s: %s: %s\n",
|
||||||
guestfs_int_program_name, fn, strerror (err));
|
getprogname (), fn, strerror (err));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* HAVE_LIBVIRT */
|
#endif /* HAVE_LIBVIRT */
|
||||||
|
|||||||
15
diff/diff.c
15
diff/diff.c
@@ -36,6 +36,7 @@
|
|||||||
|
|
||||||
#include "c-ctype.h"
|
#include "c-ctype.h"
|
||||||
#include "human.h"
|
#include "human.h"
|
||||||
|
#include "getprogname.h"
|
||||||
|
|
||||||
#include "guestfs.h"
|
#include "guestfs.h"
|
||||||
|
|
||||||
@@ -93,7 +94,7 @@ usage (int status)
|
|||||||
{
|
{
|
||||||
if (status != EXIT_SUCCESS)
|
if (status != EXIT_SUCCESS)
|
||||||
fprintf (stderr, _("Try `%s --help' for more information.\n"),
|
fprintf (stderr, _("Try `%s --help' for more information.\n"),
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
else {
|
else {
|
||||||
printf (_("%s: list differences between virtual machines\n"
|
printf (_("%s: list differences between virtual machines\n"
|
||||||
"Copyright (C) 2010-2016 Red Hat Inc.\n"
|
"Copyright (C) 2010-2016 Red Hat Inc.\n"
|
||||||
@@ -128,8 +129,8 @@ usage (int status)
|
|||||||
" -x Trace libguestfs API calls\n"
|
" -x Trace libguestfs API calls\n"
|
||||||
" --xattrs Display extended attributes\n"
|
" --xattrs Display extended attributes\n"
|
||||||
"For more information, see the manpage %s(1).\n"),
|
"For more information, see the manpage %s(1).\n"),
|
||||||
guestfs_int_program_name, guestfs_int_program_name,
|
getprogname (), getprogname (),
|
||||||
guestfs_int_program_name, guestfs_int_program_name);
|
getprogname (), getprogname ());
|
||||||
}
|
}
|
||||||
exit (status);
|
exit (status);
|
||||||
}
|
}
|
||||||
@@ -316,12 +317,12 @@ main (int argc, char *argv[])
|
|||||||
|
|
||||||
if (drvs == NULL) {
|
if (drvs == NULL) {
|
||||||
fprintf (stderr, _("%s: error: you must specify at least one -a or -d option.\n"),
|
fprintf (stderr, _("%s: error: you must specify at least one -a or -d option.\n"),
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
usage (EXIT_FAILURE);
|
usage (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
if (drvs2 == NULL) {
|
if (drvs2 == NULL) {
|
||||||
fprintf (stderr, _("%s: error: you must specify at least one -A or -D option.\n"),
|
fprintf (stderr, _("%s: error: you must specify at least one -A or -D option.\n"),
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
usage (EXIT_FAILURE);
|
usage (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -335,7 +336,7 @@ main (int argc, char *argv[])
|
|||||||
fprintf (stderr, _("%s: error: extra argument '%s' on command line.\n"
|
fprintf (stderr, _("%s: error: extra argument '%s' on command line.\n"
|
||||||
"Make sure to specify the argument for --checksum or --format "
|
"Make sure to specify the argument for --checksum or --format "
|
||||||
"like '--format=%s'.\n"),
|
"like '--format=%s'.\n"),
|
||||||
guestfs_int_program_name, argv[optind], argv[optind]);
|
getprogname (), argv[optind], argv[optind]);
|
||||||
usage (EXIT_FAILURE);
|
usage (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -734,7 +735,7 @@ diff (struct file *file1, guestfs_h *g1, struct file *file2, guestfs_h *g2)
|
|||||||
fprintf (stderr, "%s\n", cmd);
|
fprintf (stderr, "%s\n", cmd);
|
||||||
r = system (cmd);
|
r = system (cmd);
|
||||||
if (!WIFEXITED (r) || WEXITSTATUS (r) != 0) {
|
if (!WIFEXITED (r) || WEXITSTATUS (r) != 0) {
|
||||||
fprintf (stderr, _("%s: external diff command failed\n"), guestfs_int_program_name);
|
fprintf (stderr, _("%s: external diff command failed\n"), getprogname ());
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
#include <utime.h>
|
#include <utime.h>
|
||||||
|
|
||||||
#include "xvasprintf.h"
|
#include "xvasprintf.h"
|
||||||
|
#include "getprogname.h"
|
||||||
|
|
||||||
#include "guestfs.h"
|
#include "guestfs.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
@@ -63,7 +64,7 @@ usage (int status)
|
|||||||
{
|
{
|
||||||
if (status != EXIT_SUCCESS)
|
if (status != EXIT_SUCCESS)
|
||||||
fprintf (stderr, _("Try `%s --help' for more information.\n"),
|
fprintf (stderr, _("Try `%s --help' for more information.\n"),
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
else {
|
else {
|
||||||
printf (_("%s: Edit a file in a virtual machine\n"
|
printf (_("%s: Edit a file in a virtual machine\n"
|
||||||
"Copyright (C) 2009-2016 Red Hat Inc.\n"
|
"Copyright (C) 2009-2016 Red Hat Inc.\n"
|
||||||
@@ -86,8 +87,8 @@ usage (int status)
|
|||||||
" -V|--version Display version and exit\n"
|
" -V|--version Display version and exit\n"
|
||||||
" -x Trace libguestfs API calls\n"
|
" -x Trace libguestfs API calls\n"
|
||||||
"For more information, see the manpage %s(1).\n"),
|
"For more information, see the manpage %s(1).\n"),
|
||||||
guestfs_int_program_name, guestfs_int_program_name,
|
getprogname (), getprogname (),
|
||||||
guestfs_int_program_name, guestfs_int_program_name);
|
getprogname (), getprogname ());
|
||||||
}
|
}
|
||||||
exit (status);
|
exit (status);
|
||||||
}
|
}
|
||||||
@@ -256,7 +257,7 @@ main (int argc, char *argv[])
|
|||||||
/* User must have specified some drives. */
|
/* User must have specified some drives. */
|
||||||
if (drvs == NULL) {
|
if (drvs == NULL) {
|
||||||
fprintf (stderr, _("%s: error: you must specify at least one -a or -d option.\n"),
|
fprintf (stderr, _("%s: error: you must specify at least one -a or -d option.\n"),
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
usage (EXIT_FAILURE);
|
usage (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,8 @@
|
|||||||
#include <libconfig.h>
|
#include <libconfig.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "getprogname.h"
|
||||||
|
|
||||||
#include "guestfs.h"
|
#include "guestfs.h"
|
||||||
|
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
@@ -62,7 +64,7 @@ read_config_from_file (const char *filename)
|
|||||||
/*
|
/*
|
||||||
if (verbose)
|
if (verbose)
|
||||||
fprintf (stderr, "%s: reading configuration from %s\n",
|
fprintf (stderr, "%s: reading configuration from %s\n",
|
||||||
guestfs_int_program_name, filename);
|
getprogname (), filename);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (config_read (&conf, fp) == CONFIG_FALSE)
|
if (config_read (&conf, fp) == CONFIG_FALSE)
|
||||||
@@ -155,7 +157,7 @@ parse_config (void)
|
|||||||
if (verbose)
|
if (verbose)
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_("%s: compiled without libconfig, guestfish configuration file ignored\n"),
|
_("%s: compiled without libconfig, guestfish configuration file ignored\n"),
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
41
fish/fish.c
41
fish/fish.c
@@ -54,6 +54,7 @@
|
|||||||
#include "c-ctype.h"
|
#include "c-ctype.h"
|
||||||
#include "closeout.h"
|
#include "closeout.h"
|
||||||
#include "ignore-value.h"
|
#include "ignore-value.h"
|
||||||
|
#include "getprogname.h"
|
||||||
|
|
||||||
/* Return from parse_command_line. See description below. */
|
/* Return from parse_command_line. See description below. */
|
||||||
struct parsed_command {
|
struct parsed_command {
|
||||||
@@ -110,7 +111,7 @@ usage (int status)
|
|||||||
{
|
{
|
||||||
if (status != EXIT_SUCCESS)
|
if (status != EXIT_SUCCESS)
|
||||||
fprintf (stderr, _("Try `%s --help' for more information.\n"),
|
fprintf (stderr, _("Try `%s --help' for more information.\n"),
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
else {
|
else {
|
||||||
printf (_("%s: guest filesystem shell\n"
|
printf (_("%s: guest filesystem shell\n"
|
||||||
"%s lets you edit virtual machine filesystems\n"
|
"%s lets you edit virtual machine filesystems\n"
|
||||||
@@ -159,10 +160,10 @@ usage (int status)
|
|||||||
"run again without -i and use 'run' + 'list-filesystems' + 'mount' cmds.\n"
|
"run again without -i and use 'run' + 'list-filesystems' + 'mount' cmds.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"For more information, see the manpage %s(1).\n"),
|
"For more information, see the manpage %s(1).\n"),
|
||||||
guestfs_int_program_name, guestfs_int_program_name,
|
getprogname (), getprogname (),
|
||||||
guestfs_int_program_name, guestfs_int_program_name,
|
getprogname (), getprogname (),
|
||||||
guestfs_int_program_name, guestfs_int_program_name,
|
getprogname (), getprogname (),
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
}
|
}
|
||||||
exit (status);
|
exit (status);
|
||||||
}
|
}
|
||||||
@@ -311,7 +312,7 @@ main (int argc, char *argv[])
|
|||||||
|
|
||||||
case 'D':
|
case 'D':
|
||||||
fprintf (stderr, _("%s: warning: -D option is deprecated, use --no-dest-paths instead\n"),
|
fprintf (stderr, _("%s: warning: -D option is deprecated, use --no-dest-paths instead\n"),
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
complete_dest_paths = 0;
|
complete_dest_paths = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -854,7 +855,7 @@ parse_command_line (char *buf, int *exit_on_error_rtn)
|
|||||||
if (p[len+1] && (p[len+1] != ' ' && p[len+1] != '\t')) {
|
if (p[len+1] && (p[len+1] != ' ' && p[len+1] != '\t')) {
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_("%s: command arguments not separated by whitespace\n"),
|
_("%s: command arguments not separated by whitespace\n"),
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
pcmd.status = -1;
|
pcmd.status = -1;
|
||||||
return pcmd;
|
return pcmd;
|
||||||
}
|
}
|
||||||
@@ -863,14 +864,14 @@ parse_command_line (char *buf, int *exit_on_error_rtn)
|
|||||||
p++;
|
p++;
|
||||||
len = strcspn (p, "'");
|
len = strcspn (p, "'");
|
||||||
if (p[len] == '\0') {
|
if (p[len] == '\0') {
|
||||||
fprintf (stderr, _("%s: unterminated single quote\n"), guestfs_int_program_name);
|
fprintf (stderr, _("%s: unterminated single quote\n"), getprogname ());
|
||||||
pcmd.status = -1;
|
pcmd.status = -1;
|
||||||
return pcmd;
|
return pcmd;
|
||||||
}
|
}
|
||||||
if (p[len+1] && (p[len+1] != ' ' && p[len+1] != '\t')) {
|
if (p[len+1] && (p[len+1] != ' ' && p[len+1] != '\t')) {
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_("%s: command arguments not separated by whitespace\n"),
|
_("%s: command arguments not separated by whitespace\n"),
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
pcmd.status = -1;
|
pcmd.status = -1;
|
||||||
return pcmd;
|
return pcmd;
|
||||||
}
|
}
|
||||||
@@ -894,7 +895,7 @@ parse_command_line (char *buf, int *exit_on_error_rtn)
|
|||||||
pend = &p[len];
|
pend = &p[len];
|
||||||
} else {
|
} else {
|
||||||
fprintf (stderr, _("%s: internal error parsing string at '%s'\n"),
|
fprintf (stderr, _("%s: internal error parsing string at '%s'\n"),
|
||||||
guestfs_int_program_name, p);
|
getprogname (), p);
|
||||||
abort ();
|
abort ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -910,7 +911,7 @@ parse_command_line (char *buf, int *exit_on_error_rtn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (i == argv_len) {
|
if (i == argv_len) {
|
||||||
fprintf (stderr, _("%s: too many arguments\n"), guestfs_int_program_name);
|
fprintf (stderr, _("%s: too many arguments\n"), getprogname ());
|
||||||
pcmd.status = -1;
|
pcmd.status = -1;
|
||||||
return pcmd;
|
return pcmd;
|
||||||
}
|
}
|
||||||
@@ -987,7 +988,7 @@ parse_quoted_string (char *p)
|
|||||||
default:
|
default:
|
||||||
error:
|
error:
|
||||||
fprintf (stderr, _("%s: invalid escape sequence in string (starting at offset %d)\n"),
|
fprintf (stderr, _("%s: invalid escape sequence in string (starting at offset %d)\n"),
|
||||||
guestfs_int_program_name, (int) (p - start));
|
getprogname (), (int) (p - start));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
memmove (p+1, p+1+m, strlen (p+1+m) + 1);
|
memmove (p+1, p+1+m, strlen (p+1+m) + 1);
|
||||||
@@ -995,7 +996,7 @@ parse_quoted_string (char *p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!*p) {
|
if (!*p) {
|
||||||
fprintf (stderr, _("%s: unterminated double quote\n"), guestfs_int_program_name);
|
fprintf (stderr, _("%s: unterminated double quote\n"), getprogname ());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1190,7 +1191,7 @@ issue_command (const char *cmd, char *argv[], const char *pipecmd,
|
|||||||
}
|
}
|
||||||
if (ferror (stdout)) {
|
if (ferror (stdout)) {
|
||||||
if (!pipecmd || pipe_error) {
|
if (!pipecmd || pipe_error) {
|
||||||
fprintf (stderr, "%s: write error%s\n", guestfs_int_program_name,
|
fprintf (stderr, "%s: write error%s\n", getprogname (),
|
||||||
pipecmd ? " on pipe" : "");
|
pipecmd ? " on pipe" : "");
|
||||||
r = -1;
|
r = -1;
|
||||||
}
|
}
|
||||||
@@ -1736,13 +1737,13 @@ win_prefix_drive_letter (char drive_letter, const char *path)
|
|||||||
return NULL;
|
return NULL;
|
||||||
if (roots[0] == NULL) {
|
if (roots[0] == NULL) {
|
||||||
fprintf (stderr, _("%s: to use Windows drive letters, you must inspect the guest (\"-i\" option or run \"inspect-os\" command)\n"),
|
fprintf (stderr, _("%s: to use Windows drive letters, you must inspect the guest (\"-i\" option or run \"inspect-os\" command)\n"),
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
drives = guestfs_inspect_get_drive_mappings (g, roots[0]);
|
drives = guestfs_inspect_get_drive_mappings (g, roots[0]);
|
||||||
if (drives == NULL || drives[0] == NULL) {
|
if (drives == NULL || drives[0] == NULL) {
|
||||||
fprintf (stderr, _("%s: to use Windows drive letters, this must be a Windows guest\n"),
|
fprintf (stderr, _("%s: to use Windows drive letters, this must be a Windows guest\n"),
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1756,7 +1757,7 @@ win_prefix_drive_letter (char drive_letter, const char *path)
|
|||||||
|
|
||||||
if (device == NULL) {
|
if (device == NULL) {
|
||||||
fprintf (stderr, _("%s: drive '%c:' not found. To list available drives do:\n inspect-get-drive-mappings %s\n"),
|
fprintf (stderr, _("%s: drive '%c:' not found. To list available drives do:\n inspect-get-drive-mappings %s\n"),
|
||||||
guestfs_int_program_name, drive_letter, roots[0]);
|
getprogname (), drive_letter, roots[0]);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1775,7 +1776,7 @@ win_prefix_drive_letter (char drive_letter, const char *path)
|
|||||||
|
|
||||||
if (mountpoint == NULL) {
|
if (mountpoint == NULL) {
|
||||||
fprintf (stderr, _("%s: to access '%c:', mount %s first. One way to do this is:\n umount-all\n mount %s /\n"),
|
fprintf (stderr, _("%s: to access '%c:', mount %s first. One way to do this is:\n umount-all\n mount %s /\n"),
|
||||||
guestfs_int_program_name, drive_letter, device, device);
|
getprogname (), drive_letter, device, device);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1814,7 +1815,7 @@ file_in (const char *arg)
|
|||||||
const char *endmarker = &arg[3];
|
const char *endmarker = &arg[3];
|
||||||
if (*endmarker == '\0') {
|
if (*endmarker == '\0') {
|
||||||
fprintf (stderr, "%s: missing end marker in -<< expression\n",
|
fprintf (stderr, "%s: missing end marker in -<< expression\n",
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
ret = file_in_heredoc (endmarker);
|
ret = file_in_heredoc (endmarker);
|
||||||
@@ -1885,7 +1886,7 @@ file_in_heredoc (const char *endmarker)
|
|||||||
* is likely to be an error.
|
* is likely to be an error.
|
||||||
*/
|
*/
|
||||||
fprintf (stderr, "%s: end of input reached without finding '%s'\n",
|
fprintf (stderr, "%s: end of input reached without finding '%s'\n",
|
||||||
guestfs_int_program_name, endmarker);
|
getprogname (), endmarker);
|
||||||
goto error2;
|
goto error2;
|
||||||
|
|
||||||
found_end:
|
found_end:
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
#include <libintl.h>
|
#include <libintl.h>
|
||||||
|
|
||||||
#include "c-ctype.h"
|
#include "c-ctype.h"
|
||||||
|
#include "getprogname.h"
|
||||||
|
|
||||||
#include "guestfs.h"
|
#include "guestfs.h"
|
||||||
|
|
||||||
@@ -93,7 +94,7 @@ inspect_mount_handle (guestfs_h *g)
|
|||||||
"If using other virt tools, this disk image won't work\n"
|
"If using other virt tools, this disk image won't work\n"
|
||||||
"with these tools. Use the guestfish equivalent commands\n"
|
"with these tools. Use the guestfish equivalent commands\n"
|
||||||
"(see the virt tool manual page).\n"),
|
"(see the virt tool manual page).\n"),
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
guestfs_int_free_string_list (roots);
|
guestfs_int_free_string_list (roots);
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
@@ -114,7 +115,7 @@ inspect_mount_handle (guestfs_h *g)
|
|||||||
"If using other virt tools, multi-boot operating systems won't work\n"
|
"If using other virt tools, multi-boot operating systems won't work\n"
|
||||||
"with these tools. Use the guestfish equivalent commands\n"
|
"with these tools. Use the guestfish equivalent commands\n"
|
||||||
"(see the virt tool manual page).\n"),
|
"(see the virt tool manual page).\n"),
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
guestfs_int_free_string_list (roots);
|
guestfs_int_free_string_list (roots);
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
@@ -163,7 +164,7 @@ inspect_mount_root (guestfs_h *g, const char *root)
|
|||||||
|
|
||||||
if (mount_errors)
|
if (mount_errors)
|
||||||
fprintf (stderr, _("%s: some filesystems could not be mounted (ignored)\n"),
|
fprintf (stderr, _("%s: some filesystems could not be mounted (ignored)\n"),
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -39,6 +39,8 @@
|
|||||||
#include <error.h>
|
#include <error.h>
|
||||||
#include <libintl.h>
|
#include <libintl.h>
|
||||||
|
|
||||||
|
#include "getprogname.h"
|
||||||
|
|
||||||
#include "guestfs.h"
|
#include "guestfs.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "uri.h"
|
#include "uri.h"
|
||||||
@@ -276,15 +278,15 @@ display_mountpoints_on_failure (const char *mp_device,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
fprintf (stderr, _("%s: '%s' could not be mounted.\n"),
|
fprintf (stderr, _("%s: '%s' could not be mounted.\n"),
|
||||||
guestfs_int_program_name, mp_device);
|
getprogname (), mp_device);
|
||||||
|
|
||||||
if (user_supplied_options)
|
if (user_supplied_options)
|
||||||
fprintf (stderr, _("%s: Check mount(8) man page to ensure options '%s'\n"
|
fprintf (stderr, _("%s: Check mount(8) man page to ensure options '%s'\n"
|
||||||
"%s: are supported by the filesystem that is being mounted.\n"),
|
"%s: are supported by the filesystem that is being mounted.\n"),
|
||||||
guestfs_int_program_name, user_supplied_options, guestfs_int_program_name);
|
getprogname (), user_supplied_options, getprogname ());
|
||||||
|
|
||||||
fprintf (stderr, _("%s: Did you mean to mount one of these filesystems?\n"),
|
fprintf (stderr, _("%s: Did you mean to mount one of these filesystems?\n"),
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
|
|
||||||
for (i = 0; fses[i] != NULL; i += 2) {
|
for (i = 0; fses[i] != NULL; i += 2) {
|
||||||
CLEANUP_FREE char *p = NULL;
|
CLEANUP_FREE char *p = NULL;
|
||||||
@@ -309,7 +311,7 @@ display_mountpoints_on_failure (const char *mp_device,
|
|||||||
p = guestfs_canonical_device_name (g, fses[i]);
|
p = guestfs_canonical_device_name (g, fses[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf (stderr, "%s: \t%s (%s)\n", guestfs_int_program_name,
|
fprintf (stderr, "%s: \t%s (%s)\n", getprogname (),
|
||||||
p ? p : fses[i], fses[i+1]);
|
p ? p : fses[i], fses[i+1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ extern void free_mps (struct mp *mp);
|
|||||||
#define OPTION_V \
|
#define OPTION_V \
|
||||||
{ \
|
{ \
|
||||||
printf ("%s %s\n", \
|
printf ("%s %s\n", \
|
||||||
guestfs_int_program_name, \
|
getprogname (), \
|
||||||
PACKAGE_VERSION_FULL); \
|
PACKAGE_VERSION_FULL); \
|
||||||
exit (EXIT_SUCCESS); \
|
exit (EXIT_SUCCESS); \
|
||||||
}
|
}
|
||||||
@@ -223,7 +223,7 @@ extern void free_mps (struct mp *mp);
|
|||||||
#define OPTION_w \
|
#define OPTION_w \
|
||||||
if (read_only) { \
|
if (read_only) { \
|
||||||
fprintf (stderr, _("%s: cannot mix --ro and --rw options\n"), \
|
fprintf (stderr, _("%s: cannot mix --ro and --rw options\n"), \
|
||||||
guestfs_int_program_name); \
|
getprogname ()); \
|
||||||
exit (EXIT_FAILURE); \
|
exit (EXIT_FAILURE); \
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -235,7 +235,7 @@ extern void free_mps (struct mp *mp);
|
|||||||
if (!format_consumed) { \
|
if (!format_consumed) { \
|
||||||
fprintf (stderr, \
|
fprintf (stderr, \
|
||||||
_("%s: --format parameter must appear before -a parameter\n"), \
|
_("%s: --format parameter must appear before -a parameter\n"), \
|
||||||
guestfs_int_program_name); \
|
getprogname ()); \
|
||||||
exit (EXIT_FAILURE); \
|
exit (EXIT_FAILURE); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
#include <libxml/uri.h>
|
#include <libxml/uri.h>
|
||||||
|
|
||||||
#include "c-ctype.h"
|
#include "c-ctype.h"
|
||||||
|
#include "getprogname.h"
|
||||||
|
|
||||||
#include "guestfs.h"
|
#include "guestfs.h"
|
||||||
#include "guestfs-internal-frontend.h"
|
#include "guestfs-internal-frontend.h"
|
||||||
@@ -116,7 +117,7 @@ parse (const char *arg, char **path_ret, char **protocol_ret,
|
|||||||
uri = xmlParseURI (arg);
|
uri = xmlParseURI (arg);
|
||||||
if (!uri) {
|
if (!uri) {
|
||||||
fprintf (stderr, _("%s: --add: could not parse URI '%s'\n"),
|
fprintf (stderr, _("%s: --add: could not parse URI '%s'\n"),
|
||||||
guestfs_int_program_name, arg);
|
getprogname (), arg);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,7 +128,7 @@ parse (const char *arg, char **path_ret, char **protocol_ret,
|
|||||||
if (uri->scheme == NULL || STREQ (uri->scheme, "")) {
|
if (uri->scheme == NULL || STREQ (uri->scheme, "")) {
|
||||||
/* Probably can never happen. */
|
/* Probably can never happen. */
|
||||||
fprintf (stderr, _("%s: %s: scheme of URI is NULL or empty\n"),
|
fprintf (stderr, _("%s: %s: scheme of URI is NULL or empty\n"),
|
||||||
guestfs_int_program_name, arg);
|
getprogname (), arg);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,14 +136,14 @@ parse (const char *arg, char **path_ret, char **protocol_ret,
|
|||||||
|
|
||||||
if (uri->server && STRNEQ (uri->server, "") && socket) {
|
if (uri->server && STRNEQ (uri->server, "") && socket) {
|
||||||
fprintf (stderr, _("%s: %s: cannot both a server name and a socket query parameter\n"),
|
fprintf (stderr, _("%s: %s: cannot both a server name and a socket query parameter\n"),
|
||||||
guestfs_int_program_name, arg);
|
getprogname (), arg);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Is this needed? XXX
|
/* Is this needed? XXX
|
||||||
if (socket && socket[0] != '/') {
|
if (socket && socket[0] != '/') {
|
||||||
fprintf (stderr, _("%s: --add %s: socket query parameter must be an absolute path\n"),
|
fprintf (stderr, _("%s: --add %s: socket query parameter must be an absolute path\n"),
|
||||||
guestfs_int_program_name, arg);
|
getprogname (), arg);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -31,6 +31,8 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <libintl.h>
|
#include <libintl.h>
|
||||||
|
|
||||||
|
#include "getprogname.h"
|
||||||
|
|
||||||
#include "guestfs.h"
|
#include "guestfs.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "display-options.h"
|
#include "display-options.h"
|
||||||
@@ -65,7 +67,7 @@ usage (int status)
|
|||||||
|
|
||||||
if (status != EXIT_SUCCESS)
|
if (status != EXIT_SUCCESS)
|
||||||
fprintf (stderr, _("Try `%s --help' for more information.\n%s\n"),
|
fprintf (stderr, _("Try `%s --help' for more information.\n%s\n"),
|
||||||
guestfs_int_program_name, warning);
|
getprogname (), warning);
|
||||||
else {
|
else {
|
||||||
printf (_("%s: erase and make a blank disk\n"
|
printf (_("%s: erase and make a blank disk\n"
|
||||||
"Copyright (C) 2012 Red Hat Inc.\n"
|
"Copyright (C) 2012 Red Hat Inc.\n"
|
||||||
@@ -89,8 +91,8 @@ usage (int status)
|
|||||||
"For more information, see the manpage %s(1).\n"
|
"For more information, see the manpage %s(1).\n"
|
||||||
"\n"
|
"\n"
|
||||||
"%s\n\n"),
|
"%s\n\n"),
|
||||||
guestfs_int_program_name, warning,
|
getprogname (), warning,
|
||||||
guestfs_int_program_name, guestfs_int_program_name,
|
getprogname (), getprogname (),
|
||||||
warning);
|
warning);
|
||||||
}
|
}
|
||||||
exit (status);
|
exit (status);
|
||||||
@@ -224,7 +226,7 @@ main (int argc, char *argv[])
|
|||||||
fprintf (stderr, _("%s: error: extra argument '%s' on command line.\n"
|
fprintf (stderr, _("%s: error: extra argument '%s' on command line.\n"
|
||||||
"Make sure to specify the argument for --format, --lvm "
|
"Make sure to specify the argument for --format, --lvm "
|
||||||
"or --partition like '--format=%s'.\n"),
|
"or --partition like '--format=%s'.\n"),
|
||||||
guestfs_int_program_name, argv[optind], argv[optind]);
|
getprogname (), argv[optind], argv[optind]);
|
||||||
usage (EXIT_FAILURE);
|
usage (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -233,7 +235,7 @@ main (int argc, char *argv[])
|
|||||||
/* The user didn't specify any drives to format. */
|
/* The user didn't specify any drives to format. */
|
||||||
if (drvs == NULL) {
|
if (drvs == NULL) {
|
||||||
fprintf (stderr, _("%s: error: you must specify at least one -a option.\n"),
|
fprintf (stderr, _("%s: error: you must specify at least one -a option.\n"),
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
usage (EXIT_FAILURE);
|
usage (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,7 @@
|
|||||||
#include "guestfs.h"
|
#include "guestfs.h"
|
||||||
|
|
||||||
#include "ignore-value.h"
|
#include "ignore-value.h"
|
||||||
|
#include "getprogname.h"
|
||||||
|
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "display-options.h"
|
#include "display-options.h"
|
||||||
@@ -88,7 +89,7 @@ static void __attribute__((noreturn))
|
|||||||
fuse_help (void)
|
fuse_help (void)
|
||||||
{
|
{
|
||||||
static struct fuse_operations null_operations;
|
static struct fuse_operations null_operations;
|
||||||
const char *tmp_argv[] = { guestfs_int_program_name, "--help", NULL };
|
const char *tmp_argv[] = { getprogname (), "--help", NULL };
|
||||||
fuse_main (2, (char **) tmp_argv, &null_operations, NULL);
|
fuse_main (2, (char **) tmp_argv, &null_operations, NULL);
|
||||||
exit (EXIT_SUCCESS);
|
exit (EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
@@ -98,7 +99,7 @@ usage (int status)
|
|||||||
{
|
{
|
||||||
if (status != EXIT_SUCCESS)
|
if (status != EXIT_SUCCESS)
|
||||||
fprintf (stderr, _("Try `%s --help' for more information.\n"),
|
fprintf (stderr, _("Try `%s --help' for more information.\n"),
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
else {
|
else {
|
||||||
printf (_("%s: FUSE module for libguestfs\n"
|
printf (_("%s: FUSE module for libguestfs\n"
|
||||||
"%s lets you mount a virtual machine filesystem\n"
|
"%s lets you mount a virtual machine filesystem\n"
|
||||||
@@ -130,8 +131,8 @@ usage (int status)
|
|||||||
" -w|--rw Mount read-write\n"
|
" -w|--rw Mount read-write\n"
|
||||||
" -x|--trace Trace guestfs API calls\n"
|
" -x|--trace Trace guestfs API calls\n"
|
||||||
),
|
),
|
||||||
guestfs_int_program_name, guestfs_int_program_name,
|
getprogname (), getprogname (),
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
}
|
}
|
||||||
exit (status);
|
exit (status);
|
||||||
}
|
}
|
||||||
@@ -313,12 +314,12 @@ main (int argc, char *argv[])
|
|||||||
if (!live) {
|
if (!live) {
|
||||||
if (drvs == NULL) {
|
if (drvs == NULL) {
|
||||||
fprintf (stderr, _("%s: error: you must specify at least one -a or -d option.\n"),
|
fprintf (stderr, _("%s: error: you must specify at least one -a or -d option.\n"),
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
usage (EXIT_FAILURE);
|
usage (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
if (!(mps || inspector)) {
|
if (!(mps || inspector)) {
|
||||||
fprintf (stderr, _("%s: error: you must specify either -i at least one -m option.\n"),
|
fprintf (stderr, _("%s: error: you must specify either -i at least one -m option.\n"),
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
usage (EXIT_FAILURE);
|
usage (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
#include "guestfs-internal-frontend.h"
|
#include "guestfs-internal-frontend.h"
|
||||||
|
|
||||||
#include "ignore-value.h"
|
#include "ignore-value.h"
|
||||||
|
#include "getprogname.h"
|
||||||
|
|
||||||
#include "display-options.h"
|
#include "display-options.h"
|
||||||
|
|
||||||
@@ -53,7 +54,7 @@ usage (int status)
|
|||||||
{
|
{
|
||||||
if (status != EXIT_SUCCESS)
|
if (status != EXIT_SUCCESS)
|
||||||
fprintf (stderr, _("Try `%s --help' for more information.\n"),
|
fprintf (stderr, _("Try `%s --help' for more information.\n"),
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
else {
|
else {
|
||||||
printf (_("%s: clean up a mounted filesystem\n"
|
printf (_("%s: clean up a mounted filesystem\n"
|
||||||
"Copyright (C) 2013 Red Hat Inc.\n"
|
"Copyright (C) 2013 Red Hat Inc.\n"
|
||||||
@@ -68,7 +69,7 @@ usage (int status)
|
|||||||
" -v|--verbose Verbose messages\n"
|
" -v|--verbose Verbose messages\n"
|
||||||
" -V|--version Display version and exit\n"
|
" -V|--version Display version and exit\n"
|
||||||
),
|
),
|
||||||
guestfs_int_program_name, guestfs_int_program_name);
|
getprogname (), getprogname ());
|
||||||
}
|
}
|
||||||
exit (status);
|
exit (status);
|
||||||
}
|
}
|
||||||
@@ -204,7 +205,7 @@ main (int argc, char *argv[])
|
|||||||
/* fusermount failed after N retries */
|
/* fusermount failed after N retries */
|
||||||
if (!quiet) {
|
if (!quiet) {
|
||||||
fprintf (stderr, _("%s: failed to unmount %s: %s\n"),
|
fprintf (stderr, _("%s: failed to unmount %s: %s\n"),
|
||||||
guestfs_int_program_name, mountpoint, error_str);
|
getprogname (), mountpoint, error_str);
|
||||||
do_fuser (mountpoint);
|
do_fuser (mountpoint);
|
||||||
}
|
}
|
||||||
free (error_str);
|
free (error_str);
|
||||||
@@ -215,7 +216,7 @@ main (int argc, char *argv[])
|
|||||||
not_mounted:
|
not_mounted:
|
||||||
if (!quiet)
|
if (!quiet)
|
||||||
fprintf (stderr, _("%s: %s is not mounted: %s\n"),
|
fprintf (stderr, _("%s: %s is not mounted: %s\n"),
|
||||||
guestfs_int_program_name, mountpoint, error_str);
|
getprogname (), mountpoint, error_str);
|
||||||
|
|
||||||
free (error_str);
|
free (error_str);
|
||||||
|
|
||||||
@@ -240,7 +241,7 @@ do_fusermount (const char *mountpoint, char **error_rtn)
|
|||||||
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
fprintf (stderr, "%s: running: fusermount -u %s\n",
|
fprintf (stderr, "%s: running: fusermount -u %s\n",
|
||||||
guestfs_int_program_name, mountpoint);
|
getprogname (), mountpoint);
|
||||||
|
|
||||||
pid = fork ();
|
pid = fork ();
|
||||||
if (pid == -1)
|
if (pid == -1)
|
||||||
@@ -315,7 +316,7 @@ do_fusermount (const char *mountpoint, char **error_rtn)
|
|||||||
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
fprintf (stderr, "%s: fusermount successful\n",
|
fprintf (stderr, "%s: fusermount successful\n",
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
|
|
||||||
free (buf);
|
free (buf);
|
||||||
return 0; /* fusermount successful */
|
return 0; /* fusermount successful */
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
|
||||||
#include "ignore-value.h"
|
#include "ignore-value.h"
|
||||||
|
#include "getprogname.h"
|
||||||
|
|
||||||
#include "guestfs.h"
|
#include "guestfs.h"
|
||||||
#include "guestfs-internal-frontend.h"
|
#include "guestfs-internal-frontend.h"
|
||||||
@@ -109,7 +110,7 @@ main (int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
if (r == 0) {
|
if (r == 0) {
|
||||||
fprintf (stderr, "%s: unexpected end of file on pipe fd.\n",
|
fprintf (stderr, "%s: unexpected end of file on pipe fd.\n",
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
ignore_value (rmdir (MOUNTPOINT));
|
ignore_value (rmdir (MOUNTPOINT));
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
@@ -117,7 +118,7 @@ main (int argc, char *argv[])
|
|||||||
/* Check that the test image was mounted. */
|
/* Check that the test image was mounted. */
|
||||||
if (access (TEST_FILE, R_OK) == -1) {
|
if (access (TEST_FILE, R_OK) == -1) {
|
||||||
fprintf (stderr, "%s: test failed because test image is not mounted and ready.",
|
fprintf (stderr, "%s: test failed because test image is not mounted and ready.",
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
ignore_value (rmdir (MOUNTPOINT));
|
ignore_value (rmdir (MOUNTPOINT));
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
@@ -127,7 +128,7 @@ main (int argc, char *argv[])
|
|||||||
if (r != 0) {
|
if (r != 0) {
|
||||||
char status_string[80];
|
char status_string[80];
|
||||||
|
|
||||||
fprintf (stderr, "%s: test failed: %s\n", guestfs_int_program_name,
|
fprintf (stderr, "%s: test failed: %s\n", getprogname (),
|
||||||
guestfs_int_exit_status_to_string (r, GUESTUNMOUNT_BINARY,
|
guestfs_int_exit_status_to_string (r, GUESTUNMOUNT_BINARY,
|
||||||
status_string,
|
status_string,
|
||||||
sizeof status_string));
|
sizeof status_string));
|
||||||
@@ -148,7 +149,7 @@ main (int argc, char *argv[])
|
|||||||
char status_string[80];
|
char status_string[80];
|
||||||
|
|
||||||
fprintf (stderr, "%s: test failed: %s\n",
|
fprintf (stderr, "%s: test failed: %s\n",
|
||||||
guestfs_int_program_name,
|
getprogname (),
|
||||||
guestfs_int_exit_status_to_string (status, GUESTMOUNT_BINARY,
|
guestfs_int_exit_status_to_string (status, GUESTMOUNT_BINARY,
|
||||||
status_string,
|
status_string,
|
||||||
sizeof status_string));
|
sizeof status_string));
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ let generate_fish_run_cmds actions () =
|
|||||||
pr "\n";
|
pr "\n";
|
||||||
pr "#include \"full-write.h\"\n";
|
pr "#include \"full-write.h\"\n";
|
||||||
pr "#include \"xstrtol.h\"\n";
|
pr "#include \"xstrtol.h\"\n";
|
||||||
|
pr "#include \"getprogname.h\"\n";
|
||||||
pr "\n";
|
pr "\n";
|
||||||
pr "#include \"guestfs.h\"\n";
|
pr "#include \"guestfs.h\"\n";
|
||||||
pr "#include \"guestfs-internal-frontend.h\"\n";
|
pr "#include \"guestfs-internal-frontend.h\"\n";
|
||||||
@@ -287,7 +288,7 @@ let generate_fish_run_cmds actions () =
|
|||||||
pr " case -1:\n";
|
pr " case -1:\n";
|
||||||
pr " fprintf (stderr,\n";
|
pr " fprintf (stderr,\n";
|
||||||
pr " _(\"%%s: '%%s': invalid boolean value, use 'true' or 'false'\\n\"),\n";
|
pr " _(\"%%s: '%%s': invalid boolean value, use 'true' or 'false'\\n\"),\n";
|
||||||
pr " guestfs_int_program_name, argv[i-1]);\n";
|
pr " getprogname (), argv[i-1]);\n";
|
||||||
pr " goto out_%s;\n" name;
|
pr " goto out_%s;\n" name;
|
||||||
pr " case 0: %s = 0; break;\n" name;
|
pr " case 0: %s = 0; break;\n" name;
|
||||||
pr " default: %s = 1;\n" name;
|
pr " default: %s = 1;\n" name;
|
||||||
@@ -330,7 +331,7 @@ let generate_fish_run_cmds actions () =
|
|||||||
pr " case -1:\n";
|
pr " case -1:\n";
|
||||||
pr " fprintf (stderr,\n";
|
pr " fprintf (stderr,\n";
|
||||||
pr " _(\"%%s: '%%s': invalid boolean value, use 'true' or 'false'\\n\"),\n";
|
pr " _(\"%%s: '%%s': invalid boolean value, use 'true' or 'false'\\n\"),\n";
|
||||||
pr " guestfs_int_program_name, &argv[i][%d]);\n" (len+1);
|
pr " getprogname (), &argv[i][%d]);\n" (len+1);
|
||||||
pr " goto out;\n";
|
pr " goto out;\n";
|
||||||
pr " case 0: optargs_s.%s = 0; break;\n" n;
|
pr " case 0: optargs_s.%s = 0; break;\n" n;
|
||||||
pr " default: optargs_s.%s = 1;\n" n;
|
pr " default: optargs_s.%s = 1;\n" n;
|
||||||
|
|||||||
@@ -37,6 +37,8 @@
|
|||||||
#include <libxml/tree.h>
|
#include <libxml/tree.h>
|
||||||
#include <libxml/xmlsave.h>
|
#include <libxml/xmlsave.h>
|
||||||
|
|
||||||
|
#include "getprogname.h"
|
||||||
|
|
||||||
#include "guestfs.h"
|
#include "guestfs.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "display-options.h"
|
#include "display-options.h"
|
||||||
@@ -69,7 +71,7 @@ usage (int status)
|
|||||||
{
|
{
|
||||||
if (status != EXIT_SUCCESS)
|
if (status != EXIT_SUCCESS)
|
||||||
fprintf (stderr, _("Try `%s --help' for more information.\n"),
|
fprintf (stderr, _("Try `%s --help' for more information.\n"),
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
else {
|
else {
|
||||||
printf (_("%s: display information about a virtual machine\n"
|
printf (_("%s: display information about a virtual machine\n"
|
||||||
"Copyright (C) 2010 Red Hat Inc.\n"
|
"Copyright (C) 2010 Red Hat Inc.\n"
|
||||||
@@ -91,8 +93,8 @@ usage (int status)
|
|||||||
" -x Trace libguestfs API calls\n"
|
" -x Trace libguestfs API calls\n"
|
||||||
" --xpath query Perform an XPath query\n"
|
" --xpath query Perform an XPath query\n"
|
||||||
"For more information, see the manpage %s(1).\n"),
|
"For more information, see the manpage %s(1).\n"),
|
||||||
guestfs_int_program_name, guestfs_int_program_name,
|
getprogname (), getprogname (),
|
||||||
guestfs_int_program_name, guestfs_int_program_name);
|
getprogname (), getprogname ());
|
||||||
}
|
}
|
||||||
exit (status);
|
exit (status);
|
||||||
}
|
}
|
||||||
@@ -238,7 +240,7 @@ main (int argc, char *argv[])
|
|||||||
fprintf (stderr, _("%s: error: extra argument '%s' on command line.\n"
|
fprintf (stderr, _("%s: error: extra argument '%s' on command line.\n"
|
||||||
"Make sure to specify the argument for --format "
|
"Make sure to specify the argument for --format "
|
||||||
"like '--format=%s'.\n"),
|
"like '--format=%s'.\n"),
|
||||||
guestfs_int_program_name, argv[optind], argv[optind]);
|
getprogname (), argv[optind], argv[optind]);
|
||||||
usage (EXIT_FAILURE);
|
usage (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -260,7 +262,7 @@ main (int argc, char *argv[])
|
|||||||
/* User must have specified some drives. */
|
/* User must have specified some drives. */
|
||||||
if (drvs == NULL) {
|
if (drvs == NULL) {
|
||||||
fprintf (stderr, _("%s: error: you must specify at least one -a or -d option.\n"),
|
fprintf (stderr, _("%s: error: you must specify at least one -a or -d option.\n"),
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
usage (EXIT_FAILURE);
|
usage (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
1
m4/.gitignore
vendored
1
m4/.gitignore
vendored
@@ -77,6 +77,7 @@
|
|||||||
/getlogin_r.m4
|
/getlogin_r.m4
|
||||||
/getopt.m4
|
/getopt.m4
|
||||||
/getpagesize.m4
|
/getpagesize.m4
|
||||||
|
/getprogname.m4
|
||||||
/gettime.m4
|
/gettime.m4
|
||||||
/gettimeofday.m4
|
/gettimeofday.m4
|
||||||
/getugroups.m4
|
/getugroups.m4
|
||||||
|
|||||||
@@ -34,9 +34,6 @@ AC_CHECK_MEMBER([struct stat.st_ctim.tv_nsec],[
|
|||||||
dnl Define a C symbol for the host CPU architecture.
|
dnl Define a C symbol for the host CPU architecture.
|
||||||
AC_DEFINE_UNQUOTED([host_cpu],["$host_cpu"],[Host architecture.])
|
AC_DEFINE_UNQUOTED([host_cpu],["$host_cpu"],[Host architecture.])
|
||||||
|
|
||||||
dnl Check if libc has program_invocation_short_name.
|
|
||||||
AC_CHECK_DECLS([program_invocation_short_name], [], [], [#include <errno.h>])
|
|
||||||
|
|
||||||
dnl Headers.
|
dnl Headers.
|
||||||
AC_CHECK_HEADERS([\
|
AC_CHECK_HEADERS([\
|
||||||
attr/xattr.h \
|
attr/xattr.h \
|
||||||
@@ -63,7 +60,6 @@ AC_CHECK_FUNCS([\
|
|||||||
be32toh \
|
be32toh \
|
||||||
fsync \
|
fsync \
|
||||||
futimens \
|
futimens \
|
||||||
getprogname \
|
|
||||||
getxattr \
|
getxattr \
|
||||||
htonl \
|
htonl \
|
||||||
htons \
|
htons \
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
#include "guestfs-internal-frontend.h"
|
#include "guestfs-internal-frontend.h"
|
||||||
|
|
||||||
#include "xstrtol.h"
|
#include "xstrtol.h"
|
||||||
|
#include "getprogname.h"
|
||||||
|
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "display-options.h"
|
#include "display-options.h"
|
||||||
@@ -74,7 +75,7 @@ usage (int status)
|
|||||||
{
|
{
|
||||||
if (status != EXIT_SUCCESS)
|
if (status != EXIT_SUCCESS)
|
||||||
fprintf (stderr, _("Try `%s --help' for more information.\n"),
|
fprintf (stderr, _("Try `%s --help' for more information.\n"),
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
else {
|
else {
|
||||||
printf (_("%s: make a filesystem from a tar archive or files\n"
|
printf (_("%s: make a filesystem from a tar archive or files\n"
|
||||||
"Copyright (C) 2010-2016 Red Hat Inc.\n"
|
"Copyright (C) 2010-2016 Red Hat Inc.\n"
|
||||||
@@ -94,9 +95,9 @@ usage (int status)
|
|||||||
" -V|--version Display version and exit\n"
|
" -V|--version Display version and exit\n"
|
||||||
" -x Trace libguestfs API calls\n"
|
" -x Trace libguestfs API calls\n"
|
||||||
"For more information, see the manpage %s(1).\n"),
|
"For more information, see the manpage %s(1).\n"),
|
||||||
guestfs_int_program_name, guestfs_int_program_name,
|
getprogname (), getprogname (),
|
||||||
guestfs_int_program_name, guestfs_int_program_name,
|
getprogname (), getprogname (),
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
}
|
}
|
||||||
exit (status);
|
exit (status);
|
||||||
}
|
}
|
||||||
@@ -183,7 +184,7 @@ main (int argc, char *argv[])
|
|||||||
if (optind + 2 != argc) {
|
if (optind + 2 != argc) {
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_("%s: missing input and output arguments on the command line\n"),
|
_("%s: missing input and output arguments on the command line\n"),
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
usage (EXIT_FAILURE);
|
usage (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,7 +203,7 @@ check_ntfs_available (void)
|
|||||||
guestfs_feature_available (g, (char **) ntfs_features) == 0) {
|
guestfs_feature_available (g, (char **) ntfs_features) == 0) {
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_("%s: NTFS support was disabled when libguestfs was compiled\n"),
|
_("%s: NTFS support was disabled when libguestfs was compiled\n"),
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,7 +253,7 @@ exec_command (char **argv, const char *file)
|
|||||||
}
|
}
|
||||||
if (!WIFEXITED (status) || WEXITSTATUS (status) != 0) {
|
if (!WIFEXITED (status) || WEXITSTATUS (status) != 0) {
|
||||||
fprintf (stderr, _("%s: %s command failed\n"),
|
fprintf (stderr, _("%s: %s command failed\n"),
|
||||||
guestfs_int_program_name, argv[0]);
|
getprogname (), argv[0]);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -316,7 +317,7 @@ exec_command_count_output (char **argv, uint64_t *bytes_rtn)
|
|||||||
}
|
}
|
||||||
if (!WIFEXITED (status) || WEXITSTATUS (status) != 0) {
|
if (!WIFEXITED (status) || WEXITSTATUS (status) != 0) {
|
||||||
fprintf (stderr, _("%s: %s command failed\n"),
|
fprintf (stderr, _("%s: %s command failed\n"),
|
||||||
guestfs_int_program_name, argv[0]);
|
getprogname (), argv[0]);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -441,7 +442,7 @@ estimate_input (const char *input, uint64_t *estimate_rtn, char **ifmt_rtn)
|
|||||||
|
|
||||||
if (sscanf (line, "%" SCNu64, estimate_rtn) != 1) {
|
if (sscanf (line, "%" SCNu64, estimate_rtn) != 1) {
|
||||||
fprintf (stderr, _("%s: cannot parse the output of 'du' command: %s\n"),
|
fprintf (stderr, _("%s: cannot parse the output of 'du' command: %s\n"),
|
||||||
guestfs_int_program_name, line);
|
getprogname (), line);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -476,7 +477,7 @@ estimate_input (const char *input, uint64_t *estimate_rtn, char **ifmt_rtn)
|
|||||||
|
|
||||||
if (strstr (line, "tar archive") == NULL) {
|
if (strstr (line, "tar archive") == NULL) {
|
||||||
fprintf (stderr, _("%s: %s: input is not a directory, tar archive or compressed tar archive\n"),
|
fprintf (stderr, _("%s: %s: input is not a directory, tar archive or compressed tar archive\n"),
|
||||||
guestfs_int_program_name, input);
|
getprogname (), input);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -507,7 +508,7 @@ estimate_input (const char *input, uint64_t *estimate_rtn, char **ifmt_rtn)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fprintf (stderr, _("%s: %s: unknown compressed input format (%s)\n"),
|
fprintf (stderr, _("%s: %s: unknown compressed input format (%s)\n"),
|
||||||
guestfs_int_program_name, input, line);
|
getprogname (), input, line);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -630,7 +631,7 @@ parse_size (const char *str, uint64_t estimate, uint64_t *size_rtn)
|
|||||||
if (xerr != LONGINT_OK) {
|
if (xerr != LONGINT_OK) {
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_("%s: %s: invalid size parameter '%s' (%s returned %u)\n"),
|
_("%s: %s: invalid size parameter '%s' (%s returned %u)\n"),
|
||||||
guestfs_int_program_name, "parse_size", str, "xstrtoull", xerr);
|
getprogname (), "parse_size", str, "xstrtoull", xerr);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -778,7 +779,7 @@ do_make_fs (const char *input, const char *output_str)
|
|||||||
if (r == -1) {
|
if (r == -1) {
|
||||||
/* Provide more guidance in the error message (RHBZ#823883). */
|
/* Provide more guidance in the error message (RHBZ#823883). */
|
||||||
fprintf (stderr, "%s: 'mkfs' (create filesystem) operation failed: %s\n",
|
fprintf (stderr, "%s: 'mkfs' (create filesystem) operation failed: %s\n",
|
||||||
guestfs_int_program_name, guestfs_last_error (g));
|
getprogname (), guestfs_last_error (g));
|
||||||
if (STREQ (type, "fat"))
|
if (STREQ (type, "fat"))
|
||||||
fprintf (stderr, "Instead of 'fat', try 'vfat' (long filenames) or 'msdos' (short filenames).\n");
|
fprintf (stderr, "Instead of 'fat', try 'vfat' (long filenames) or 'msdos' (short filenames).\n");
|
||||||
else
|
else
|
||||||
@@ -835,7 +836,7 @@ do_make_fs (const char *input, const char *output_str)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (!WIFEXITED (status) || WEXITSTATUS (status) != 0) {
|
if (!WIFEXITED (status) || WEXITSTATUS (status) != 0) {
|
||||||
fprintf (stderr, _("%s: subprocess failed\n"), guestfs_int_program_name);
|
fprintf (stderr, _("%s: subprocess failed\n"), getprogname ());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include "xstrtol.h"
|
#include "xstrtol.h"
|
||||||
|
#include "getprogname.h"
|
||||||
|
|
||||||
#include <caml/alloc.h>
|
#include <caml/alloc.h>
|
||||||
#include <caml/fail.h>
|
#include <caml/fail.h>
|
||||||
@@ -70,7 +71,7 @@ static void __attribute__((noreturn))
|
|||||||
show_error (int status)
|
show_error (int status)
|
||||||
{
|
{
|
||||||
fprintf (stderr, _("Try `%s --help' or consult %s(1) for more information.\n"),
|
fprintf (stderr, _("Try `%s --help' or consult %s(1) for more information.\n"),
|
||||||
guestfs_int_program_name, guestfs_int_program_name);
|
getprogname (), getprogname ());
|
||||||
exit (status);
|
exit (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,13 +190,13 @@ strtoint (const char *arg)
|
|||||||
|
|
||||||
if (xstrtol (arg, NULL, 0, &num, "") != LONGINT_OK) {
|
if (xstrtol (arg, NULL, 0, &num, "") != LONGINT_OK) {
|
||||||
fprintf (stderr, _("%s: '%s' is not a numeric value.\n"),
|
fprintf (stderr, _("%s: '%s' is not a numeric value.\n"),
|
||||||
guestfs_int_program_name, arg);
|
getprogname (), arg);
|
||||||
show_error (EXIT_FAILURE);
|
show_error (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (num < -(1<<30) || num > (1<<30)-1) {
|
if (num < -(1<<30) || num > (1<<30)-1) {
|
||||||
fprintf (stderr, _("%s: %s: integer out of range\n"),
|
fprintf (stderr, _("%s: %s: integer out of range\n"),
|
||||||
guestfs_int_program_name, arg);
|
getprogname (), arg);
|
||||||
show_error (EXIT_FAILURE);
|
show_error (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -375,10 +376,10 @@ guestfs_int_mllib_getopt_parse (value argsv, value specsv, value anon_funv, valu
|
|||||||
if (!list_mem (v, optarg)) {
|
if (!list_mem (v, optarg)) {
|
||||||
if (c != 0) {
|
if (c != 0) {
|
||||||
fprintf (stderr, _("%s: '%s' is not allowed for -%c; allowed values are:\n"),
|
fprintf (stderr, _("%s: '%s' is not allowed for -%c; allowed values are:\n"),
|
||||||
guestfs_int_program_name, optarg, c);
|
getprogname (), optarg, c);
|
||||||
} else {
|
} else {
|
||||||
fprintf (stderr, _("%s: '%s' is not allowed for %s%s; allowed values are:\n"),
|
fprintf (stderr, _("%s: '%s' is not allowed for %s%s; allowed values are:\n"),
|
||||||
guestfs_int_program_name, optarg,
|
getprogname (), optarg,
|
||||||
vector_has_dashdash_opt (specv, longopts[option_index].name) ? "--" : "-",
|
vector_has_dashdash_opt (specv, longopts[option_index].name) ? "--" : "-",
|
||||||
longopts[option_index].name);
|
longopts[option_index].name);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,6 +54,7 @@
|
|||||||
#include <libxml/xmlwriter.h>
|
#include <libxml/xmlwriter.h>
|
||||||
|
|
||||||
#include "ignore-value.h"
|
#include "ignore-value.h"
|
||||||
|
#include "getprogname.h"
|
||||||
|
|
||||||
#include "miniexpect.h"
|
#include "miniexpect.h"
|
||||||
#include "p2v.h"
|
#include "p2v.h"
|
||||||
@@ -268,7 +269,7 @@ start_conversion (struct config *config,
|
|||||||
#if DEBUG_STDERR
|
#if DEBUG_STDERR
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
"%s: data connection for %s: SSH remote port %d, local port %d\n",
|
"%s: data connection for %s: SSH remote port %d, local port %d\n",
|
||||||
guestfs_int_program_name, device,
|
getprogname (), device,
|
||||||
data_conns[i].nbd_remote_port, data_conns[i].nbd_local_port);
|
data_conns[i].nbd_remote_port, data_conns[i].nbd_local_port);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
11
p2v/gui.c
11
p2v/gui.c
@@ -76,6 +76,7 @@
|
|||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
#include "ignore-value.h"
|
#include "ignore-value.h"
|
||||||
|
#include "getprogname.h"
|
||||||
|
|
||||||
#include "p2v.h"
|
#include "p2v.h"
|
||||||
|
|
||||||
@@ -275,7 +276,7 @@ create_connection_dialog (struct config *config)
|
|||||||
char port_str[64];
|
char port_str[64];
|
||||||
|
|
||||||
conn_dlg = gtk_dialog_new ();
|
conn_dlg = gtk_dialog_new ();
|
||||||
gtk_window_set_title (GTK_WINDOW (conn_dlg), guestfs_int_program_name);
|
gtk_window_set_title (GTK_WINDOW (conn_dlg), getprogname ());
|
||||||
gtk_window_set_resizable (GTK_WINDOW (conn_dlg), FALSE);
|
gtk_window_set_resizable (GTK_WINDOW (conn_dlg), FALSE);
|
||||||
|
|
||||||
/* The main dialog area. */
|
/* The main dialog area. */
|
||||||
@@ -683,7 +684,7 @@ static void
|
|||||||
about_button_clicked (GtkWidget *w, gpointer data)
|
about_button_clicked (GtkWidget *w, gpointer data)
|
||||||
{
|
{
|
||||||
gtk_show_about_dialog (GTK_WINDOW (conn_dlg),
|
gtk_show_about_dialog (GTK_WINDOW (conn_dlg),
|
||||||
"program-name", guestfs_int_program_name,
|
"program-name", getprogname (),
|
||||||
"version", PACKAGE_VERSION_FULL " (" host_cpu ")",
|
"version", PACKAGE_VERSION_FULL " (" host_cpu ")",
|
||||||
"copyright", "\u00A9 2009-2016 Red Hat Inc.",
|
"copyright", "\u00A9 2009-2016 Red Hat Inc.",
|
||||||
"comments",
|
"comments",
|
||||||
@@ -766,7 +767,7 @@ create_conversion_dialog (struct config *config)
|
|||||||
char memory_str[64];
|
char memory_str[64];
|
||||||
|
|
||||||
conv_dlg = gtk_dialog_new ();
|
conv_dlg = gtk_dialog_new ();
|
||||||
gtk_window_set_title (GTK_WINDOW (conv_dlg), guestfs_int_program_name);
|
gtk_window_set_title (GTK_WINDOW (conv_dlg), getprogname ());
|
||||||
gtk_window_set_resizable (GTK_WINDOW (conv_dlg), FALSE);
|
gtk_window_set_resizable (GTK_WINDOW (conv_dlg), FALSE);
|
||||||
/* XXX It would be nice not to have to set this explicitly, but
|
/* XXX It would be nice not to have to set this explicitly, but
|
||||||
* if we don't then Gtk chooses a very small window.
|
* if we don't then Gtk chooses a very small window.
|
||||||
@@ -1639,7 +1640,7 @@ create_running_dialog (void)
|
|||||||
GtkTextBuffer *buf;
|
GtkTextBuffer *buf;
|
||||||
|
|
||||||
run_dlg = gtk_dialog_new ();
|
run_dlg = gtk_dialog_new ();
|
||||||
gtk_window_set_title (GTK_WINDOW (run_dlg), guestfs_int_program_name);
|
gtk_window_set_title (GTK_WINDOW (run_dlg), getprogname ());
|
||||||
gtk_window_set_resizable (GTK_WINDOW (run_dlg), FALSE);
|
gtk_window_set_resizable (GTK_WINDOW (run_dlg), FALSE);
|
||||||
|
|
||||||
/* The main dialog area. */
|
/* The main dialog area. */
|
||||||
@@ -2157,7 +2158,7 @@ notify_ui_callback (int type, const char *data)
|
|||||||
default:
|
default:
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
"%s: unknown message during conversion: type=%d data=%s\n",
|
"%s: unknown message during conversion: type=%d data=%s\n",
|
||||||
guestfs_int_program_name, type, data);
|
getprogname (), type, data);
|
||||||
free (copy);
|
free (copy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,8 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <error.h>
|
#include <error.h>
|
||||||
|
|
||||||
|
#include "getprogname.h"
|
||||||
|
|
||||||
#include "p2v.h"
|
#include "p2v.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -141,7 +143,7 @@ parse_cmdline_string (const char *cmdline)
|
|||||||
break;
|
break;
|
||||||
case VALUE_QUOTED: /* unterminated key="value" */
|
case VALUE_QUOTED: /* unterminated key="value" */
|
||||||
fprintf (stderr, "%s: warning: unterminated quoted string on kernel command line\n",
|
fprintf (stderr, "%s: warning: unterminated quoted string on kernel command line\n",
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
add_string (&ret, &len, value, p-value);
|
add_string (&ret, &len, value, p-value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
12
p2v/kernel.c
12
p2v/kernel.c
@@ -35,6 +35,8 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
|
||||||
|
#include "getprogname.h"
|
||||||
|
|
||||||
#include "p2v.h"
|
#include "p2v.h"
|
||||||
|
|
||||||
static void notify_ui_callback (int type, const char *data);
|
static void notify_ui_callback (int type, const char *data);
|
||||||
@@ -163,7 +165,7 @@ update_config_from_kernel_cmdline (struct config *config, char **cmdline)
|
|||||||
config->output_allocation = OUTPUT_ALLOCATION_PREALLOCATED;
|
config->output_allocation = OUTPUT_ALLOCATION_PREALLOCATED;
|
||||||
else
|
else
|
||||||
fprintf (stderr, "%s: warning: don't know what p2v.oa=%s means\n",
|
fprintf (stderr, "%s: warning: don't know what p2v.oa=%s means\n",
|
||||||
guestfs_int_program_name, p);
|
getprogname (), p);
|
||||||
}
|
}
|
||||||
|
|
||||||
p = get_cmdline_key (cmdline, "p2v.oc");
|
p = get_cmdline_key (cmdline, "p2v.oc");
|
||||||
@@ -230,7 +232,7 @@ kernel_conversion (struct config *config, char **cmdline, int cmdline_source)
|
|||||||
const char *err = get_conversion_error ();
|
const char *err = get_conversion_error ();
|
||||||
|
|
||||||
fprintf (stderr, "%s: error during conversion: %s\n",
|
fprintf (stderr, "%s: error during conversion: %s\n",
|
||||||
guestfs_int_program_name, err);
|
getprogname (), err);
|
||||||
|
|
||||||
p = get_cmdline_key (cmdline, "p2v.fail");
|
p = get_cmdline_key (cmdline, "p2v.fail");
|
||||||
if (p)
|
if (p)
|
||||||
@@ -259,7 +261,7 @@ notify_ui_callback (int type, const char *data)
|
|||||||
switch (type) {
|
switch (type) {
|
||||||
case NOTIFY_LOG_DIR:
|
case NOTIFY_LOG_DIR:
|
||||||
ansi_magenta (stdout);
|
ansi_magenta (stdout);
|
||||||
printf ("%s: remote log directory location: ", guestfs_int_program_name);
|
printf ("%s: remote log directory location: ", getprogname ());
|
||||||
ansi_red (stdout);
|
ansi_red (stdout);
|
||||||
fputs (data, stdout);
|
fputs (data, stdout);
|
||||||
ansi_restore (stdout);
|
ansi_restore (stdout);
|
||||||
@@ -272,7 +274,7 @@ notify_ui_callback (int type, const char *data)
|
|||||||
|
|
||||||
case NOTIFY_STATUS:
|
case NOTIFY_STATUS:
|
||||||
ansi_magenta (stdout);
|
ansi_magenta (stdout);
|
||||||
printf ("%s: %s", guestfs_int_program_name, data);
|
printf ("%s: %s", getprogname (), data);
|
||||||
ansi_restore (stdout);
|
ansi_restore (stdout);
|
||||||
putchar ('\n');
|
putchar ('\n');
|
||||||
break;
|
break;
|
||||||
@@ -280,7 +282,7 @@ notify_ui_callback (int type, const char *data)
|
|||||||
default:
|
default:
|
||||||
ansi_red (stdout);
|
ansi_red (stdout);
|
||||||
printf ("%s: unknown message during conversion: type=%d data=%s",
|
printf ("%s: unknown message during conversion: type=%d data=%s",
|
||||||
guestfs_int_program_name, type, data);
|
getprogname (), type, data);
|
||||||
ansi_restore (stdout);
|
ansi_restore (stdout);
|
||||||
putchar ('\n');
|
putchar ('\n');
|
||||||
}
|
}
|
||||||
|
|||||||
11
p2v/main.c
11
p2v/main.c
@@ -44,6 +44,7 @@
|
|||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
#include "ignore-value.h"
|
#include "ignore-value.h"
|
||||||
|
#include "getprogname.h"
|
||||||
#include "p2v.h"
|
#include "p2v.h"
|
||||||
|
|
||||||
char **all_disks;
|
char **all_disks;
|
||||||
@@ -84,7 +85,7 @@ usage (int status)
|
|||||||
{
|
{
|
||||||
if (status != EXIT_SUCCESS)
|
if (status != EXIT_SUCCESS)
|
||||||
fprintf (stderr, _("Try `%s --help' for more information.\n"),
|
fprintf (stderr, _("Try `%s --help' for more information.\n"),
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
else {
|
else {
|
||||||
printf (_("%s: Convert a physical machine to use KVM\n"
|
printf (_("%s: Convert a physical machine to use KVM\n"
|
||||||
"Copyright (C) 2009-2016 Red Hat Inc.\n"
|
"Copyright (C) 2009-2016 Red Hat Inc.\n"
|
||||||
@@ -99,8 +100,8 @@ usage (int status)
|
|||||||
" -v|--verbose Verbose messages\n"
|
" -v|--verbose Verbose messages\n"
|
||||||
" -V|--version Display version and exit\n"
|
" -V|--version Display version and exit\n"
|
||||||
"For more information, see the manpage %s(1).\n"),
|
"For more information, see the manpage %s(1).\n"),
|
||||||
guestfs_int_program_name, guestfs_int_program_name,
|
getprogname (), getprogname (),
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
}
|
}
|
||||||
exit (status);
|
exit (status);
|
||||||
}
|
}
|
||||||
@@ -198,7 +199,7 @@ main (int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'V':
|
case 'V':
|
||||||
printf ("%s %s\n", guestfs_int_program_name, PACKAGE_VERSION_FULL);
|
printf ("%s %s\n", getprogname (), PACKAGE_VERSION_FULL);
|
||||||
exit (EXIT_SUCCESS);
|
exit (EXIT_SUCCESS);
|
||||||
|
|
||||||
case HELP_OPTION:
|
case HELP_OPTION:
|
||||||
@@ -211,7 +212,7 @@ main (int argc, char *argv[])
|
|||||||
|
|
||||||
if (optind != argc) {
|
if (optind != argc) {
|
||||||
fprintf (stderr, _("%s: unused arguments on the command line\n"),
|
fprintf (stderr, _("%s: unused arguments on the command line\n"),
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
usage (EXIT_FAILURE);
|
usage (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,6 +54,7 @@
|
|||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
|
||||||
#include "ignore-value.h"
|
#include "ignore-value.h"
|
||||||
|
#include "getprogname.h"
|
||||||
|
|
||||||
#include "miniexpect.h"
|
#include "miniexpect.h"
|
||||||
#include "p2v.h"
|
#include "p2v.h"
|
||||||
@@ -140,7 +141,7 @@ compile_regexps (void)
|
|||||||
pcre_fullinfo ((re), NULL, PCRE_INFO_OKPARTIAL, &p); \
|
pcre_fullinfo ((re), NULL, PCRE_INFO_OKPARTIAL, &p); \
|
||||||
if (p != 1) { \
|
if (p != 1) { \
|
||||||
fprintf (stderr, "%s: %s:%d: internal error: pattern '%s' cannot be used for partial matching\n", \
|
fprintf (stderr, "%s: %s:%d: internal error: pattern '%s' cannot be used for partial matching\n", \
|
||||||
guestfs_int_program_name, \
|
getprogname (), \
|
||||||
__FILE__, __LINE__, (pattern)); \
|
__FILE__, __LINE__, (pattern)); \
|
||||||
abort (); \
|
abort (); \
|
||||||
} \
|
} \
|
||||||
@@ -778,7 +779,7 @@ test_connection (struct config *config)
|
|||||||
v2v_version = strndup (&h->buffer[ovector[2]], ovector[3]-ovector[2]);
|
v2v_version = strndup (&h->buffer[ovector[2]], ovector[3]-ovector[2]);
|
||||||
#if DEBUG_STDERR
|
#if DEBUG_STDERR
|
||||||
fprintf (stderr, "%s: remote virt-v2v version: %s\n",
|
fprintf (stderr, "%s: remote virt-v2v version: %s\n",
|
||||||
guestfs_int_program_name, v2v_version);
|
getprogname (), v2v_version);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -860,7 +861,7 @@ test_connection (struct config *config)
|
|||||||
case 101: /* virt-v2v supports --colours option */
|
case 101: /* virt-v2v supports --colours option */
|
||||||
#if DEBUG_STDERR
|
#if DEBUG_STDERR
|
||||||
fprintf (stderr, "%s: remote virt-v2v supports --colours option\n",
|
fprintf (stderr, "%s: remote virt-v2v supports --colours option\n",
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
#endif
|
#endif
|
||||||
feature_colours_option = 1;
|
feature_colours_option = 1;
|
||||||
break;
|
break;
|
||||||
@@ -974,7 +975,7 @@ add_option (const char *type, char ***drivers, const char *name, size_t len)
|
|||||||
|
|
||||||
#if DEBUG_STDERR
|
#if DEBUG_STDERR
|
||||||
fprintf (stderr, "%s: remote virt-v2v supports %s driver %s\n",
|
fprintf (stderr, "%s: remote virt-v2v supports %s driver %s\n",
|
||||||
guestfs_int_program_name, type, (*drivers)[n-1]);
|
getprogname (), type, (*drivers)[n-1]);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
#include "ignore-value.h"
|
#include "ignore-value.h"
|
||||||
#include "xvasprintf.h"
|
#include "xvasprintf.h"
|
||||||
|
#include "getprogname.h"
|
||||||
|
|
||||||
#include "guestfs.h"
|
#include "guestfs.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
@@ -56,7 +57,7 @@ usage (int status)
|
|||||||
{
|
{
|
||||||
if (status != EXIT_SUCCESS)
|
if (status != EXIT_SUCCESS)
|
||||||
fprintf (stderr, _("Try `%s --help' for more information.\n"),
|
fprintf (stderr, _("Try `%s --help' for more information.\n"),
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
else {
|
else {
|
||||||
printf (_("%s: Run a rescue shell on a virtual machine\n"
|
printf (_("%s: Run a rescue shell on a virtual machine\n"
|
||||||
"Copyright (C) 2009-2016 Red Hat Inc.\n"
|
"Copyright (C) 2009-2016 Red Hat Inc.\n"
|
||||||
@@ -82,8 +83,8 @@ usage (int status)
|
|||||||
" -w|--rw Mount read-write\n"
|
" -w|--rw Mount read-write\n"
|
||||||
" -x Trace libguestfs API calls\n"
|
" -x Trace libguestfs API calls\n"
|
||||||
"For more information, see the manpage %s(1).\n"),
|
"For more information, see the manpage %s(1).\n"),
|
||||||
guestfs_int_program_name, guestfs_int_program_name,
|
getprogname (), getprogname (),
|
||||||
guestfs_int_program_name, guestfs_int_program_name);
|
getprogname (), getprogname ());
|
||||||
}
|
}
|
||||||
exit (status);
|
exit (status);
|
||||||
}
|
}
|
||||||
@@ -279,7 +280,7 @@ main (int argc, char *argv[])
|
|||||||
fprintf (stderr, _("%s: error: extra argument '%s' on command line.\n"
|
fprintf (stderr, _("%s: error: extra argument '%s' on command line.\n"
|
||||||
"Make sure to specify the argument for --format or --scratch "
|
"Make sure to specify the argument for --format or --scratch "
|
||||||
"like '--format=%s'.\n"),
|
"like '--format=%s'.\n"),
|
||||||
guestfs_int_program_name, argv[optind], argv[optind]);
|
getprogname (), argv[optind], argv[optind]);
|
||||||
usage (EXIT_FAILURE);
|
usage (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -288,7 +289,7 @@ main (int argc, char *argv[])
|
|||||||
/* User must have specified some drives. */
|
/* User must have specified some drives. */
|
||||||
if (drvs == NULL) {
|
if (drvs == NULL) {
|
||||||
fprintf (stderr, _("%s: error: you must specify at least one -a or -d option.\n"),
|
fprintf (stderr, _("%s: error: you must specify at least one -a or -d option.\n"),
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
usage (EXIT_FAILURE);
|
usage (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -306,7 +307,7 @@ main (int argc, char *argv[])
|
|||||||
STRPREFIX (backend, "libvirt:")) {
|
STRPREFIX (backend, "libvirt:")) {
|
||||||
fprintf (stderr, _("%s: warning: virt-rescue doesn't work with the libvirt backend\n"
|
fprintf (stderr, _("%s: warning: virt-rescue doesn't work with the libvirt backend\n"
|
||||||
"at the moment. As a workaround, forcing backend = 'direct'.\n"),
|
"at the moment. As a workaround, forcing backend = 'direct'.\n"),
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
if (guestfs_set_backend (g, "direct") == -1)
|
if (guestfs_set_backend (g, "direct") == -1)
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,17 +129,6 @@ extern void guestfs_int_cleanup_pclose (void *ptr);
|
|||||||
*/
|
*/
|
||||||
#include "guestfs-internal-frontend-cleanups.h"
|
#include "guestfs-internal-frontend-cleanups.h"
|
||||||
|
|
||||||
/* Current program name. Note <errno.h> must be included in all files
|
|
||||||
* that want to use 'guestfs_int_program_name'.
|
|
||||||
*/
|
|
||||||
#if HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME == 1
|
|
||||||
# define guestfs_int_program_name program_invocation_short_name
|
|
||||||
#elif HAVE_GETPROGNAME
|
|
||||||
# define guestfs_int_program_name getprogname()
|
|
||||||
#else
|
|
||||||
# define guestfs_int_program_name "libguestfs"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Close all file descriptors matching the condition. */
|
/* Close all file descriptors matching the condition. */
|
||||||
#define close_file_descriptors(cond) do { \
|
#define close_file_descriptors(cond) do { \
|
||||||
int max_fd = sysconf (_SC_OPEN_MAX); \
|
int max_fd = sysconf (_SC_OPEN_MAX); \
|
||||||
|
|||||||
11
src/handle.c
11
src/handle.c
@@ -34,6 +34,7 @@
|
|||||||
#include "glthread/lock.h"
|
#include "glthread/lock.h"
|
||||||
#include "ignore-value.h"
|
#include "ignore-value.h"
|
||||||
#include "c-ctype.h"
|
#include "c-ctype.h"
|
||||||
|
#include "getprogname.h"
|
||||||
|
|
||||||
#include "guestfs.h"
|
#include "guestfs.h"
|
||||||
#include "guestfs-internal.h"
|
#include "guestfs-internal.h"
|
||||||
@@ -120,15 +121,11 @@ guestfs_create_flags (unsigned flags, ...)
|
|||||||
if (!g->hv) goto error;
|
if (!g->hv) goto error;
|
||||||
|
|
||||||
/* Get program name. */
|
/* Get program name. */
|
||||||
#if HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME == 1
|
if (STRPREFIX (getprogname (), "lt-"))
|
||||||
if (STRPREFIX (program_invocation_short_name, "lt-"))
|
|
||||||
/* Remove libtool (lt-*) prefix from short name. */
|
/* Remove libtool (lt-*) prefix from short name. */
|
||||||
g->program = strdup (program_invocation_short_name + 3);
|
g->program = strdup (getprogname () + 3);
|
||||||
else
|
else
|
||||||
g->program = strdup (program_invocation_short_name);
|
g->program = strdup (getprogname ());
|
||||||
#else
|
|
||||||
g->program = strdup ("");
|
|
||||||
#endif
|
|
||||||
if (!g->program) goto error;
|
if (!g->program) goto error;
|
||||||
|
|
||||||
g->identifier = strdup ("");
|
g->identifier = strdup ("");
|
||||||
|
|||||||
@@ -33,6 +33,8 @@
|
|||||||
#include "guestfs.h"
|
#include "guestfs.h"
|
||||||
#include "guestfs-internal-frontend.h"
|
#include "guestfs-internal-frontend.h"
|
||||||
|
|
||||||
|
#include "getprogname.h"
|
||||||
|
|
||||||
static const char ourenvvar[] = "SKIP_TEST_CHARSET_FIDELITY";
|
static const char ourenvvar[] = "SKIP_TEST_CHARSET_FIDELITY";
|
||||||
|
|
||||||
struct filesystem {
|
struct filesystem {
|
||||||
@@ -83,7 +85,7 @@ main (int argc, char *argv[])
|
|||||||
str = getenv (ourenvvar);
|
str = getenv (ourenvvar);
|
||||||
if (str && guestfs_int_is_true (str) > 0) {
|
if (str && guestfs_int_is_true (str) > 0) {
|
||||||
printf ("%s: test skipped because environment variable is set.\n",
|
printf ("%s: test skipped because environment variable is set.\n",
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
exit (77);
|
exit (77);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,7 @@
|
|||||||
#include "estimate-max-threads.h"
|
#include "estimate-max-threads.h"
|
||||||
|
|
||||||
#include "ignore-value.h"
|
#include "ignore-value.h"
|
||||||
|
#include "getprogname.h"
|
||||||
|
|
||||||
#define TOTAL_TIME 60 /* Seconds, excluding launch. */
|
#define TOTAL_TIME 60 /* Seconds, excluding launch. */
|
||||||
#define DEBUG 1 /* Print overview debugging messages. */
|
#define DEBUG 1 /* Print overview debugging messages. */
|
||||||
@@ -96,13 +97,13 @@ main (int argc, char *argv[])
|
|||||||
skip = getenv ("SKIP_TEST_PARALLEL_MOUNT_LOCAL");
|
skip = getenv ("SKIP_TEST_PARALLEL_MOUNT_LOCAL");
|
||||||
if (skip && guestfs_int_is_true (skip) > 0) {
|
if (skip && guestfs_int_is_true (skip) > 0) {
|
||||||
fprintf (stderr, "%s: test skipped because environment variable set.\n",
|
fprintf (stderr, "%s: test skipped because environment variable set.\n",
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
exit (77);
|
exit (77);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (access ("/dev/fuse", W_OK) == -1) {
|
if (access ("/dev/fuse", W_OK) == -1) {
|
||||||
fprintf (stderr, "%s: test skipped because /dev/fuse is not writable.\n",
|
fprintf (stderr, "%s: test skipped because /dev/fuse is not writable.\n",
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
exit (77);
|
exit (77);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
#include "guestfs-internal-frontend.h"
|
#include "guestfs-internal-frontend.h"
|
||||||
|
|
||||||
#include "ignore-value.h"
|
#include "ignore-value.h"
|
||||||
|
#include "getprogname.h"
|
||||||
|
|
||||||
#define TOTAL_TIME 600 /* Seconds, excluding launch. */
|
#define TOTAL_TIME 600 /* Seconds, excluding launch. */
|
||||||
#define NR_THREADS 5
|
#define NR_THREADS 5
|
||||||
@@ -79,7 +80,7 @@ main (int argc, char *argv[])
|
|||||||
slow = getenv ("SLOW");
|
slow = getenv ("SLOW");
|
||||||
if (!slow || guestfs_int_is_true (slow) <= 0) {
|
if (!slow || guestfs_int_is_true (slow) <= 0) {
|
||||||
fprintf (stderr, "%s: use 'make check-slow' to run this test.\n",
|
fprintf (stderr, "%s: use 'make check-slow' to run this test.\n",
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
exit (77);
|
exit (77);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,7 +88,7 @@ main (int argc, char *argv[])
|
|||||||
skip = getenv ("SKIP_TEST_PARALLEL");
|
skip = getenv ("SKIP_TEST_PARALLEL");
|
||||||
if (skip && guestfs_int_is_true (skip) > 0) {
|
if (skip && guestfs_int_is_true (skip) > 0) {
|
||||||
fprintf (stderr, "%s: test skipped because environment variable set.\n",
|
fprintf (stderr, "%s: test skipped because environment variable set.\n",
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
exit (77);
|
exit (77);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -112,15 +112,18 @@ rhbz501893_LDADD = \
|
|||||||
|
|
||||||
rhbz790721_SOURCES = rhbz790721.c
|
rhbz790721_SOURCES = rhbz790721.c
|
||||||
rhbz790721_CPPFLAGS = \
|
rhbz790721_CPPFLAGS = \
|
||||||
|
-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \
|
||||||
-I$(top_srcdir)/src -I$(top_builddir)/src
|
-I$(top_srcdir)/src -I$(top_builddir)/src
|
||||||
rhbz790721_CFLAGS = \
|
rhbz790721_CFLAGS = \
|
||||||
-pthread \
|
-pthread \
|
||||||
$(WARN_CFLAGS) $(WERROR_CFLAGS)
|
$(WARN_CFLAGS) $(WERROR_CFLAGS)
|
||||||
rhbz790721_LDADD = \
|
rhbz790721_LDADD = \
|
||||||
$(top_builddir)/src/libguestfs.la
|
$(top_builddir)/src/libguestfs.la \
|
||||||
|
$(top_builddir)/gnulib/lib/libgnu.la
|
||||||
|
|
||||||
rhbz914931_SOURCES = rhbz914931.c
|
rhbz914931_SOURCES = rhbz914931.c
|
||||||
rhbz914931_CPPFLAGS = \
|
rhbz914931_CPPFLAGS = \
|
||||||
|
-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \
|
||||||
-I$(top_srcdir)/src -I$(top_builddir)/src \
|
-I$(top_srcdir)/src -I$(top_builddir)/src \
|
||||||
-DGUESTFS_PRIVATE=1
|
-DGUESTFS_PRIVATE=1
|
||||||
rhbz914931_CFLAGS = \
|
rhbz914931_CFLAGS = \
|
||||||
@@ -129,7 +132,8 @@ rhbz914931_CFLAGS = \
|
|||||||
rhbz914931_LDADD = \
|
rhbz914931_LDADD = \
|
||||||
$(top_builddir)/src/libutils.la \
|
$(top_builddir)/src/libutils.la \
|
||||||
$(LTLIBINTL) \
|
$(LTLIBINTL) \
|
||||||
$(top_builddir)/src/libguestfs.la
|
$(top_builddir)/src/libguestfs.la \
|
||||||
|
$(top_builddir)/gnulib/lib/libgnu.la
|
||||||
|
|
||||||
rhbz1055452_SOURCES = rhbz1055452.c
|
rhbz1055452_SOURCES = rhbz1055452.c
|
||||||
rhbz1055452_CPPFLAGS = \
|
rhbz1055452_CPPFLAGS = \
|
||||||
|
|||||||
@@ -45,6 +45,8 @@
|
|||||||
#include "guestfs.h"
|
#include "guestfs.h"
|
||||||
#include "guestfs-internal-frontend.h"
|
#include "guestfs-internal-frontend.h"
|
||||||
|
|
||||||
|
#include "getprogname.h"
|
||||||
|
|
||||||
/* Number of worker threads running the test. */
|
/* Number of worker threads running the test. */
|
||||||
#define NR_THREADS 20
|
#define NR_THREADS 20
|
||||||
|
|
||||||
@@ -71,7 +73,7 @@ main (int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
if (STRNEQ (backend, "direct")) {
|
if (STRNEQ (backend, "direct")) {
|
||||||
fprintf (stderr, "%s: test skipped because backend isn't 'direct'.\n",
|
fprintf (stderr, "%s: test skipped because backend isn't 'direct'.\n",
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
free (backend);
|
free (backend);
|
||||||
guestfs_close (g);
|
guestfs_close (g);
|
||||||
exit (77);
|
exit (77);
|
||||||
|
|||||||
@@ -33,6 +33,8 @@
|
|||||||
#include "guestfs.h"
|
#include "guestfs.h"
|
||||||
#include "guestfs-internal-frontend.h"
|
#include "guestfs-internal-frontend.h"
|
||||||
|
|
||||||
|
#include "getprogname.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char *argv[])
|
main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
@@ -44,7 +46,7 @@ main (int argc, char *argv[])
|
|||||||
str = getenv ("SKIP_TEST_RHBZ914931");
|
str = getenv ("SKIP_TEST_RHBZ914931");
|
||||||
if (str && guestfs_int_is_true (str) > 0) {
|
if (str && guestfs_int_is_true (str) > 0) {
|
||||||
printf ("%s: test skipped because environment variable is set.\n",
|
printf ("%s: test skipped because environment variable is set.\n",
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
exit (77);
|
exit (77);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,8 @@
|
|||||||
#include "boot-analysis.h"
|
#include "boot-analysis.h"
|
||||||
#include "boot-analysis-utils.h"
|
#include "boot-analysis-utils.h"
|
||||||
|
|
||||||
|
#include "getprogname.h"
|
||||||
|
|
||||||
/* Activities taking longer than this % of the total time, except
|
/* Activities taking longer than this % of the total time, except
|
||||||
* those flagged as LONG_ACTIVITY, are highlighted in red.
|
* those flagged as LONG_ACTIVITY, are highlighted in red.
|
||||||
*/
|
*/
|
||||||
@@ -167,13 +169,13 @@ main (int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
fprintf (stderr, "%s: unknown long option: %s (%d)\n",
|
fprintf (stderr, "%s: unknown long option: %s (%d)\n",
|
||||||
guestfs_int_program_name, long_options[option_index].name, option_index);
|
getprogname (), long_options[option_index].name, option_index);
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
|
|
||||||
case 'm':
|
case 'm':
|
||||||
if (sscanf (optarg, "%d", &memsize) != 1) {
|
if (sscanf (optarg, "%d", &memsize) != 1) {
|
||||||
fprintf (stderr, "%s: could not parse memsize parameter: %s\n",
|
fprintf (stderr, "%s: could not parse memsize parameter: %s\n",
|
||||||
guestfs_int_program_name, optarg);
|
getprogname (), optarg);
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -38,6 +38,8 @@
|
|||||||
|
|
||||||
#include "boot-analysis-utils.h"
|
#include "boot-analysis-utils.h"
|
||||||
|
|
||||||
|
#include "getprogname.h"
|
||||||
|
|
||||||
#define NR_WARMUP_PASSES 3
|
#define NR_WARMUP_PASSES 3
|
||||||
#define NR_TEST_PASSES 10
|
#define NR_TEST_PASSES 10
|
||||||
|
|
||||||
@@ -102,19 +104,19 @@ main (int argc, char *argv[])
|
|||||||
else if (STREQ (long_options[option_index].name, "smp")) {
|
else if (STREQ (long_options[option_index].name, "smp")) {
|
||||||
if (sscanf (optarg, "%d", &smp) != 1) {
|
if (sscanf (optarg, "%d", &smp) != 1) {
|
||||||
fprintf (stderr, "%s: could not parse smp parameter: %s\n",
|
fprintf (stderr, "%s: could not parse smp parameter: %s\n",
|
||||||
guestfs_int_program_name, optarg);
|
getprogname (), optarg);
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
fprintf (stderr, "%s: unknown long option: %s (%d)\n",
|
fprintf (stderr, "%s: unknown long option: %s (%d)\n",
|
||||||
guestfs_int_program_name, long_options[option_index].name, option_index);
|
getprogname (), long_options[option_index].name, option_index);
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
|
|
||||||
case 'm':
|
case 'm':
|
||||||
if (sscanf (optarg, "%d", &memsize) != 1) {
|
if (sscanf (optarg, "%d", &memsize) != 1) {
|
||||||
fprintf (stderr, "%s: could not parse memsize parameter: %s\n",
|
fprintf (stderr, "%s: could not parse memsize parameter: %s\n",
|
||||||
guestfs_int_program_name, optarg);
|
getprogname (), optarg);
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -39,6 +39,8 @@
|
|||||||
#include "guestfs-internal-frontend.h"
|
#include "guestfs-internal-frontend.h"
|
||||||
#include "estimate-max-threads.h"
|
#include "estimate-max-threads.h"
|
||||||
|
|
||||||
|
#include "getprogname.h"
|
||||||
|
|
||||||
#define MIN(a,b) ((a)<(b)?(a):(b))
|
#define MIN(a,b) ((a)<(b)?(a):(b))
|
||||||
|
|
||||||
/* Maximum number of threads we would ever run. Note this should not
|
/* Maximum number of threads we would ever run. Note this should not
|
||||||
@@ -204,7 +206,7 @@ run_test (size_t P)
|
|||||||
err = pthread_join (threads[i], &status);
|
err = pthread_join (threads[i], &status);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
fprintf (stderr, "%s: pthread_join[%zu]: %s\n",
|
fprintf (stderr, "%s: pthread_join[%zu]: %s\n",
|
||||||
guestfs_int_program_name, i, strerror (err));
|
getprogname (), i, strerror (err));
|
||||||
errors++;
|
errors++;
|
||||||
}
|
}
|
||||||
if (*(int *)status == -1)
|
if (*(int *)status == -1)
|
||||||
@@ -235,7 +237,7 @@ start_thread (void *thread_data_vp)
|
|||||||
err = pthread_mutex_lock (&mutex);
|
err = pthread_mutex_lock (&mutex);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
fprintf (stderr, "%s: pthread_mutex_lock: %s",
|
fprintf (stderr, "%s: pthread_mutex_lock: %s",
|
||||||
guestfs_int_program_name, strerror (err));
|
getprogname (), strerror (err));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,7 +254,7 @@ start_thread (void *thread_data_vp)
|
|||||||
err = pthread_mutex_unlock (&mutex);
|
err = pthread_mutex_unlock (&mutex);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
fprintf (stderr, "%s: pthread_mutex_unlock: %s",
|
fprintf (stderr, "%s: pthread_mutex_unlock: %s",
|
||||||
guestfs_int_program_name, strerror (err));
|
getprogname (), strerror (err));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -320,7 +322,7 @@ start_thread (void *thread_data_vp)
|
|||||||
|
|
||||||
if (errors > 0) {
|
if (errors > 0) {
|
||||||
fprintf (stderr, "%s: thread %d: %u errors were ignored\n",
|
fprintf (stderr, "%s: thread %d: %u errors were ignored\n",
|
||||||
guestfs_int_program_name, thread_data->thread_num, errors);
|
getprogname (), thread_data->thread_num, errors);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,8 @@
|
|||||||
#include "guestfs.h"
|
#include "guestfs.h"
|
||||||
#include "guestfs-internal-frontend.h"
|
#include "guestfs-internal-frontend.h"
|
||||||
|
|
||||||
|
#include "getprogname.h"
|
||||||
|
|
||||||
static void test_virtio_serial (void);
|
static void test_virtio_serial (void);
|
||||||
static void test_block_device (void);
|
static void test_block_device (void);
|
||||||
|
|
||||||
@@ -133,7 +135,7 @@ main (int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fprintf (stderr, "%s: unknown long option: %s (%d)\n",
|
fprintf (stderr, "%s: unknown long option: %s (%d)\n",
|
||||||
guestfs_int_program_name, long_options[option_index].name, option_index);
|
getprogname (), long_options[option_index].name, option_index);
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -142,7 +144,7 @@ main (int argc, char *argv[])
|
|||||||
if (sscanf (optarg, "%d", &max_time_override) != 1 ||
|
if (sscanf (optarg, "%d", &max_time_override) != 1 ||
|
||||||
max_time_override < 0) {
|
max_time_override < 0) {
|
||||||
fprintf (stderr, "%s: -t: argument is not a positive integer\n",
|
fprintf (stderr, "%s: -t: argument is not a positive integer\n",
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -157,7 +159,7 @@ main (int argc, char *argv[])
|
|||||||
|
|
||||||
if (optind != argc) {
|
if (optind != argc) {
|
||||||
fprintf (stderr, "%s: extra arguments found on the command line\n",
|
fprintf (stderr, "%s: extra arguments found on the command line\n",
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -312,14 +314,14 @@ test_virtio_serial (void)
|
|||||||
if (r == -1 && guestfs_last_errno (g) != EINTR) {
|
if (r == -1 && guestfs_last_errno (g) != EINTR) {
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
"%s: expecting upload command to return EINTR\n%s\n",
|
"%s: expecting upload command to return EINTR\n%s\n",
|
||||||
guestfs_int_program_name, guestfs_last_error (g));
|
getprogname (), guestfs_last_error (g));
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rate == -1) {
|
if (rate == -1) {
|
||||||
rate_error:
|
rate_error:
|
||||||
fprintf (stderr, "%s: internal error: progress callback was not called! (r=%d, errno=%d)\n",
|
fprintf (stderr, "%s: internal error: progress callback was not called! (r=%d, errno=%d)\n",
|
||||||
guestfs_int_program_name,
|
getprogname (),
|
||||||
r, guestfs_last_errno (g));
|
r, guestfs_last_errno (g));
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
@@ -348,7 +350,7 @@ test_virtio_serial (void)
|
|||||||
if (r == -1 && guestfs_last_errno (g) != EINTR) {
|
if (r == -1 && guestfs_last_errno (g) != EINTR) {
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
"%s: expecting download command to return EINTR\n%s\n",
|
"%s: expecting download command to return EINTR\n%s\n",
|
||||||
guestfs_int_program_name, guestfs_last_error (g));
|
getprogname (), guestfs_last_error (g));
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -417,7 +419,7 @@ test_block_device (void)
|
|||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
if (devices[0] == NULL) {
|
if (devices[0] == NULL) {
|
||||||
fprintf (stderr, "%s: expected guestfs_list_devices to return at least 1 device\n",
|
fprintf (stderr, "%s: expected guestfs_list_devices to return at least 1 device\n",
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -433,7 +435,7 @@ test_block_device (void)
|
|||||||
|
|
||||||
if (sscanf (r, "%" SCNi64, &bytes_written) != 1) {
|
if (sscanf (r, "%" SCNi64, &bytes_written) != 1) {
|
||||||
fprintf (stderr, "%s: could not parse device_speed output\n",
|
fprintf (stderr, "%s: could not parse device_speed output\n",
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -452,7 +454,7 @@ test_block_device (void)
|
|||||||
|
|
||||||
if (sscanf (r, "%" SCNi64, &bytes_read) != 1) {
|
if (sscanf (r, "%" SCNi64, &bytes_read) != 1) {
|
||||||
fprintf (stderr, "%s: could not parse device_speed output\n",
|
fprintf (stderr, "%s: could not parse device_speed output\n",
|
||||||
guestfs_int_program_name);
|
getprogname ());
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user