summaryrefslogtreecommitdiff
path: root/usr.bin/mg
diff options
context:
space:
mode:
authorMark Lumsden <lum@cvs.openbsd.org>2019-06-22 15:03:44 +0000
committerMark Lumsden <lum@cvs.openbsd.org>2019-06-22 15:03:44 +0000
commitccb3fc3e278b63fa545c384c8cfcc52784728fd2 (patch)
treea2c9855d6b04b3d262e2d1cd86ec375ec0edcda1 /usr.bin/mg
parent6ddc2db55cc3cdeaac05700ad6428916d9b1f636 (diff)
Offering to add a new line at the end of the buffer didn't consider if
the user pressed C-g. Now it does.
Diffstat (limited to 'usr.bin/mg')
-rw-r--r--usr.bin/mg/file.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.bin/mg/file.c b/usr.bin/mg/file.c
index 11fb2948d2c..d6e0c8d2712 100644
--- a/usr.bin/mg/file.c
+++ b/usr.bin/mg/file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: file.c,v 1.101 2019/06/22 10:21:57 lum Exp $ */
+/* $OpenBSD: file.c,v 1.102 2019/06/22 15:03:43 lum Exp $ */
/* This file is in the public domain. */
@@ -690,8 +690,9 @@ writeout(FILE ** ffp, struct buffer *bp, char *fn)
lpend = bp->b_headp;
eobnl = 0;
if (llength(lback(lpend)) != 0) {
- if (eyorn("No newline at end of file, add one") == TRUE)
- eobnl = 1;
+ eobnl = eyorn("No newline at end of file, add one");
+ if (eobnl != TRUE && eobnl != FALSE)
+ return (eobnl); /* abort */
}
/* open writes message */
if ((s = ffwopen(ffp, fn, bp)) != FIOSUC)