Fix conditional test for HAVE_HIVEXSH.
[hivex.git] / sh / hivexsh.c
index 332b773..faff83c 100644 (file)
 #include <unistd.h>
 #include <assert.h>
 #include <errno.h>
+#include <locale.h>
+
+#ifdef HAVE_LIBINTL_H
+#include <libintl.h>
+#endif
 
 #ifdef HAVE_LIBREADLINE
 #include <readline/readline.h>
@@ -100,15 +105,17 @@ int
 main (int argc, char *argv[])
 {
   setlocale (LC_ALL, "");
+#ifdef HAVE_BINDTEXTDOMAIN
   bindtextdomain (PACKAGE, LOCALEBASEDIR);
   textdomain (PACKAGE);
+#endif
 
   int c;
   const char *filename = NULL;
 
   set_prompt_string ();
 
-  while ((c = getopt (argc, argv, "dfw")) != EOF) {
+  while ((c = getopt (argc, argv, "df:w")) != EOF) {
     switch (c) {
     case 'd':
       open_flags |= HIVEX_OPEN_DEBUG;
@@ -946,11 +953,13 @@ cmd_setval (char *nrvals_str)
                  "setval", "dword", "xstrtol", xerr);
         goto error;
       }
+#if SIZEOF_LONG > 4
       if (n < 0 || n > UINT32_MAX) {
         fprintf (stderr, _("%s: %s: integer out of range\n"),
                  "setval", "dword");
         goto error;
       }
+#endif
       uint32_t u32 = htole32 (n);
       memcpy (values[i].value, &u32, 4);
     }
@@ -999,11 +1008,13 @@ cmd_setval (char *nrvals_str)
                  "setval", "hex", "xstrtol", xerr);
         goto error;
       }
+#if SIZEOF_LONG > 4
       if (t < 0 || t > UINT32_MAX) {
         fprintf (stderr, _("%s: %s: integer out of range\n"),
                  "setval", "hex");
         goto error;
       }
+#endif
       values[i].t = t;
 
       /* Read the hex data. */