summaryrefslogtreecommitdiffstats
path: root/fish
diff options
context:
space:
mode:
authorRichard Jones <rjones@redhat.com>2009-04-26 07:05:12 +0100
committerRichard Jones <rjones@redhat.com>2009-04-26 07:05:12 +0100
commite65e1d5d0053431702bc99e5d59725324adf1af5 (patch)
tree149db39ed9f54bc4946b7668e4c7e7db1ecb7b5f /fish
parent0583c8c2c3500715fe5757d2e2fcb0fdc019c2ae (diff)
downloadlibguestfs-e65e1d5d0053431702bc99e5d59725324adf1af5.tar.gz
libguestfs-e65e1d5d0053431702bc99e5d59725324adf1af5.tar.xz
libguestfs-e65e1d5d0053431702bc99e5d59725324adf1af5.zip
Don't echo output in scripts.
Diffstat (limited to 'fish')
-rw-r--r--fish/fish.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/fish/fish.c b/fish/fish.c
index 812197c5..132c52cb 100644
--- a/fish/fish.c
+++ b/fish/fish.c
@@ -277,17 +277,21 @@ rl_gets (int prompt)
{
#ifdef HAVE_LIBREADLINE
- if (line_read) {
- free (line_read);
- line_read = NULL;
- }
+ if (prompt) {
+ if (line_read) {
+ free (line_read);
+ line_read = NULL;
+ }
- line_read = readline (prompt ? FISH : "");
+ line_read = readline (prompt ? FISH : "");
- if (prompt && line_read && *line_read)
- add_history_line (line_read);
+ if (line_read && *line_read)
+ add_history_line (line_read);
-#else /* !HAVE_LIBREADLINE */
+ return line_read;
+ }
+
+#endif /* HAVE_LIBREADLINE */
static char buf[8192];
int len;
@@ -300,8 +304,6 @@ rl_gets (int prompt)
if (len > 0 && buf[len-1] == '\n') buf[len-1] = '\0';
}
-#endif /* !HAVE_LIBREADLINE */
-
return line_read;
}