summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorlum <lum@cvs.openbsd.org>2012-05-10 16:07:47 +0000
committerlum <lum@cvs.openbsd.org>2012-05-10 16:07:47 +0000
commit9ba4a90b1347b52c263542bf6f06e5d11d1dcddb (patch)
tree135e8e41f44f7305101eb229e2a086e29ae2b203 /usr.bin
parentad34d7fda2400a678a2ad1d1bb6781b81aa31d17 (diff)
Allow throwaway buffers to be saved via C-c s. This diff
does not change the behaviour with regards to mg not asking to save throwaway buffers when exiting. Reviewed by Sunil Nimmagadda.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/mg/file.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.bin/mg/file.c b/usr.bin/mg/file.c
index fffdfa43e34..e736c73b03d 100644
--- a/usr.bin/mg/file.c
+++ b/usr.bin/mg/file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: file.c,v 1.78 2012/05/08 15:26:31 lum Exp $ */
+/* $OpenBSD: file.c,v 1.79 2012/05/10 16:07:46 lum Exp $ */
/* This file is in the public domain. */
@@ -549,7 +549,10 @@ static int makebackup = MAKEBACKUP;
int
filesave(int f, int n)
{
- return (buffsave(curbp));
+ if (curbp->b_fname[0] == '\0')
+ return (filewrite(f, n));
+ else
+ return (buffsave(curbp));
}
/*