summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1997-03-14 05:36:03 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1997-03-14 05:36:03 +0000
commitbcdacc5cf12b19103797e3d64b0e990f969b9688 (patch)
tree6ae15109e7df41c4b22c1118803b771d32d7b3d5
parent792987ae58d7eb73cd9316b0db73298133aedd0a (diff)
Fix problem where tty mode could get clobbered when ftp was suspended.
Call el_parse() to catch editrc(5) commands if the command is not known to ftp. Thorsten did all the real work for this :-)
-rw-r--r--usr.bin/ftp/main.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/usr.bin/ftp/main.c b/usr.bin/ftp/main.c
index 4f49e13c585..d1d59c3748f 100644
--- a/usr.bin/ftp/main.c
+++ b/usr.bin/ftp/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.23 1997/03/14 05:03:45 millert Exp $ */
+/* $OpenBSD: main.c,v 1.24 1997/03/14 05:36:02 millert Exp $ */
/* $NetBSD: main.c,v 1.18 1997/03/13 06:23:19 lukem Exp $ */
/*
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 10/9/94";
#else
-static char rcsid[] = "$OpenBSD: main.c,v 1.23 1997/03/14 05:03:45 millert Exp $";
+static char rcsid[] = "$OpenBSD: main.c,v 1.24 1997/03/14 05:36:02 millert Exp $";
#endif
#endif /* not lint */
@@ -221,6 +221,10 @@ main(argc, argv)
setttywidth(0);
(void)signal(SIGWINCH, setttywidth);
+#ifndef SMALLFTP
+ if (editing)
+ el_set(el, EL_SIGNAL, 1);
+#endif /* !SMALLFTP */
if (argc > 0) {
if (strchr(argv[0], ':') != NULL) {
@@ -373,21 +377,21 @@ cmdscanner(top)
makeargv();
if (margc == 0)
continue;
-#if 0 && !defined(SMALLFTP) /* XXX: don't want el_parse */
- /*
- * el_parse returns -1 to signal that it's not been handled
- * internally.
- */
- if (el_parse(el, margc, margv) != -1)
- continue;
-#endif /* !SMALLFTP */
c = getcmd(margv[0]);
if (c == (struct cmd *)-1) {
puts("?Ambiguous command.");
continue;
}
if (c == 0) {
- puts("?Invalid command.");
+#ifndef SMALLFTP
+ /*
+ * Give editline(3) a shot at unknown commands.
+ * XXX - bogus commands with a colon in
+ * them will not elicit an error.
+ */
+ if (el_parse(el, margc, margv) != 0)
+#endif /* !SMALLFTP */
+ puts("?Invalid command.");
continue;
}
if (c->c_conn && !connected) {