summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fish/Makefile.am1
-rw-r--r--fish/fish.c4
-rw-r--r--fuse/Makefile.am1
-rw-r--r--fuse/guestmount.c4
-rw-r--r--hivex/Makefile.am4
-rw-r--r--hivex/hivexget.c24
-rw-r--r--hivex/hivexml.c21
-rw-r--r--test-tool/Makefile.am1
-rw-r--r--test-tool/test-tool.c4
9 files changed, 55 insertions, 9 deletions
diff --git a/fish/Makefile.am b/fish/Makefile.am
index d817e6cf..43dce00f 100644
--- a/fish/Makefile.am
+++ b/fish/Makefile.am
@@ -59,6 +59,7 @@ guestfish_CFLAGS = \
-I$(top_srcdir)/src -I$(top_builddir)/src \
-I$(top_srcdir)/fish -I$(top_builddir)/fish \
-DGUESTFS_DEFAULT_PATH='"$(libdir)/guestfs"' \
+ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \
-I$(srcdir)/../gnulib/lib -I../gnulib/lib \
$(WARN_CFLAGS) $(WERROR_CFLAGS)
diff --git a/fish/fish.c b/fish/fish.c
index 7dae815d..dd73af74 100644
--- a/fish/fish.c
+++ b/fish/fish.c
@@ -139,6 +139,10 @@ main (int argc, char *argv[])
atexit (close_stdout);
+ setlocale (LC_ALL, "");
+ bindtextdomain (PACKAGE, LOCALEBASEDIR);
+ textdomain (PACKAGE);
+
enum { HELP_OPTION = CHAR_MAX + 1 };
static const char *options = "a:Df:h::im:nrv?Vx";
diff --git a/fuse/Makefile.am b/fuse/Makefile.am
index 5ffdb95b..1bfc3755 100644
--- a/fuse/Makefile.am
+++ b/fuse/Makefile.am
@@ -33,6 +33,7 @@ guestmount_CFLAGS = \
-I$(top_srcdir)/src -I$(top_builddir)/src \
-I$(srcdir)/../gnulib/lib -I../gnulib/lib \
-DGUESTFS_DEFAULT_PATH='"$(libdir)/guestfs"' \
+ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \
$(FUSE_CFLAGS) \
$(WARN_CFLAGS) $(WERROR_CFLAGS)
diff --git a/fuse/guestmount.c b/fuse/guestmount.c
index 9f0a39ec..c935493b 100644
--- a/fuse/guestmount.c
+++ b/fuse/guestmount.c
@@ -896,6 +896,10 @@ usage (int status)
int
main (int argc, char *argv[])
{
+ setlocale (LC_ALL, "");
+ bindtextdomain (PACKAGE, LOCALEBASEDIR);
+ textdomain (PACKAGE);
+
enum { HELP_OPTION = CHAR_MAX + 1 };
/* The command line arguments are broadly compatible with (a subset
diff --git a/hivex/Makefile.am b/hivex/Makefile.am
index b73aa2f4..31275eac 100644
--- a/hivex/Makefile.am
+++ b/hivex/Makefile.am
@@ -34,6 +34,8 @@ hivexml_SOURCES = \
hivexml_LDADD = libhivex.la $(LIBXML2_LIBS)
hivexml_CFLAGS = \
+ -I$(top_srcdir)/src \
+ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \
$(LIBXML2_CFLAGS) \
$(WARN_CFLAGS) $(WERROR_CFLAGS)
@@ -42,6 +44,8 @@ hivexget_SOURCES = \
hivexget_LDADD = libhivex.la
hivexget_CFLAGS = \
+ -I$(top_srcdir)/src \
+ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \
$(WARN_CFLAGS) $(WERROR_CFLAGS)
man_MANS = hivex.3 hivexml.1 hivexget.1
diff --git a/hivex/hivexget.c b/hivex/hivexget.c
index 3e89d632..fd492931 100644
--- a/hivex/hivexget.c
+++ b/hivex/hivexget.c
@@ -27,26 +27,40 @@
#include "hivex.h"
+#ifdef HAVE_GETTEXT
+#include "gettext.h"
+#define _(str) dgettext(PACKAGE, (str))
+//#define N_(str) dgettext(PACKAGE, (str))
+#else
+#define _(str) str
+//#define N_(str) str
+#endif
+
enum { EXIT_NOT_FOUND = 2 };
int
main (int argc, char *argv[])
{
+ setlocale (LC_ALL, "");
+ bindtextdomain (PACKAGE, LOCALEBASEDIR);
+ textdomain (PACKAGE);
+
if (argc < 3 || argc > 4) {
- fprintf (stderr, "hivexget regfile path [key]\n");
+ fprintf (stderr, _("hivexget regfile path [key]\n"));
exit (EXIT_FAILURE);
}
+
char *file = argv[1];
char *path = argv[2];
char *key = argv[3]; /* could be NULL */
if (path[0] != '\\') {
- fprintf (stderr, "hivexget: path must start with a \\ character\n");
+ fprintf (stderr, _("hivexget: path must start with a \\ character\n"));
exit (EXIT_FAILURE);
}
if (path[1] == '\\') {
doubled:
- fprintf (stderr, "hivexget: %s: \\ characters in path are doubled - are you escaping the path parameter correctly?\n", path);
+ fprintf (stderr, _("hivexget: %s: \\ characters in path are doubled - are you escaping the path parameter correctly?\n"), path);
exit (EXIT_FAILURE);
}
@@ -82,7 +96,7 @@ main (int argc, char *argv[])
if (errno)
goto error;
/* else node not found */
- fprintf (stderr, "hivexget: %s: %s: path element not found\n",
+ fprintf (stderr, _("hivexget: %s: %s: path element not found\n"),
path, p);
exit (EXIT_NOT_FOUND);
}
@@ -104,7 +118,7 @@ main (int argc, char *argv[])
if (errno)
goto error;
/* else key not found */
- fprintf (stderr, "hivexget: %s: key not found\n", key);
+ fprintf (stderr, _("hivexget: %s: key not found\n"), key);
exit (EXIT_NOT_FOUND);
}
diff --git a/hivex/hivexml.c b/hivex/hivexml.c
index 7fb419f9..90cb22bd 100644
--- a/hivex/hivexml.c
+++ b/hivex/hivexml.c
@@ -30,6 +30,15 @@
#include "hivex.h"
+#ifdef HAVE_GETTEXT
+#include "gettext.h"
+#define _(str) dgettext(PACKAGE, (str))
+//#define N_(str) dgettext(PACKAGE, (str))
+#else
+#define _(str) str
+//#define N_(str) str
+#endif
+
/* Callback functions. */
static int node_start (hive_h *, void *, hive_node_h, const char *name);
static int node_end (hive_h *, void *, hive_node_h, const char *name);
@@ -58,14 +67,18 @@ static struct hivex_visitor visitor = {
#define XML_CHECK(proc, args) \
do { \
if ((proc args) == -1) { \
- fprintf (stderr, "%s: failed to write XML document\n", #proc); \
- exit (EXIT_FAILURE); \
+ fprintf (stderr, _("%s: failed to write XML document\n"), #proc); \
+ exit (EXIT_FAILURE); \
} \
} while (0)
int
main (int argc, char *argv[])
{
+ setlocale (LC_ALL, "");
+ bindtextdomain (PACKAGE, LOCALEBASEDIR);
+ textdomain (PACKAGE);
+
int c;
int open_flags = 0;
int visit_flags = 0;
@@ -85,7 +98,7 @@ main (int argc, char *argv[])
}
if (optind + 1 != argc) {
- fprintf (stderr, "hivexml: missing name of input file\n");
+ fprintf (stderr, _("hivexml: missing name of input file\n"));
exit (EXIT_FAILURE);
}
@@ -104,7 +117,7 @@ main (int argc, char *argv[])
xmlTextWriterPtr writer;
writer = xmlNewTextWriterFilename ("/dev/stdout", 0);
if (writer == NULL) {
- fprintf (stderr, "xmlNewTextWriterFilename: failed to create XML writer\n");
+ fprintf (stderr, _("xmlNewTextWriterFilename: failed to create XML writer\n"));
exit (EXIT_FAILURE);
}
diff --git a/test-tool/Makefile.am b/test-tool/Makefile.am
index d58f1377..66d06e09 100644
--- a/test-tool/Makefile.am
+++ b/test-tool/Makefile.am
@@ -30,6 +30,7 @@ AM_CPPFLAGS = \
libguestfs_test_tool_SOURCES = test-tool.c
libguestfs_test_tool_CFLAGS = \
+ -DLOCALEBASEDIR=\""$(datadir)/locale"\" \
-I$(top_srcdir)/src -I$(top_builddir)/src \
-Wall
libguestfs_test_tool_LDADD = \
diff --git a/test-tool/test-tool.c b/test-tool/test-tool.c
index f38490a7..39139e58 100644
--- a/test-tool/test-tool.c
+++ b/test-tool/test-tool.c
@@ -85,6 +85,10 @@ usage (void)
int
main (int argc, char *argv[])
{
+ setlocale (LC_ALL, "");
+ bindtextdomain (PACKAGE, LOCALEBASEDIR);
+ textdomain (PACKAGE);
+
static const char *options = "t:?";
static const struct option long_options[] = {
{ "help", 0, 0, '?' },