提交 c505eafe 编写于 作者: M Matthias Bolte

virt-aa-helper: Fix several compile errors

Include locale.h for setlocale().

Revert the usage string back to it's original form.

Use puts() instead of fputs(), as fputs() expects a FILE*.

Add closing parenthesis to some vah_error() calls.

Use argv[0] instead of an undefined argv0.
上级 38afe8f5
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <getopt.h> #include <getopt.h>
#include <stdbool.h> #include <stdbool.h>
#include <sys/utsname.h> #include <sys/utsname.h>
#include <locale.h>
#include "internal.h" #include "internal.h"
#include "buf.h" #include "buf.h"
...@@ -84,21 +85,21 @@ vahDeinit(vahControl * ctl) ...@@ -84,21 +85,21 @@ vahDeinit(vahControl * ctl)
static void static void
vah_usage(void) vah_usage(void)
{ {
fprintf(stdout, _("\n%s [options] [< def.xml]\n\n printf(_("\n%s [options] [< def.xml]\n\n"
Options:\n " Options:\n"
-a | --add load profile\n " -a | --add load profile\n"
-c | --create create profile from template\n " -c | --create create profile from template\n"
-D | --delete unload and delete profile\n " -D | --delete unload and delete profile\n"
-f | --add-file <file> add file to profile\n " -f | --add-file <file> add file to profile\n"
-F | --append-file <file> append file to profile\n " -F | --append-file <file> append file to profile\n"
-r | --replace reload profile\n " -r | --replace reload profile\n"
-R | --remove unload profile\n " -R | --remove unload profile\n"
-h | --help this help\n " -h | --help this help\n"
-u | --uuid <uuid> uuid (profile name)\n " -u | --uuid <uuid> uuid (profile name)\n"
\n", progname); "\n"), progname);
fputs(_("This command is intended to be used by libvirtd " puts(_("This command is intended to be used by libvirtd "
"and not used directly.\n")); "and not used directly.\n"));
return; return;
} }
...@@ -289,7 +290,7 @@ update_include_file(const char *include_file, const char *included_files, ...@@ -289,7 +290,7 @@ update_include_file(const char *include_file, const char *included_files,
} }
if (VIR_CLOSE(fd) != 0) { if (VIR_CLOSE(fd) != 0) {
vah_error(NULL, 0, _("failed to close or write to profile")_; vah_error(NULL, 0, _("failed to close or write to profile"));
goto clean; goto clean;
} }
rc = 0; rc = 0;
...@@ -396,7 +397,7 @@ create_profile(const char *profile, const char *profile_name, ...@@ -396,7 +397,7 @@ create_profile(const char *profile, const char *profile_name,
} }
if (VIR_CLOSE(fd) != 0) { if (VIR_CLOSE(fd) != 0) {
vah_error(NULL, 0, _("failed to close or write to profile")_; vah_error(NULL, 0, _("failed to close or write to profile"));
goto clean_all; goto clean_all;
} }
rc = 0; rc = 0;
...@@ -1061,7 +1062,7 @@ vahParseArgv(vahControl * ctl, int argc, char **argv) ...@@ -1061,7 +1062,7 @@ vahParseArgv(vahControl * ctl, int argc, char **argv)
case 'f': case 'f':
case 'F': case 'F':
if ((ctl->newfile = strdup(optarg)) == NULL) if ((ctl->newfile = strdup(optarg)) == NULL)
vah_error(ctl, 1, _("could not allocate memory for disk")_; vah_error(ctl, 1, _("could not allocate memory for disk"));
ctl->append = arg == 'F'; ctl->append = arg == 'F';
break; break;
case 'h': case 'h':
...@@ -1140,7 +1141,7 @@ main(int argc, char **argv) ...@@ -1140,7 +1141,7 @@ main(int argc, char **argv)
if (setlocale(LC_ALL, "") == NULL || if (setlocale(LC_ALL, "") == NULL ||
bindtextdomain(PACKAGE, LOCALEDIR) == NULL || bindtextdomain(PACKAGE, LOCALEDIR) == NULL ||
textdomain(PACKAGE) == NULL) { textdomain(PACKAGE) == NULL) {
fprintf(stderr, _("%s: initialization failed\n"), argv0); fprintf(stderr, _("%s: initialization failed\n"), argv[0]);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册