Alex Bochannek <a...@bochannek.com> writes: > I keep debugging what's going on there. I have found an interesting, > platform-dependent behavior in Emacs that may or may not be related to > this problem.
I was looking at what Bash and tnftp do when they run in an Emacs comint-mode (shell and ange-ftp, respectively) and the below seems to be the easiest fix. It's more or less directly copied from tnftp.
diff --git a/ftp/main.c b/ftp/main.c index 1edffd47..f284c28c 100644 --- a/ftp/main.c +++ b/ftp/main.c @@ -217,6 +217,7 @@ main (int argc, char *argv[]) int index; struct passwd *pw = NULL; char *cp; + int dumbterm; set_program_name (argv[0]); @@ -253,12 +254,19 @@ main (int argc, char *argv[]) argc -= index; argv += index; + cp = getenv("TERM"); + if (cp == NULL || strcmp(cp, "dumb") == 0) + dumbterm = 1; + else + dumbterm = 0; fromatty = isatty (fileno (stdin)); if (fromatty) { verbose++; if (!prompt) prompt = DEFAULT_PROMPT; + if (dumbterm) + usereadline = 0; } else usereadline = 0;
Let me know if you think this is an acceptable fix. -- Alex.