summaryrefslogtreecommitdiff
path: root/usr.bin/ftp/main.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2014-07-14 05:54:13 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2014-07-14 05:54:13 +0000
commita26f0e837afe316099dbbfcdb6cf58487e4fd6ac (patch)
tree51d42bb1ae4fc67cd9ceaf2aeeda35a1c7b0eef2 /usr.bin/ftp/main.c
parent6c6424c34e922b0234bda42e95a2fbf62bffb990 (diff)
Repair handling of ^C and ^D around command prompts, by inserting
correct newlines. Of course, that means removing stdio use from signal handlers. Can we find someone to rewrite the entire interactive half of this program? ok guenther
Diffstat (limited to 'usr.bin/ftp/main.c')
-rw-r--r--usr.bin/ftp/main.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/usr.bin/ftp/main.c b/usr.bin/ftp/main.c
index e67b75b1859..5d68d21b015 100644
--- a/usr.bin/ftp/main.c
+++ b/usr.bin/ftp/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.89 2014/07/11 18:19:45 halex Exp $ */
+/* $OpenBSD: main.c,v 1.90 2014/07/14 05:54:12 deraadt Exp $ */
/* $NetBSD: main.c,v 1.24 1997/08/18 10:20:26 lukem Exp $ */
/*
@@ -467,8 +467,12 @@ main(volatile int argc, char *argv[])
void
intr(void)
{
+ int save_errno = errno;
+ write(fileno(ttyout), "\n\r", 2);
alarmtimer(0);
+
+ errno = save_errno;
longjmp(toplevel, 1);
}
@@ -552,8 +556,11 @@ cmdscanner(int top)
const char *buf;
cursor_pos = NULL;
- if ((buf = el_gets(el, &num)) == NULL || num == 0)
+ if ((buf = el_gets(el, &num)) == NULL || num == 0) {
+ putc('\n', ttyout);
+ fflush(ttyout);
quit(0, 0);
+ }
if (buf[--num] == '\n') {
if (num == 0)
break;