summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>1997-03-14 05:36:02 +0000
committermillert <millert@openbsd.org>1997-03-14 05:36:02 +0000
commitd7948bee96fbd219b1004e8f3e05b63165f744aa (patch)
tree43c64453708a99b82f813ec47ac53de6f2250cd4
parentfix el_source() - a block needed braces around it (from NetBSD) (diff)
downloadwireguard-openbsd-d7948bee96fbd219b1004e8f3e05b63165f744aa.tar.xz
wireguard-openbsd-d7948bee96fbd219b1004e8f3e05b63165f744aa.zip
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) {