[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-inetutils] ftp 1.5 open - arguments too long?
From: |
Alfred M. Szmidt |
Subject: |
Re: [bug-inetutils] ftp 1.5 open - arguments too long? |
Date: |
Tue, 27 Mar 2007 11:59:20 +0200 (CEST) |
--- inetutils-20070322/ftp/cmds.c 2007-03-21 21:44:58.000000000 -0400
+++ ftp_readline/inetutils-20070322/ftp/cmds.c 2007-03-26
17:46:59.000000000 -0400
@@ -69,6 +69,10 @@
system headers on some platforms. */
#include <glob.h>
+#if HAVE_READLINE_READLINE_H
+# include <readline/readline.h>
+#endif
+
#include "ftp_var.h"
/* Returns true if STR is entirely lower case. */
@@ -136,20 +140,42 @@
char ***pargv;
char *prompt;
{
- int len = strlen (line), ret;
+ int ret, len;
+
+#if HAVE_LIBREADLINE
+ char *l;
+
+ l = readline (prompt);
+ if (!l)
+ quit(0, 0);
+
+ line = strcat (line, " ");
+ line = strcat (line, l);
+
+ if (l)
+ free (l);
+
+ if (line && *line)
+ add_history (line);
+
+ len = strlen (line);
+#else
+ len = strlen (line);
if (len >= sizeof (line) - 3)
{
printf ("sorry, arguments too long\n");
intr ();
}
- printf ("(%s) ", prompt);
+ printf ("%s", prompt);
This is incorrect. It will change the prompt for all callers for
another(). And you only change the caller at one place, for the
`(to)' prompt. You should use sprintf and make a new string that
looks like it should in the HAVE_READLINE case.