diff options
Diffstat (limited to 'usr.bin/mg/buffer.c')
-rw-r--r-- | usr.bin/mg/buffer.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/usr.bin/mg/buffer.c b/usr.bin/mg/buffer.c index b4023b9e792..c33abfedddd 100644 --- a/usr.bin/mg/buffer.c +++ b/usr.bin/mg/buffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: buffer.c,v 1.26 2002/03/11 13:02:56 vincent Exp $ */ +/* $OpenBSD: buffer.c,v 1.27 2002/03/16 04:17:36 vincent Exp $ */ /* * Buffer handling. @@ -10,6 +10,22 @@ static BUFFER *makelist(void); +int +togglereadonly(void) +{ + if (!(curbp->b_flag & BFREADONLY)) { + curbp->b_flag |= BFREADONLY; + ewprintf("Now readonly"); + } else { + curbp->b_flag &=~ BFREADONLY; + if (curbp->b_flag & BFCHG) + ewprintf("Warning: Buffer was modified"); + } + curwp->w_flag |= WFMODE; + + return(1); +} + /* * Attach a buffer to a window. The values of dot and mark come * from the buffer if the use count is 0. Otherwise, they come @@ -161,7 +177,6 @@ killbuffer(int f, int n) free_undo_record(rec); rec = next; } - free((char *)bp->b_bname); /* Release name block */ free(bp); /* Release buffer block */ return TRUE; @@ -273,7 +288,7 @@ makelist(void) if (addlinef(blp, "%c%c%c %-*.*s%c%-6d %-*s", (bp == curbp) ? '.' : ' ', /* current buffer ? */ ((bp->b_flag & BFCHG) != 0) ? '*' : ' ', /* changed ? */ - ' ', /* no readonly buffers yet */ + ((bp->b_flag & BFREADONLY) != 0) ? ' ' : '*', w - 5, /* four chars already written */ w - 5, /* four chars already written */ bp->b_bname, /* buffer name */ |