diff options
author | Florian Obser <florian@cvs.openbsd.org> | 2012-10-23 20:51:18 +0000 |
---|---|---|
committer | Florian Obser <florian@cvs.openbsd.org> | 2012-10-23 20:51:18 +0000 |
commit | 2958cbe46825d663172494ffda33dd28921b6416 (patch) | |
tree | 8f00ac33e13fdd48c9c09260cb093c72c5e87b26 /usr.bin | |
parent | 969b92bca801e735766218b44a471da1d2e0a625 (diff) |
Use correct file for revert-buffer; do not ignore abort.
ok lum, jasper, benno
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/mg/buffer.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/usr.bin/mg/buffer.c b/usr.bin/mg/buffer.c index c81c50dfce8..a2e84abb2b3 100644 --- a/usr.bin/mg/buffer.c +++ b/usr.bin/mg/buffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: buffer.c,v 1.84 2012/10/22 08:31:42 florian Exp $ */ +/* $OpenBSD: buffer.c,v 1.85 2012/10/23 20:51:17 florian Exp $ */ /* This file is in the public domain. */ @@ -880,17 +880,17 @@ checkdirty(struct buffer *bp) int revertbuffer(int f, int n) { - struct buffer *bp = wheadp->w_bufp; char fbuf[NFILEN + 32]; - if (bp->b_fname[0] == 0) { + if (curbp->b_fname[0] == 0) { ewprintf("Cannot revert buffer not associated with any files."); return (FALSE); } - snprintf(fbuf, sizeof(fbuf), "Revert buffer from file %s", bp->b_fname); + snprintf(fbuf, sizeof(fbuf), "Revert buffer from file %s", + curbp->b_fname); - if (eyorn(fbuf)) + if (eyorn(fbuf) == TRUE) return dorevert(); return (FALSE); @@ -899,27 +899,25 @@ revertbuffer(int f, int n) int dorevert() { - struct mgwin *wp = wheadp; - struct buffer *bp = wp->w_bufp; int lineno; - if (access(bp->b_fname, F_OK|R_OK) != 0) { + if (access(curbp->b_fname, F_OK|R_OK) != 0) { if (errno == ENOENT) ewprintf("File %s no longer exists!", - bp->b_fname); + curbp->b_fname); else ewprintf("File %s is no longer readable!", - bp->b_fname); + curbp->b_fname); return (FALSE); } /* Save our current line, so we can go back after reloading. */ - lineno = wp->w_dotline; + lineno = curwp->w_dotline; /* Prevent readin from asking if we want to kill the buffer. */ curbp->b_flag &= ~BFCHG; - if (readin(bp->b_fname)) + if (readin(curbp->b_fname)) return(setlineno(lineno)); return (FALSE); } |