#include <grp.h>
#include <signal.h>
#include <netdb.h>
+#include <locale.h>
#include "libvirt_internal.h"
#include "virterror_internal.h"
{0, 0, 0, 0}
};
- if (virInitialize() < 0) {
- fprintf (stderr, _("%s: initialization failed\n"), argv0);
- exit (EXIT_FAILURE);
+ if (setlocale (LC_ALL, "") == NULL ||
+ bindtextdomain (PACKAGE, LOCALEDIR) == NULL ||
+ textdomain(PACKAGE) == NULL ||
+ virInitialize() < 0) {
+ fprintf(stderr, _("%s: initialization failed\n"), argv0);
+ exit(EXIT_FAILURE);
}
while (1) {
src/security/security_driver.c
src/security/security_selinux.c
src/security/virt-aa-helper.c
+src/storage/parthelper.c
src/storage/storage_backend.c
src/storage/storage_backend_disk.c
src/storage/storage_backend_fs.c
*/
# define VIR_DEPRECATED /*empty*/
+/* All uses of _() within the library should pick up translations from
+ * libvirt's message files, rather than from the package that is
+ * linking in the library. Setting this macro before including
+ * "gettext.h" means that gettext() (and _()) will properly expand to
+ * dgettext. */
+# define DEFAULT_TEXT_DOMAIN PACKAGE
# include "gettext.h"
+# define _(str) gettext(str)
+# define N_(str) str
# include "libvirt/libvirt.h"
# include "libvirt/virterror.h"
# define INET_ADDRSTRLEN 16
# endif
-# define _(str) dgettext(PACKAGE, (str))
-# define N_(str) str
-
/* String equality tests, suggested by Jim Meyering. */
# define STREQ(a,b) (strcmp(a,b) == 0)
# define STRCASEEQ(a,b) (strcasecmp(a,b) == 0)
/*
+ * Copyright (C) 2010 Red Hat, Inc.
* Copyright IBM Corp. 2008
*
* lxc_controller.c: linux container process controller
#include <signal.h>
#include <getopt.h>
#include <sys/mount.h>
+#include <locale.h>
#if HAVE_CAPNG
# include <cap-ng.h>
{ 0, 0, 0, 0 },
};
+ if (setlocale(LC_ALL, "") == NULL ||
+ bindtextdomain(PACKAGE, LOCALEDIR) == NULL ||
+ textdomain(PACKAGE) == NULL) {
+ fprintf(stderr, _("%s: initialization failed\n"), argv[0]);
+ exit(EXIT_FAILURE);
+ }
+
while (1) {
int c;
char profile[PATH_MAX];
char include_file[PATH_MAX];
+ if (setlocale(LC_ALL, "") == NULL ||
+ bindtextdomain(PACKAGE, LOCALEDIR) == NULL ||
+ textdomain(PACKAGE) == NULL) {
+ fprintf(stderr, _("%s: initialization failed\n"), argv0);
+ exit(EXIT_FAILURE);
+ }
+
/* clear the environment */
environ = NULL;
if (setenv("PATH", "/sbin:/usr/sbin", 1) != 0) {
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
+#include <locale.h>
#include "util.h"
#include "c-ctype.h"
+#include "configmake.h"
/* we don't need to include the full internal.h just for this */
#define STREQ(a,b) (strcmp(a,b) == 0)
char *canonical_path;
const char *partsep;
+ if (setlocale(LC_ALL, "") == NULL ||
+ bindtextdomain(PACKAGE, LOCALEDIR) == NULL ||
+ textdomain(PACKAGE) == NULL) {
+ fprintf(stderr, _("%s: initialization failed\n"), argv[0]);
+ exit(EXIT_FAILURE);
+ }
+
if (argc == 3 && STREQ(argv[2], "-g")) {
cmd = DISK_GEOMETRY;
} else if (argc != 2) {
- fprintf(stderr, "syntax: %s DEVICE [-g]\n", argv[0]);
+ fprintf(stderr, _("syntax: %s DEVICE [-g]\n"), argv[0]);
return 1;
}
}
if ((dev = ped_device_get(path)) == NULL) {
- fprintf(stderr, "unable to access device %s\n", path);
+ fprintf(stderr, _("unable to access device %s\n"), path);
return 2;
}
}
if ((disk = ped_disk_new(dev)) == NULL) {
- fprintf(stderr, "unable to access disk %s\n", argv[1]);
+ fprintf(stderr, _("unable to access disk %s\n"), argv[1]);
return 2;
}
}
if (!bindtextdomain(PACKAGE, LOCALEDIR)) {
perror("bindtextdomain");
- return -1;
+ return EXIT_FAILURE;
}
if (!textdomain(PACKAGE)) {
perror("textdomain");
- return -1;
+ return EXIT_FAILURE;
}
if (!(progname = strrchr(argv[0], '/')))