File 0078-RHEL-6.1-Require-external-hex-editor-set-with.patch of Package libguestfs

From 962e61ed42db23f18446dece5eac9205143d2e94 Mon Sep 17 00:00:00 2001
From: Richard W.M. Jones <rjones@redhat.com>
Date: Fri, 14 Jan 2011 15:13:53 +0000
Subject: [PATCH 78/78] RHEL 6.1: Require external hex editor set with .

RHEL 6 doesn't have the hexedit program or any suitable replacement.
Require that the user sets  to make this command work.
---
 fish/guestfish.pod             |    3 +--
 fish/hexedit.c                 |    6 ++++--
 generator/generator_actions.ml |    9 +++++----
 3 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/fish/guestfish.pod b/fish/guestfish.pod
index a3af17f..3dfac10 100644
--- a/fish/guestfish.pod
+++ b/fish/guestfish.pod
@@ -980,8 +980,7 @@ L</REMOTE CONTROL GUESTFISH OVER A SOCKET>.
 =item HEXEDITOR
 
 The L</hexedit> command uses C<$HEXEDITOR> as the external hex
-editor.  If not specified, the external L<hexedit(1)> program
-is used.
+editor.  If not set, then an error message is printed.
 
 =item HOME
 
diff --git a/fish/hexedit.c b/fish/hexedit.c
index 885c54e..558e249 100644
--- a/fish/hexedit.c
+++ b/fish/hexedit.c
@@ -109,8 +109,10 @@ run_hexedit (const char *cmd, size_t argc, char *argv[])
 
   /* Choose an editor. */
   editor = getenv ("HEXEDITOR");
-  if (editor == NULL)
-    editor = "hexedit";
+  if (editor == NULL) {
+    fprintf (stderr, _("the $HEXEDITOR environment variable must be set\n"));
+    return -1;
+  }
 
   snprintf (buf, sizeof buf, "/dev/fd/%d", fd);
 
diff --git a/generator/generator_actions.ml b/generator/generator_actions.ml
index ccaf10a..b73c02d 100644
--- a/generator/generator_actions.ml
+++ b/generator/generator_actions.ml
@@ -5785,7 +5785,7 @@ See L</WILDCARDS AND GLOBBING>.");
  hexedit <filename|device> <max>
  hexedit <filename|device> <start> <max>
 
-Use hexedit (a hex editor) to edit all or part of a binary file
+Use a hex editor to edit all or part of a binary file
 or block device.
 
 This command works by downloading potentially the whole file or
@@ -5809,9 +5809,10 @@ To edit the superblock of an ext2 filesystem on C</dev/sda1>, do:
 
 (assuming the superblock is in the standard location).
 
-This command requires the external L<hexedit(1)> program.  You
-can specify another program to use by setting the C<HEXEDITOR>
-environment variable.
+This command requires an external hexeditor program.  You
+can specify the program to use by setting the C<HEXEDITOR>
+environment variable.  If C<HEXEDITOR> is not set then this
+prints an error.
 
 See also L</hexdump>.");
 
-- 
1.7.1

openSUSE Build Service is sponsored by