diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2002-08-22 23:28:20 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2002-08-22 23:28:20 +0000 |
commit | 40ce67398c912ed0ce87a1dd392584d833d124b0 (patch) | |
tree | 0656de3334db4af4bb12c1740b323fab77400bfd /usr.bin/mg | |
parent | f40449884cb2307e22e88fb80855d9000a51d915 (diff) |
knf
Diffstat (limited to 'usr.bin/mg')
-rw-r--r-- | usr.bin/mg/autoexec.c | 6 | ||||
-rw-r--r-- | usr.bin/mg/display.c | 15 | ||||
-rw-r--r-- | usr.bin/mg/echo.c | 4 | ||||
-rw-r--r-- | usr.bin/mg/fileio.c | 6 | ||||
-rw-r--r-- | usr.bin/mg/help.c | 4 | ||||
-rw-r--r-- | usr.bin/mg/region.c | 10 | ||||
-rw-r--r-- | usr.bin/mg/ttyio.c | 4 | ||||
-rw-r--r-- | usr.bin/mg/undo.c | 20 |
8 files changed, 35 insertions, 34 deletions
diff --git a/usr.bin/mg/autoexec.c b/usr.bin/mg/autoexec.c index e67107ee1df..020b1b6d8d0 100644 --- a/usr.bin/mg/autoexec.c +++ b/usr.bin/mg/autoexec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: autoexec.c,v 1.1 2002/05/29 12:41:42 vincent Exp $ */ +/* $OpenBSD: autoexec.c,v 1.2 2002/08/22 23:28:19 deraadt Exp $ */ /* this file is in the public domain */ /* Author: Vincent Labrecque <vincent@openbsd.org> April 2002 */ @@ -40,7 +40,7 @@ find_autoexec(const char *fname) if (fnmatch(ae->pattern, fname, 0) == 0) { if (used >= have) { have += 8; - /* + /* * XXX - realloc(NULL, ...) is not really * portable */ @@ -90,7 +90,7 @@ auto_execute(int f, int n) { char patbuf[128], funcbuf[128]; int s; - + if ((s = ereply("Filename pattern: ", patbuf, sizeof patbuf)) != TRUE) return (s); if ((s = ereply("Execute: ", funcbuf, sizeof funcbuf)) != TRUE) diff --git a/usr.bin/mg/display.c b/usr.bin/mg/display.c index 753c7674c77..bbcd940d44b 100644 --- a/usr.bin/mg/display.c +++ b/usr.bin/mg/display.c @@ -1,4 +1,4 @@ -/* $OpenBSD: display.c,v 1.16 2002/08/22 23:21:20 vincent Exp $ */ +/* $OpenBSD: display.c,v 1.17 2002/08/22 23:28:19 deraadt Exp $ */ /* * The functions in this file handle redisplay. The @@ -295,9 +295,9 @@ vtputc(int c) vp->v_text[ncol - 1] = '$'; else if (c == '\t' #ifdef NOTAB - && !(curbp->b_flag & BFNOTAB) + && !(curbp->b_flag & BFNOTAB) #endif - ) { + ) { do { vtputc(' '); } while (vtcol < ncol && (vtcol & 0x07) != 0); @@ -308,6 +308,7 @@ vtputc(int c) vp->v_text[vtcol++] = c; else { char bf[5]; + snprintf(bf, sizeof bf, "\\%o", c); vtputs(bf); } @@ -330,9 +331,9 @@ vtpute(int c) vp->v_text[ncol - 1] = '$'; else if (c == '\t' #ifdef NOTAB - && !(curbp->b_flag & BFNOTAB) + && !(curbp->b_flag & BFNOTAB) #endif - ) { + ) { do { vtpute(' '); } while (((vtcol + lbound) & 0x07) != 0 && vtcol < ncol); @@ -772,7 +773,7 @@ modeline(MGWIN *wp) bp = wp->w_bufp; vtputc('-'); vtputc('-'); - if ((bp->b_flag & BFREADONLY) != 0) { + if ((bp->b_flag & BFREADONLY) != 0) { vtputc('%'); if ((bp->b_flag & BFCHG) != 0) vtputc('*'); @@ -781,7 +782,7 @@ modeline(MGWIN *wp) } else if ((bp->b_flag & BFCHG) != 0) { /* "*" if changed. */ vtputc('*'); vtputc('*'); - } else { + } else { vtputc('-'); vtputc('-'); } diff --git a/usr.bin/mg/echo.c b/usr.bin/mg/echo.c index 1d83d383a3e..7bce32967f9 100644 --- a/usr.bin/mg/echo.c +++ b/usr.bin/mg/echo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: echo.c,v 1.24 2002/07/03 17:25:38 vincent Exp $ */ +/* $OpenBSD: echo.c,v 1.25 2002/08/22 23:28:19 deraadt Exp $ */ /* * Echo line reading and writing. @@ -498,7 +498,7 @@ complt_list(int flags, int c, char *buf, int cpos) return FALSE; width = 0; - /* + /* * We're going to strlcat() into the buffer, so it has to be * NUL terminated */ diff --git a/usr.bin/mg/fileio.c b/usr.bin/mg/fileio.c index 5a9beb4c3db..493e2defa7f 100644 --- a/usr.bin/mg/fileio.c +++ b/usr.bin/mg/fileio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fileio.c,v 1.33 2002/07/25 16:37:54 vincent Exp $ */ +/* $OpenBSD: fileio.c,v 1.34 2002/08/22 23:28:19 deraadt Exp $ */ /* * POSIX fileio.c @@ -53,12 +53,12 @@ ffwopen(const char *fn, BUFFER *bp) ffp = NULL; ewprintf("Cannot open file for writing : %s", strerror(errno)); return (FIOERR); - } + } if ((ffp = fdopen(fd, "w")) == NULL) { ewprintf("Cannot open file for writing : %s", strerror(errno)); close(fd); - return (FIOERR); + return (FIOERR); } /* diff --git a/usr.bin/mg/help.c b/usr.bin/mg/help.c index cabbb05894b..14b00f7becc 100644 --- a/usr.bin/mg/help.c +++ b/usr.bin/mg/help.c @@ -1,4 +1,4 @@ -/* $OpenBSD: help.c,v 1.19 2002/07/01 14:33:44 vincent Exp $ */ +/* $OpenBSD: help.c,v 1.20 2002/08/22 23:28:19 deraadt Exp $ */ /* * Help functions for Mg 2 @@ -110,7 +110,7 @@ wallchart(f, n) if (bclear(bp) != TRUE) /* clear it out */ return FALSE; - bp->b_flag |= BFREADONLY; + bp->b_flag |= BFREADONLY; for (m = curbp->b_nmodes; m > 0; m--) { if ((addlinef(bp, "Local keybindings for mode %s:", curbp->b_modes[m]->p_name) == FALSE) || diff --git a/usr.bin/mg/region.c b/usr.bin/mg/region.c index af46a1205b5..a217469d915 100644 --- a/usr.bin/mg/region.c +++ b/usr.bin/mg/region.c @@ -1,4 +1,4 @@ -/* $OpenBSD: region.c,v 1.10 2002/05/29 12:44:59 vincent Exp $ */ +/* $OpenBSD: region.c,v 1.11 2002/08/22 23:28:19 deraadt Exp $ */ /* * Region based commands. @@ -102,7 +102,7 @@ lowerregion(f, n) return s; undo_add_change(region.r_linep, region.r_offset, region.r_size); - + lchange(WFHARD); linep = region.r_linep; loffs = region.r_offset; @@ -141,9 +141,9 @@ upperregion(f, n) } if ((s = getregion(®ion)) != TRUE) return s; - + undo_add_change(region.r_linep, region.r_offset, region.r_size); - + lchange(WFHARD); linep = region.r_linep; loffs = region.r_offset; @@ -331,7 +331,7 @@ region_get_data(REGION *reg, char *buf, int len) { int i, off; LINE *lp; - + i = 0; off = reg->r_offset; lp = reg->r_linep; diff --git a/usr.bin/mg/ttyio.c b/usr.bin/mg/ttyio.c index c59dd3486bf..5dd0e30a32d 100644 --- a/usr.bin/mg/ttyio.c +++ b/usr.bin/mg/ttyio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ttyio.c,v 1.21 2002/03/28 17:50:36 millert Exp $ */ +/* $OpenBSD: ttyio.c,v 1.22 2002/08/22 23:28:19 deraadt Exp $ */ /* * POSIX terminal I/O. @@ -138,7 +138,7 @@ ttflush() { ssize_t written; char *buf = obuf; - + if (nobuf == 0) return; diff --git a/usr.bin/mg/undo.c b/usr.bin/mg/undo.c index b49fc8102f8..2087c85a524 100644 --- a/usr.bin/mg/undo.c +++ b/usr.bin/mg/undo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: undo.c,v 1.12 2002/07/24 14:08:33 vincent Exp $ */ +/* $OpenBSD: undo.c,v 1.13 2002/08/22 23:28:19 deraadt Exp $ */ /* * Copyright (c) 2002 Vincent Labrecque * All rights reserved. @@ -61,7 +61,7 @@ static int drop_oldest_undo_record(void); * * Find an absolute dot in the buffer from a line/offset pair, and vice-versa. * - * Since lines can be deleted while they are referenced by undo record, we + * Since lines can be deleted while they are referenced by undo record, we * need to have an absolute dot to have something reliable. */ @@ -203,7 +203,7 @@ undo_add_boundary(void) return (TRUE); } -/* +/* * If asocial is true, we arrange for this record to be let alone. forever. * Yes, this is a bit of a hack... */ @@ -253,7 +253,7 @@ undo_add_insert(LINE *lp, int offset, int size) /* * We try to reuse the last undo record to `compress' things. - */ + */ rec = LIST_FIRST(&curbp->b_undo); if (rec != NULL) { /* this will be hit like, 80% of the time... */ @@ -385,7 +385,7 @@ undo_dump(void) num = 0; for (rec = LIST_FIRST(&curbp->b_undo); rec != NULL; - rec = LIST_NEXT(rec, next)) { + rec = LIST_NEXT(rec, next)) { num++; snprintf(buf, sizeof buf, "Record %d =>\t %s at %d ", num, @@ -424,7 +424,7 @@ undo_dump(void) * [action1] * ------ * [undo] - * + * * After another undo: * * @@ -433,7 +433,7 @@ undo_dump(void) * [action1] <--- Undoptr * ------ * [undo] - * + * * Note that the "undo of actionX" have no special meaning. Only when, * say, we undo a deletion, the insertion will be recorded just as if it * was typed on the keyboard. Resulting in the inverse operation being @@ -479,7 +479,7 @@ undo(int f, int n) break; } - /* + /* * Loop while we don't get a boundary specifying we've * finished the current action... */ @@ -515,7 +515,7 @@ undo(int f, int n) ldelete(ptr->region.r_size, KFORW); break; case DELETE: - region_put_data(ptr->content, + region_put_data(ptr->content, ptr->region.r_size); break; case BOUNDARY: @@ -540,5 +540,5 @@ undo(int f, int n) curbp->b_undopos.r_linep = curwp->w_dotp; curbp->b_undopos.r_offset = curwp->w_doto; - return (rval); + return (rval); } |