diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2001-05-24 03:05:29 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2001-05-24 03:05:29 +0000 |
commit | 0630146c228b8ba11316c38fba0e53270064e2ae (patch) | |
tree | 837f20d9f80ab1bb97fa8f26aab6c5df362d40a3 | |
parent | 8d62d06e90311aab0fcc0e3574e76919c43dcc94 (diff) |
spaces
-rw-r--r-- | usr.bin/mg/README | 4 | ||||
-rw-r--r-- | usr.bin/mg/buffer.c | 4 | ||||
-rw-r--r-- | usr.bin/mg/def.h | 110 | ||||
-rw-r--r-- | usr.bin/mg/dir.c | 12 | ||||
-rw-r--r-- | usr.bin/mg/dired.c | 36 | ||||
-rw-r--r-- | usr.bin/mg/display.c | 164 | ||||
-rw-r--r-- | usr.bin/mg/extend.c | 62 | ||||
-rw-r--r-- | usr.bin/mg/file.c | 54 | ||||
-rw-r--r-- | usr.bin/mg/fileio.c | 91 | ||||
-rw-r--r-- | usr.bin/mg/help.c | 6 | ||||
-rw-r--r-- | usr.bin/mg/kbd.c | 22 | ||||
-rw-r--r-- | usr.bin/mg/kbd.h | 32 | ||||
-rw-r--r-- | usr.bin/mg/line.c | 96 | ||||
-rw-r--r-- | usr.bin/mg/macro.c | 4 | ||||
-rw-r--r-- | usr.bin/mg/macro.h | 6 | ||||
-rw-r--r-- | usr.bin/mg/main.c | 8 | ||||
-rw-r--r-- | usr.bin/mg/match.c | 18 | ||||
-rw-r--r-- | usr.bin/mg/modes.c | 12 | ||||
-rw-r--r-- | usr.bin/mg/paragraph.c | 24 | ||||
-rw-r--r-- | usr.bin/mg/random.c | 88 | ||||
-rw-r--r-- | usr.bin/mg/re_search.c | 46 | ||||
-rw-r--r-- | usr.bin/mg/region.c | 36 | ||||
-rw-r--r-- | usr.bin/mg/search.c | 46 | ||||
-rw-r--r-- | usr.bin/mg/spawn.c | 6 | ||||
-rw-r--r-- | usr.bin/mg/sysdef.h | 12 | ||||
-rw-r--r-- | usr.bin/mg/tty.c | 56 | ||||
-rw-r--r-- | usr.bin/mg/ttyio.c | 6 | ||||
-rw-r--r-- | usr.bin/mg/ttykbd.c | 4 | ||||
-rw-r--r-- | usr.bin/mg/tutorial | 24 | ||||
-rw-r--r-- | usr.bin/mg/window.c | 54 | ||||
-rw-r--r-- | usr.bin/mg/word.c | 22 |
31 files changed, 581 insertions, 584 deletions
diff --git a/usr.bin/mg/README b/usr.bin/mg/README index 3b6f8d4f1d6..0b50304ac25 100644 --- a/usr.bin/mg/README +++ b/usr.bin/mg/README @@ -7,7 +7,7 @@ portions of GNU as they are released) are essentially free, (there are handling charges for obtaining it) and so is Mg. You may never have to learn another editor. (But probably will, at least long enough to port Mg...) Mg was formerly named MicroGnuEmacs, the name change was -done at the request of Richard Stallman. +done at the request of Richard Stallman. Mg is not associated with the GNU project, and most of it does not have the copyright restrictions present in GNU Emacs. (However, some @@ -191,4 +191,4 @@ AmigaDOS format disk or a 9 track tape (Unix tar format) to: Mike Meyer P.O. Box 4730 Berkeley, CA 94704 - + diff --git a/usr.bin/mg/buffer.c b/usr.bin/mg/buffer.c index d895ddb1f58..9ffdc1cbcc4 100644 --- a/usr.bin/mg/buffer.c +++ b/usr.bin/mg/buffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: buffer.c,v 1.14 2001/05/23 22:36:13 art Exp $ */ +/* $OpenBSD: buffer.c,v 1.15 2001/05/24 03:05:20 mickey Exp $ */ /* * Buffer handling. @@ -330,7 +330,7 @@ bfind(bname, cflag) { BUFFER *bp; LINE *lp; - int i; + int i; bp = bheadp; while (bp != NULL) { diff --git a/usr.bin/mg/def.h b/usr.bin/mg/def.h index a45f59d654d..7920ba6ab64 100644 --- a/usr.bin/mg/def.h +++ b/usr.bin/mg/def.h @@ -1,4 +1,4 @@ -/* $OpenBSD: def.h,v 1.17 2001/05/23 23:29:47 mickey Exp $ */ +/* $OpenBSD: def.h,v 1.18 2001/05/24 03:05:20 mickey Exp $ */ /* * This file is the general header file for all parts @@ -19,7 +19,7 @@ #endif #endif -typedef int (*PF)(); /* generally useful type */ +typedef int (*PF)(); /* generally useful type */ /* * Table sizes, etc. @@ -116,14 +116,14 @@ typedef int (*PF)(); /* generally useful type */ * list of marks into the line. */ typedef struct LINE { - struct LINE *l_fp; /* Link to the next line */ - struct LINE *l_bp; /* Link to the previous line */ - int l_size; /* Allocated size */ - int l_used; /* Used size */ + struct LINE *l_fp; /* Link to the next line */ + struct LINE *l_bp; /* Link to the previous line */ + int l_size; /* Allocated size */ + int l_used; /* Used size */ #ifndef ZEROARRAY - char l_text[1]; /* A bunch of chars. */ + char l_text[1]; /* A bunch of chars. */ #else - char l_text[]; /* A bunch of chars. */ + char l_text[]; /* A bunch of chars. */ #endif } LINE; @@ -153,9 +153,9 @@ typedef struct LINE { */ typedef struct LIST { union { - struct MGWIN *l_wp; - struct BUFFER *x_bp; /* l_bp is used by LINE */ - struct LIST *l_nxt; + struct MGWIN *l_wp; + struct BUFFER *x_bp; /* l_bp is used by LINE */ + struct LIST *l_nxt; } l_p; char *l_name; } LIST; @@ -177,17 +177,17 @@ typedef struct LIST { * expensive to run for every input character. */ typedef struct MGWIN { - LIST w_list; /* List header */ - struct BUFFER *w_bufp; /* Buffer displayed in window */ - struct LINE *w_linep; /* Top line in the window */ - struct LINE *w_dotp; /* Line containing "." */ - struct LINE *w_markp; /* Line containing "mark" */ - int w_doto; /* Byte offset for "." */ - int w_marko; /* Byte offset for "mark" */ - char w_toprow; /* Origin 0 top row of window */ - char w_ntrows; /* # of rows of text in window */ - char w_force; /* If NZ, forcing row. */ - char w_flag; /* Flags. */ + LIST w_list; /* List header */ + struct BUFFER *w_bufp; /* Buffer displayed in window */ + struct LINE *w_linep; /* Top line in the window */ + struct LINE *w_dotp; /* Line containing "." */ + struct LINE *w_markp; /* Line containing "mark" */ + int w_doto; /* Byte offset for "." */ + int w_marko; /* Byte offset for "mark" */ + char w_toprow; /* Origin 0 top row of window */ + char w_ntrows; /* # of rows of text in window */ + char w_force; /* If NZ, forcing row. */ + char w_flag; /* Flags. */ } MGWIN; #define w_wndp w_list.l_p.l_wp #define w_name w_list.l_name @@ -218,19 +218,19 @@ typedef struct MGWIN { * a pointer to the header line in "b_linep". */ typedef struct BUFFER { - LIST b_list; /* buffer list pointer */ - struct BUFFER *b_altb; /* Link to alternate buffer */ - struct LINE *b_dotp; /* Link to "." LINE structure */ - struct LINE *b_markp; /* ditto for mark */ - struct LINE *b_linep; /* Link to the header LINE */ - struct MAPS_S *b_modes[PBMODES]; /* buffer modes */ - int b_doto; /* Offset of "." in above LINE */ - int b_marko; /* ditto for the "mark" */ - short b_nmodes; /* number of non-fundamental modes */ - char b_nwnd; /* Count of windows on buffer */ - char b_flag; /* Flags */ - char b_fname[NFILEN];/* File name */ - struct fileinfo b_fi; /* File attributes */ + LIST b_list; /* buffer list pointer */ + struct BUFFER *b_altb; /* Link to alternate buffer */ + struct LINE *b_dotp; /* Link to "." LINE structure */ + struct LINE *b_markp; /* ditto for mark */ + struct LINE *b_linep; /* Link to the header LINE */ + struct MAPS_S *b_modes[PBMODES]; /* buffer modes */ + int b_doto; /* Offset of "." in above LINE */ + int b_marko; /* ditto for the "mark" */ + short b_nmodes; /* number of non-fundamental modes */ + char b_nwnd; /* Count of windows on buffer */ + char b_flag; /* Flags */ + char b_fname[NFILEN];/* File name */ + struct fileinfo b_fi; /* File attributes */ } BUFFER; #define b_bufp b_list.l_p.x_bp #define b_bname b_list.l_name @@ -249,9 +249,9 @@ typedef struct BUFFER { * of a region around a little bit easier. */ typedef struct { - struct LINE *r_linep; /* Origin LINE address. */ - int r_offset; /* Origin LINE offset. */ - RSIZE r_size; /* Length in characters. */ + struct LINE *r_linep; /* Origin LINE address. */ + int r_offset; /* Origin LINE offset. */ + RSIZE r_size; /* Length in characters. */ } REGION; /* @@ -314,19 +314,19 @@ int filesave __P((int, int)); int buffsave __P((BUFFER *)); int makebkfile __P((int, int)); int writeout __P((BUFFER *, char *)); -void upmodes __P((BUFFER *)); +void upmodes __P((BUFFER *)); /* line.c X */ -LINE *lalloc __P((int)); -LINE *lallocx __P((int)); +LINE *lalloc __P((int)); +LINE *lallocx __P((int)); void lfree __P((LINE *)); -void lchange __P((int)); +void lchange __P((int)); int linsert __P((int, int)); int lnewline __P((void)); int ldelete __P((RSIZE, int)); -int ldelnewline __P((void)); +int ldelnewline __P((void)); int lreplace __P((RSIZE, char *, int)); -void kdelete __P((void)); +void kdelete __P((void)); int kinsert __P((int, int)); int kremove __P((int)); @@ -360,15 +360,15 @@ int notmodified __P((int, int)); int popbuftop __P((BUFFER *)); /* display.c */ -void vtinit __P((void)); -void vttidy __P((void)); -void update __P((void)); +void vtinit __P((void)); +void vttidy __P((void)); +void update __P((void)); /* echo.c X */ void eerase __P((void)); int eyorn __P((char *)); int eyesno __P((char *)); -void ewprintf __P((const char *fmt, ...)); +void ewprintf __P((const char *fmt, ...)); int ereply __P((const char *, char *, int, ...)); int eread __P((const char *, char *, int, int, ...)); int getxtra __P((LIST *, LIST *, int, int)); @@ -380,13 +380,13 @@ int ffwopen __P((char *, BUFFER *)); int ffclose __P((BUFFER *)); int ffputbuf __P((BUFFER *)); int ffgetline __P((char *, int, int *)); -int fbackupfile __P((char *)); -char *adjustname __P((char *)); -char *startupfile __P((char *)); -int copy __P((char *, char *)); +int fbackupfile __P((char *)); +char *adjustname __P((char *)); +char *startupfile __P((char *)); +int copy __P((char *, char *)); BUFFER *dired_ __P((char *)); int d_makename __P((LINE *, char *)); -LIST *make_file_list __P((char *)); +LIST *make_file_list __P((char *)); /* keymap.c X */ LIST *complete_function_list __P((char *, int)); @@ -409,10 +409,10 @@ int ctrlg __P((int, int)); int quit __P((int, int)); /* ttyio.c */ -void panic __P((char *)); +void panic __P((char *)); /* cinfo.c */ -char *keyname __P((char *, size_t, int)); +char *keyname __P((char *, size_t, int)); /* basic.c */ int gotobol __P((int, int)); diff --git a/usr.bin/mg/dir.c b/usr.bin/mg/dir.c index a0251f55be7..b8f656c1ae3 100644 --- a/usr.bin/mg/dir.c +++ b/usr.bin/mg/dir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dir.c,v 1.5 2001/05/23 22:20:35 art Exp $ */ +/* $OpenBSD: dir.c,v 1.6 2001/05/24 03:05:21 mickey Exp $ */ /* * Name: MG 2a @@ -10,8 +10,8 @@ #include "def.h" #ifndef NO_DIR -char *wdir; -static char cwd[NFILEN]; +char *wdir; +static char cwd[NFILEN]; /* * Initialize anything the directory management routines need @@ -30,10 +30,10 @@ dirinit() /* ARGSUSED */ int changedir(f, n) - int f, n; + int f, n; { - int s; - char bufc[NPAT]; + int s; + char bufc[NPAT]; if ((s = ereply("Change default directory: ", bufc, NPAT)) != TRUE) return (s); diff --git a/usr.bin/mg/dired.c b/usr.bin/mg/dired.c index 7c530a8ab8a..2371b3b55ec 100644 --- a/usr.bin/mg/dired.c +++ b/usr.bin/mg/dired.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dired.c,v 1.6 2001/01/29 01:58:06 niklas Exp $ */ +/* $OpenBSD: dired.c,v 1.7 2001/05/24 03:05:21 mickey Exp $ */ /* dired module for mg 2a */ /* by Robert A. Larson */ @@ -10,9 +10,9 @@ /* ARGSUSED */ int dired(f, n) - int f, n; + int f, n; { - char dirname[NFILEN]; + char dirname[NFILEN]; BUFFER *bp; dirname[0] = '\0'; @@ -27,11 +27,11 @@ dired(f, n) /* ARGSUSED */ int d_otherwindow(f, n) - int f, n; + int f, n; { - char dirname[NFILEN]; - BUFFER *bp; - MGWIN *wp; + char dirname[NFILEN]; + BUFFER *bp; + MGWIN *wp; dirname[0] = '\0'; if (eread("Dired other window: ", dirname, NFILEN, EFNEW | EFCR) == ABORT) @@ -107,8 +107,8 @@ d_findfile(f, n) int f, n; { BUFFER *bp; - int s; - char fname[NFILEN]; + int s; + char fname[NFILEN]; if ((s = d_makename(curwp->w_dotp, fname)) == ABORT) return FALSE; @@ -125,10 +125,10 @@ d_findfile(f, n) /* ARGSUSED */ int d_ffotherwindow(f, n) - int f, n; + int f, n; { - char fname[NFILEN]; - int s; + char fname[NFILEN]; + int s; BUFFER *bp; MGWIN *wp; @@ -148,10 +148,10 @@ d_ffotherwindow(f, n) /* ARGSUSED */ int d_expunge(f, n) - int f, n; + int f, n; { - LINE *lp, *nlp; - char fname[NFILEN]; + LINE *lp, *nlp; + char fname[NFILEN]; for (lp = lforw(curbp->b_linep); lp != curbp->b_linep; lp = nlp) { nlp = lforw(lp); @@ -184,10 +184,10 @@ d_expunge(f, n) /* ARGSUSED */ int d_copy(f, n) - int f, n; + int f, n; { - char frname[NFILEN], toname[NFILEN]; - int stat; + char frname[NFILEN], toname[NFILEN]; + int stat; if (d_makename(curwp->w_dotp, frname) != FALSE) { ewprintf("Not a file"); diff --git a/usr.bin/mg/display.c b/usr.bin/mg/display.c index 1154949ecb5..c8212f1c2a8 100644 --- a/usr.bin/mg/display.c +++ b/usr.bin/mg/display.c @@ -1,4 +1,4 @@ -/* $OpenBSD: display.c,v 1.5 2001/05/23 22:20:35 art Exp $ */ +/* $OpenBSD: display.c,v 1.6 2001/05/24 03:05:22 mickey Exp $ */ /* * The functions in this file handle redisplay. The @@ -40,11 +40,11 @@ * used if "ncol" isn't the same as "NCOL". */ typedef struct { - short v_hash; /* Hash code, for compares. */ - short v_flag; /* Flag word. */ - short v_color; /* Color of the line. */ - XSHORT v_cost; /* Cost of display. */ - char v_text[NCOL]; /* The actual characters. */ + short v_hash; /* Hash code, for compares. */ + short v_flag; /* Flag word. */ + short v_color; /* Color of the line. */ + XSHORT v_cost; /* Cost of display. */ + char v_text[NCOL]; /* The actual characters. */ } VIDEO; #define VFCHG 0x0001 /* Changed. */ @@ -60,41 +60,41 @@ typedef struct { * this makes the code worse on the VAX. */ typedef struct { - XCHAR s_itrace; /* "i" index for track back. */ - XCHAR s_jtrace; /* "j" index for trace back. */ - XSHORT s_cost; /* Display cost. */ + XCHAR s_itrace; /* "i" index for track back. */ + XCHAR s_jtrace; /* "j" index for trace back. */ + XSHORT s_cost; /* Display cost. */ } SCORE; -void vtmove __P((int, int)); -void vtputc __P((int)); -void vtpute __P((int)); -int vtputs __P((char *)); -void vteeol __P((void)); -void updext __P((int, int)); -void modeline __P((MGWIN *)); -void setscores __P((int, int)); -void traceback __P((int, int, int, int)); -void ucopy __P((VIDEO *, VIDEO *)); -void uline __P((int, VIDEO *, VIDEO *)); -void hash __P((VIDEO *)); - - -int sgarbf = TRUE; /* TRUE if screen is garbage. */ -int vtrow = 0; /* Virtual cursor row. */ -int vtcol = 0; /* Virtual cursor column. */ -int tthue = CNONE; /* Current color. */ -int ttrow = HUGE; /* Physical cursor row. */ -int ttcol = HUGE; /* Physical cursor column. */ -int tttop = HUGE; /* Top of scroll region. */ -int ttbot = HUGE; /* Bottom of scroll region. */ -int lbound = 0; /* leftmost bound of the current line */ +void vtmove __P((int, int)); +void vtputc __P((int)); +void vtpute __P((int)); +int vtputs __P((char *)); +void vteeol __P((void)); +void updext __P((int, int)); +void modeline __P((MGWIN *)); +void setscores __P((int, int)); +void traceback __P((int, int, int, int)); +void ucopy __P((VIDEO *, VIDEO *)); +void uline __P((int, VIDEO *, VIDEO *)); +void hash __P((VIDEO *)); + + +int sgarbf = TRUE; /* TRUE if screen is garbage. */ +int vtrow = 0; /* Virtual cursor row. */ +int vtcol = 0; /* Virtual cursor column. */ +int tthue = CNONE; /* Current color. */ +int ttrow = HUGE; /* Physical cursor row. */ +int ttcol = HUGE; /* Physical cursor column. */ +int tttop = HUGE; /* Top of scroll region. */ +int ttbot = HUGE; /* Bottom of scroll region. */ +int lbound = 0; /* leftmost bound of the current line */ /* being displayed */ -VIDEO *vscreen[NROW - 1]; /* Edge vector, virtual. */ -VIDEO *pscreen[NROW - 1]; /* Edge vector, physical. */ -VIDEO video[2 * (NROW - 1)]; /* Actual screen data. */ -VIDEO blanks; /* Blank line image. */ +VIDEO *vscreen[NROW - 1]; /* Edge vector, virtual. */ +VIDEO *pscreen[NROW - 1]; /* Edge vector, physical. */ +VIDEO video[2 * (NROW - 1)]; /* Actual screen data. */ +VIDEO blanks; /* Blank line image. */ #ifdef GOSLING /* @@ -121,8 +121,8 @@ SCORE score[NROW * NROW]; void vtinit() { - VIDEO *vp; - int i; + VIDEO *vp; + int i; ttopen(); ttinit(); @@ -188,9 +188,9 @@ vtmove(row, col) */ void vtputc(c) - int c; + int c; { - VIDEO *vp; + VIDEO *vp; vp = vscreen[vtrow]; if (vtcol >= ncol) @@ -217,7 +217,7 @@ vtputc(c) */ void vtpute(c) - int c; + int c; { VIDEO *vp; @@ -271,18 +271,17 @@ vteeol() void update() { - LINE *lp; - MGWIN *wp; - VIDEO *vp1; - VIDEO *vp2; - int i; - int j; - int c; - int hflag; - int currow; - int curcol; - int offs; - int size; + LINE *lp; + MGWIN *wp; + VIDEO *vp1; + VIDEO *vp2; + int i, j; + int c; + int hflag; + int currow; + int curcol; + int offs; + int size; if (typeahead()) return; @@ -521,10 +520,10 @@ ucopy(vvp, pvp) */ void updext(currow, curcol) - int currow, curcol; + int currow, curcol; { - LINE *lp; /* pointer to current line */ - int j; /* index into line */ + LINE *lp; /* pointer to current line */ + int j; /* index into line */ /* * calculate what column the left bound should be @@ -554,9 +553,9 @@ updext(currow, curcol) */ void uline(row, vvp, pvp) - int row; - VIDEO *vvp; - VIDEO *pvp; + int row; + VIDEO *vvp; + VIDEO *pvp; { #ifdef MEMMAP putline(row + 1, 1, &vvp->v_text[0]); @@ -566,7 +565,7 @@ uline(row, vvp, pvp) char *cp3; char *cp4; char *cp5; - int nbflag; + int nbflag; if (vvp->v_color != pvp->v_color) { /* Wrong color, do a */ ttmove(row, 0); /* full redraw. */ @@ -653,9 +652,9 @@ void modeline(wp) MGWIN *wp; { - int n; + int n; BUFFER *bp; - int mode; + int mode; n = wp->w_toprow + wp->w_ntrows; /* Location. */ vscreen[n]->v_color = CMODE; /* Mode line color. */ @@ -703,7 +702,7 @@ int vtputs(s) char *s; { - int n = 0; + int n = 0; while (*s != '\0') { vtputc(*s++); @@ -725,8 +724,8 @@ void hash(vp) VIDEO *vp; { - int i; - int n; + int i; + int n; char *s; if ((vp->v_flag & VFHBAD) != 0) { /* Hash bad. */ @@ -776,14 +775,13 @@ setscores(offs, size) int offs; int size; { - SCORE *sp; - SCORE *sp1; - int tempcost; - int bestcost; - int j; - int i; - VIDEO **vp, **pp; - VIDEO **vbase, **pbase; + SCORE *sp; + SCORE *sp1; + int tempcost; + int bestcost; + int j, i; + VIDEO **vp, **pp; + VIDEO **vbase, **pbase; vbase = &vscreen[offs - 1]; /* By hand CSE's. */ pbase = &pscreen[offs - 1]; @@ -863,17 +861,17 @@ setscores(offs, size) */ void traceback(offs, size, i, j) - int offs; - int size; - int i; - int j; + int offs; + int size; + int i; + int j; { - int itrace; - int jtrace; - int k; - int ninsl; - int ndraw; - int ndell; + int itrace; + int jtrace; + int k; + int ninsl; + int ndraw; + int ndell; if (i == 0 && j == 0) /* End of update. */ return; diff --git a/usr.bin/mg/extend.c b/usr.bin/mg/extend.c index 9a0723d4420..d24770dc2f6 100644 --- a/usr.bin/mg/extend.c +++ b/usr.bin/mg/extend.c @@ -1,4 +1,4 @@ -/* $OpenBSD: extend.c,v 1.14 2001/05/23 23:29:47 mickey Exp $ */ +/* $OpenBSD: extend.c,v 1.15 2001/05/24 03:05:22 mickey Exp $ */ /* * Extended (M-X) commands, rebinding, and startup file processing. @@ -28,8 +28,8 @@ static char *skipwhite __P((char *)); static char *parsetoken __P((char *)); static int bindkey __P((KEYMAP **, char *, KCHAR *, int)); -/* - * Insert a string, mainly for use from macros (created by selfinsert) +/* + * Insert a string, mainly for use from macros (created by selfinsert) */ /* ARGSUSED */ int @@ -84,10 +84,10 @@ insert(f, n) */ static int remap(curmap, c, funct, pref_map) - KEYMAP *curmap; /* pointer to the map being changed */ - int c; /* character being changed */ - PF funct; /* function being changed to */ - KEYMAP *pref_map; /* if funct==NULL, map to bind to or + KEYMAP *curmap; /* pointer to the map being changed */ + int c; /* character being changed */ + PF funct; /* function being changed to */ + KEYMAP *pref_map; /* if funct==NULL, map to bind to or NULL for new */ { int i, n1, n2, nold; @@ -190,7 +190,7 @@ remap(curmap, c, funct, pref_map) ele->k_prefmap = pref_map; else { if (!(mp = malloc(sizeof(KEYMAP) + - (MAPINIT - 1) * + (MAPINIT - 1) * sizeof(MAP_ELEMENT)))) { ewprintf("Out of memory"); ele->k_funcp[c - ele->k_base] = @@ -215,7 +215,7 @@ remap(curmap, c, funct, pref_map) if (curmap->map_num >= curmap->map_max && (curmap = realocmap(curmap)) == NULL) return FALSE; - if ((pfp = malloc((ele->k_num - c + !n2) * + if ((pfp = malloc((ele->k_num - c + !n2) * sizeof(PF))) == NULL) { ewprintf("Out of memory"); return FALSE; @@ -266,7 +266,7 @@ realocmap(curmap) int i; if ((mp = (KEYMAP *)malloc((unsigned)(sizeof(KEYMAP) + - (curmap->map_max + (MAPGROW - 1)) * + (curmap->map_max + (MAPGROW - 1)) * sizeof(MAP_ELEMENT)))) == NULL) { ewprintf("Out of memory"); return NULL; @@ -317,9 +317,9 @@ fixmap(curmap, mp, mt) */ static int dobind(curmap, p, unbind) - KEYMAP *curmap; - char *p; - int unbind; + KEYMAP *curmap; + char *p; + int unbind; { KEYMAP *pref_map = NULL; PF funct; @@ -381,18 +381,18 @@ dobind(curmap, p, unbind) } /* - * bindkey: bind key sequence to a function in the specified map. Used by - * excline so it can bind function keys. To close to release to change - * calling sequence, should just pass KEYMAP *curmap rather than + * bindkey: bind key sequence to a function in the specified map. Used by + * excline so it can bind function keys. To close to release to change + * calling sequence, should just pass KEYMAP *curmap rather than * KEYMAP **mapp. */ #ifdef BINDKEY static int bindkey(mapp, fname, keys, kcount) - KEYMAP **mapp; - char *fname; - KCHAR *keys; - int kcount; + KEYMAP **mapp; + char *fname; + KCHAR *keys; + int kcount; { KEYMAP *curmap = *mapp; KEYMAP *pref_map = NULL; @@ -484,7 +484,7 @@ int localbind(f, n) int f, n; { - return dobind(curbp->b_modes[curbp->b_nmodes]->p_map, + return dobind(curbp->b_modes[curbp->b_nmodes]->p_map, "Local set key: ", FALSE); } @@ -526,9 +526,9 @@ localunbind(f, n) } /* - * Extended command. Call the message line routine to read in the command - * name and apply autocompletion to it. When it comes back, look the name - * up in the symbol table and run the command if it is found. Print an + * Extended command. Call the message line routine to read in the command + * name and apply autocompletion to it. When it comes back, look the name + * up in the symbol table and run the command if it is found. Print an * error if there is anything wrong. */ int @@ -594,7 +594,7 @@ evalexpr(f, n) } /* - * evalbuffer - evaluate the current buffer as line commands. Useful for + * evalbuffer - evaluate the current buffer as line commands. Useful for * testing startup files. */ /* ARGSUSED */ @@ -671,8 +671,8 @@ load(fname) } /* - * excline - run a line from a load file or eval-expression. if FKEYS is - * defined, duplicate functionallity of dobind so function key values don't + * excline - run a line from a load file or eval-expression. if FKEYS is + * defined, duplicate functionallity of dobind so function key values don't * have to fit in type char. */ int @@ -815,7 +815,7 @@ excline(line) case '6': case '7': c = *argp - '0'; - if (argp[1] <= '7' && + if (argp[1] <= '7' && argp[1] >= '0') { c <<= 3; c += *++argp - '0'; @@ -941,9 +941,9 @@ parsetoken(s) *s = '\0'; } else do { - /* - * Strings get special treatment. - * Beware: You can \ out the end of the string! + /* + * Strings get special treatment. + * Beware: You can \ out the end of the string! */ if (*s == '\\') ++s; diff --git a/usr.bin/mg/file.c b/usr.bin/mg/file.c index 99cf89ed4e5..ba28ad89818 100644 --- a/usr.bin/mg/file.c +++ b/usr.bin/mg/file.c @@ -1,4 +1,4 @@ -/* $OpenBSD: file.c,v 1.8 2001/05/23 22:36:14 art Exp $ */ +/* $OpenBSD: file.c,v 1.9 2001/05/24 03:05:22 mickey Exp $ */ /* * File commands. @@ -27,9 +27,9 @@ fileinsert(f, n) } /* - * Select a file for editing. Look around to see if you can find the file + * Select a file for editing. Look around to see if you can find the file * in another buffer; if you can find it, just switch to the buffer. If - * you cannot find the file, create a new buffer, read in the text, and + * you cannot find the file, create a new buffer, read in the text, and * switch to the new buffer. */ /* ARGSUSED */ @@ -111,9 +111,9 @@ findbuffer(fname) } /* - * Read the file "fname" into the current buffer. Make all of the text - * in the buffer go away, after checking for unsaved changes. This is - * called by the "read" command, the "visit" command, and the mainline + * Read the file "fname" into the current buffer. Make all of the text + * in the buffer go away, after checking for unsaved changes. This is + * called by the "read" command, the "visit" command, and the mainline * (for "uemacs file"). */ int @@ -149,16 +149,16 @@ readin(fname) */ /* - * Insert a file in the current buffer, after dot. Set mark at the end of - * the text inserted; point at the beginning. Return a standard status. - * Print a summary (lines read, error message) out as well. If the BACKUP - * conditional is set, then this routine also does the read end of backup - * processing. The BFBAK flag, if set in a buffer, says that a backup - * should be taken. It is set when a file is read in, but not on a new + * Insert a file in the current buffer, after dot. Set mark at the end of + * the text inserted; point at the beginning. Return a standard status. + * Print a summary (lines read, error message) out as well. If the BACKUP + * conditional is set, then this routine also does the read end of backup + * processing. The BFBAK flag, if set in a buffer, says that a backup + * should be taken. It is set when a file is read in, but not on a new * file. (You don't need to make a backup copy of nothing.) */ -static char *line = NULL; -static int linesize = 0; +static char *line = NULL; +static int linesize = 0; int insertfile(fname, newname, needinfo) @@ -232,8 +232,8 @@ doneread: break; case FIOLONG:{ /* a line too long to fit in our buffer */ - char *cp; - int newsize; + char *cp; + int newsize; newsize = linesize * 2; if (newsize < 0 || @@ -246,7 +246,7 @@ doneread: bcopy(line, cp, linesize); free(line); line = cp; - s = ffgetline(line + linesize, linesize, + s = ffgetline(line + linesize, linesize, &nbytes); nbytes += linesize; linesize = newsize; @@ -319,8 +319,8 @@ out: lp2 = NULL; } /* - * Ask for a file name and write the contents of the current buffer to that - * file. Update the remembered file name and clear the buffer changed flag. + * Ask for a file name and write the contents of the current buffer to that + * file. Update the remembered file name and clear the buffer changed flag. * This handling of file names is different from the earlier versions and * is more compatable with Gosling EMACS than with ITS EMACS. */ @@ -358,7 +358,7 @@ filewrite(f, n) #ifndef MAKEBACKUP #define MAKEBACKUP TRUE #endif /* !MAKEBACKUP */ -static int makebackup = MAKEBACKUP; +static int makebackup = MAKEBACKUP; #endif /* !NO_BACKUP */ /* ARGSUSED */ @@ -370,11 +370,11 @@ filesave(f, n) } /* - * Save the contents of the buffer argument into its associated file. Do - * nothing if there have been no changes (is this a bug, or a feature?). - * Error if there is no remembered file name. If this is the first write + * Save the contents of the buffer argument into its associated file. Do + * nothing if there have been no changes (is this a bug, or a feature?). + * Error if there is no remembered file name. If this is the first write * since the read or visit, then a backup copy of the file is made. - * Allow user to select whether or not to make backup files by looking at + * Allow user to select whether or not to make backup files by looking at * the value of makebackup. */ int @@ -402,7 +402,7 @@ buffsave(bp) if (s == ABORT) return FALSE; /* softer error */ - if (s == FALSE && + if (s == FALSE && (s = eyesno("Backup error, save anyway")) != TRUE) return s; } @@ -450,8 +450,8 @@ makebkfile(f, n) */ /* - * This function performs the details of file writing; writing the file - * in buffer bp to file fn. Uses the file management routines in the + * This function performs the details of file writing; writing the file + * in buffer bp to file fn. Uses the file management routines in the * "fileio.c" package. Most of the grief is checking of some sort. */ int diff --git a/usr.bin/mg/fileio.c b/usr.bin/mg/fileio.c index 4a62614de51..aaf825b441a 100644 --- a/usr.bin/mg/fileio.c +++ b/usr.bin/mg/fileio.c @@ -1,11 +1,11 @@ -/* $OpenBSD: fileio.c,v 1.15 2001/05/24 00:59:38 mickey Exp $ */ +/* $OpenBSD: fileio.c,v 1.16 2001/05/24 03:05:22 mickey Exp $ */ /* * POSIX fileio.c */ #include "def.h" -static FILE *ffp; +static FILE *ffp; #include <sys/types.h> #include <sys/stat.h> @@ -19,10 +19,10 @@ static FILE *ffp; */ int ffropen(fn, bp) - char *fn; - BUFFER *bp; + char *fn; + BUFFER *bp; { - struct stat statbuf; + struct stat statbuf; if ((ffp = fopen(fn, "r")) == NULL) return (FIOFNF); @@ -125,12 +125,11 @@ ffputbuf(bp) */ int ffgetline(buf, nbuf, nbytes) - char *buf; - int nbuf; - int *nbytes; + char *buf; + int nbuf; + int *nbytes; { - int c; - int i; + int c, i; i = 0; while ((c = getc(ffp)) != EOF && c != '\n') { @@ -159,12 +158,12 @@ int fbackupfile(fn) char *fn; { - struct stat sb; - int from, to, serrno; - size_t nread; - size_t len; - char buf[BUFSIZ]; - char *nname; + struct stat sb; + int from, to, serrno; + size_t nread; + size_t len; + char buf[BUFSIZ]; + char *nname; len = strlen(fn); if ((nname = malloc(len + 1 + 1)) == NULL) { @@ -220,20 +219,20 @@ fbackupfile(fn) #endif #include <pwd.h> #ifndef NO_DIR -extern char *wdir; +extern char *wdir; #endif char * adjustname(fn) - char *fn; + char *fn; { - char *cp; - static char fnb[NFILEN]; - struct passwd *pwent; + char *cp; + static char fnb[NFILEN]; + struct passwd *pwent; #ifdef SYMBLINK - struct stat statbuf; - int i, j; - char linkbuf[NFILEN]; + struct stat statbuf; + int i, j; + char linkbuf[NFILEN]; #endif switch (*fn) { @@ -348,10 +347,10 @@ adjustname(fn) */ char * startupfile(suffix) - char *suffix; + char *suffix; { - static char file[NFILEN]; - char *home; + static char file[NFILEN]; + char *home; if ((home = getenv("HOME")) == NULL || *home == '\0') goto nohome; @@ -393,11 +392,11 @@ nohome: int copy(frname, toname) - char *frname; - char *toname; + char *frname; + char *toname; { - pid_t pid; - int status; + pid_t pid; + int status; if ((pid = vfork())) { if (pid == -1) @@ -411,11 +410,11 @@ copy(frname, toname) BUFFER * dired_(dirname) - char *dirname; + char *dirname; { - BUFFER *bp; - FILE *dirpipe; - char line[256]; + BUFFER *bp; + FILE *dirpipe; + char line[256]; int len; if ((dirname = adjustname(dirname)) == NULL) { @@ -480,8 +479,8 @@ d_makename(lp, fn) #endif /* NO_DIRED */ struct filelist { - LIST fl_l; - char fl_name[NFILEN + 2]; + LIST fl_l; + char fl_name[NFILEN + 2]; }; /* @@ -490,17 +489,17 @@ struct filelist { LIST * make_file_list(buf) - char *buf; + char *buf; { - char *dir, *file, *cp; - int len, preflen; - DIR *dirp; - struct dirent *dent; - LIST *last; + char *dir, *file, *cp; + int len, preflen; + DIR *dirp; + struct dirent *dent; + LIST *last; struct filelist *current; - char prefixx[NFILEN + 1]; - struct stat statbuf; - char statname[NFILEN + 2]; + char prefixx[NFILEN + 1]; + struct stat statbuf; + char statname[NFILEN + 2]; /* * We need three different strings: dir - the name of the directory diff --git a/usr.bin/mg/help.c b/usr.bin/mg/help.c index ffb4a9ff126..a61e07a8162 100644 --- a/usr.bin/mg/help.c +++ b/usr.bin/mg/help.c @@ -1,7 +1,7 @@ -/* $OpenBSD: help.c,v 1.11 2001/05/23 23:29:47 mickey Exp $ */ +/* $OpenBSD: help.c,v 1.12 2001/05/24 03:05:23 mickey Exp $ */ /* - * Help functions for Mg 2 + * Help functions for Mg 2 */ #include "def.h" @@ -230,6 +230,6 @@ findbind(KEYMAP *map, PF fun, char *buf, size_t len) } } - return FALSE; + return FALSE; } #endif /* !NO_HELP */ diff --git a/usr.bin/mg/kbd.c b/usr.bin/mg/kbd.c index 87772f9eebc..0cd3f1dd4fe 100644 --- a/usr.bin/mg/kbd.c +++ b/usr.bin/mg/kbd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kbd.c,v 1.9 2001/05/23 23:29:48 mickey Exp $ */ +/* $OpenBSD: kbd.c,v 1.10 2001/05/24 03:05:23 mickey Exp $ */ /* * Terminal independent keyboard handling. @@ -66,7 +66,7 @@ bsmap(f, n) void ungetkey(c) - int c; + int c; { #ifdef DO_METAKEY if (use_metakey && pushed && c == CCHR('[')) @@ -133,9 +133,9 @@ getkey(flag) */ PF doscan(map, c, newmap) - KEYMAP *map; - int c; - KEYMAP **newmap; + KEYMAP *map; + int c; + KEYMAP **newmap; { MAP_ELEMENT *elec = &map->map_element[0]; MAP_ELEMENT *last = &map->map_element[map->map_num]; @@ -192,7 +192,7 @@ rescan(f, n) c = TOLOWER(key.k_chars[key.k_count - 1]); curmap = curbp->b_modes[mode]->p_map; for (i = 0; i < key.k_count - 1; i++) { - if ((fp = doscan(curmap, (key.k_chars[i]), &curmap)) + if ((fp = doscan(curmap, (key.k_chars[i]), &curmap)) != NULL) break; } @@ -205,7 +205,7 @@ rescan(f, n) if (fp != rescan) { #ifndef NO_MACRO if (macrodef && macrocount <= MAXMACRO) - macro[macrocount - 1].m_funct + macro[macrocount - 1].m_funct = fp; #endif /* !NO_MACRO */ return (*fp)(f, n); @@ -221,7 +221,7 @@ rescan(f, n) break; } if (fp == NULL) { - while ((fp = doscan(curmap, key.k_chars[i++] = + while ((fp = doscan(curmap, key.k_chars[i++] = getkey(TRUE), &curmap)) == NULL) /*nothing*/; key.k_count = i; @@ -242,7 +242,7 @@ universal_argument(f, n) { KEYMAP *curmap; PF funct; - int c; + int c; int nn = 4; if (f & FFUNIV) @@ -381,9 +381,9 @@ selfinsert(f, n) lp->l_fp = maclcur->l_fp; lp->l_bp = maclcur->l_bp; lp->l_fp->l_bp = lp->l_bp->l_fp = lp; - bcopy(maclcur->l_text, lp->l_text, + bcopy(maclcur->l_text, lp->l_text, maclcur->l_used); - for (count = maclcur->l_used; + for (count = maclcur->l_used; count < lp->l_used; count++) lp->l_text[count] = c; free((char *)maclcur); diff --git a/usr.bin/mg/kbd.h b/usr.bin/mg/kbd.h index 62ff514cd0f..33dc4f81cdc 100644 --- a/usr.bin/mg/kbd.h +++ b/usr.bin/mg/kbd.h @@ -1,13 +1,13 @@ -/* $OpenBSD: kbd.h,v 1.9 2001/05/23 22:10:43 art Exp $ */ +/* $OpenBSD: kbd.h,v 1.10 2001/05/24 03:05:23 mickey Exp $ */ /* * kbd.h: type definitions for symbol.c and kbd.c for mg experimental */ typedef struct { - KCHAR k_base; /* first key in element */ - KCHAR k_num; /* last key in element */ - PF *k_funcp; /* pointer to array of pointers + KCHAR k_base; /* first key in element */ + KCHAR k_num; /* last key in element */ + PF *k_funcp; /* pointer to array of pointers * to functions */ struct keymap_s *k_prefmap; /* keymap of ONLY prefix key in * element */ @@ -36,25 +36,25 @@ typedef struct keymap_s KEYMAPE(1) KEYMAP; #define MAPELEDEF 4 typedef struct MAPS_S { - KEYMAP *p_map; - char *p_name; + KEYMAP *p_map; + char *p_name; } MAPS; -extern MAPS map_table[]; +extern MAPS map_table[]; extern KEYMAP *fundamental_map; typedef struct { - PF n_funct; - char *n_name; + PF n_funct; + char *n_name; } FUNCTNAMES; -int dobindkey __P((KEYMAP *, char *, char *)); -KEYMAP *name_map __P((char *)); -MAPS *name_mode __P((char *)); -PF doscan __P((KEYMAP *, int, KEYMAP **)); -PF name_function __P((char *)); -char *function_name __P((PF)); -char *map_name __P((KEYMAP *)); +int dobindkey __P((KEYMAP *, char *, char *)); +KEYMAP *name_map __P((char *)); +MAPS *name_mode __P((char *)); +PF doscan __P((KEYMAP *, int, KEYMAP **)); +PF name_function __P((char *)); +char *function_name __P((PF)); +char *map_name __P((KEYMAP *)); extern MAP_ELEMENT *ele; extern MAPS *defb_modes[]; diff --git a/usr.bin/mg/line.c b/usr.bin/mg/line.c index 924c5ed928c..81267d93c5f 100644 --- a/usr.bin/mg/line.c +++ b/usr.bin/mg/line.c @@ -1,25 +1,25 @@ -/* $OpenBSD: line.c,v 1.7 2001/05/23 22:36:14 art Exp $ */ +/* $OpenBSD: line.c,v 1.8 2001/05/24 03:05:23 mickey Exp $ */ /* * Text line handling. - * + * * The functions in this file are a general set of line management - * utilities. They are the only routines that touch the text. They - * also touch the buffer and window structures to make sure that the - * necessary updating gets done. There are routines in this file that + * utilities. They are the only routines that touch the text. They + * also touch the buffer and window structures to make sure that the + * necessary updating gets done. There are routines in this file that * handle the kill buffer too. It isn't here for any good reason. * - * Note that this code only updates the dot and mark values in the window - * list. Since all the code acts on the current window, the buffer that - * we are editing must be displayed, which means that "b_nwnd" is non-zero, - * which means that the dot and mark values in the buffer headers are + * Note that this code only updates the dot and mark values in the window + * list. Since all the code acts on the current window, the buffer that + * we are editing must be displayed, which means that "b_nwnd" is non-zero, + * which means that the dot and mark values in the buffer headers are * nonsense. */ #include "def.h" /* - * The number of bytes member from the start of the structure type should be + * The number of bytes member from the start of the structure type should be * computed at compile time. */ @@ -46,7 +46,7 @@ static int kgrow __P((int)); * This routine allocates a block of memory large enough to hold a LINE * containing "used" characters. The block is rounded up to whatever * needs to be allocated. (use lallocx for lines likely to grow.) - * Return a pointer to the new block, or NULL if there isn't any memory + * Return a pointer to the new block, or NULL if there isn't any memory * left. Print a message in the message line if no space. */ LINE * @@ -91,8 +91,8 @@ lallocx(used) /* * Delete line "lp". Fix all of the links that might point to it (they are - * moved to offset 0 of the next line. Unlink the line from whatever buffer - * it might be in, and release the memory. The buffers are updated too; the + * moved to offset 0 of the next line. Unlink the line from whatever buffer + * it might be in, and release the memory. The buffers are updated too; the * magic conditions described in the above comments don't hold here. */ void @@ -132,10 +132,10 @@ lfree(lp) } /* - * This routine is called when a character changes in place in the current - * buffer. It updates all of the required flags in the buffer and window - * system. The flag used is passed as an argument; if the buffer is being - * displayed in more than 1 window we change EDIT to HARD. Set MODE if the + * This routine is called when a character changes in place in the current + * buffer. It updates all of the required flags in the buffer and window + * system. The flag used is passed as an argument; if the buffer is being + * displayed in more than 1 window we change EDIT to HARD. Set MODE if the * mode line needs to be updated (the "*" has to be set). */ void @@ -159,10 +159,10 @@ lchange(flag) } /* - * Insert "n" copies of the character "c" at the current location of dot. - * In the easy case all that happens is the text is stored in the line. - * In the hard case, the line has to be reallocated. When the window list - * is updated, take special care; I screwed it up once. You always update + * Insert "n" copies of the character "c" at the current location of dot. + * In the easy case all that happens is the text is stored in the line. + * In the hard case, the line has to be reallocated. When the window list + * is updated, take special care; I screwed it up once. You always update * dot in the current window. You update mark and a dot in another window * if it is greater than the place where you did the insert. Return TRUE * if all is well, and FALSE on errors. @@ -269,7 +269,7 @@ linsert(n, c) } /* - * Insert a newline into the buffer at the current location of dot in the + * Insert a newline into the buffer at the current location of dot in the * current window. The funny ass-backwards way is no longer used. */ int @@ -328,10 +328,10 @@ lnewline() } /* - * This function deletes "n" bytes, starting at dot. It understands how to - * deal with end of lines, etc. It returns TRUE if all of the characters - * were deleted, and FALSE if they were not (because dot ran into the end - * of the buffer. The "kflag" indicates either no insertion, or direction + * This function deletes "n" bytes, starting at dot. It understands how to + * deal with end of lines, etc. It returns TRUE if all of the characters + * were deleted, and FALSE if they were not (because dot ran into the end + * of the buffer. The "kflag" indicates either no insertion, or direction * of insertion into the kill buffer. */ int @@ -368,7 +368,7 @@ ldelete(n, kflag) /* End of buffer */ return FALSE; lchange(WFHARD); - if (ldelnewline() == FALSE || + if (ldelnewline() == FALSE || (kflag != KNONE && kinsert('\n', kflag) == FALSE)) return FALSE; --n; @@ -415,12 +415,12 @@ ldelete(n, kflag) } /* - * Delete a newline and join the current line with the next line. If the next + * Delete a newline and join the current line with the next line. If the next * line is the magic header line always return TRUE; merging the last line - * with the header line can be thought of as always being a successful - * operation. Even if nothing is done, this makes the kill buffer work - * "right". Easy cases can be done by shuffling data around. Hard cases - * require that lines be moved about in memory. Return FALSE on error and + * with the header line can be thought of as always being a successful + * operation. Even if nothing is done, this makes the kill buffer work + * "right". Easy cases can be done by shuffling data around. Hard cases + * require that lines be moved about in memory. Return FALSE on error and * TRUE if all looks ok. */ int @@ -484,16 +484,16 @@ ldelnewline() } /* - * Replace plen characters before dot with argument string. Control-J - * characters in st are interpreted as newlines. There is a casehack - * disable flag (normally it likes to match case of replacement to what + * Replace plen characters before dot with argument string. Control-J + * characters in st are interpreted as newlines. There is a casehack + * disable flag (normally it likes to match case of replacement to what * was there). */ int lreplace(plen, st, f) - RSIZE plen; /* length to remove */ - char *st; /* replacement string */ - int f; /* case hack disable */ + RSIZE plen; /* length to remove */ + char *st; /* replacement string */ + int f; /* case hack disable */ { RSIZE rlen; /* replacement length */ int rtype; /* capitalization */ @@ -501,8 +501,8 @@ lreplace(plen, st, f) int doto; /* offset into line */ /* - * Find the capitalization of the word that was found. f says use - * exact case of replacement string (same thing that happens with + * Find the capitalization of the word that was found. f says use + * exact case of replacement string (same thing that happens with * lowercase found), so bypass check. */ /* NOSTRICT */ @@ -563,8 +563,8 @@ lreplace(plen, st, f) } /* - * Delete all of the text saved in the kill buffer. Called by commands when - * a new kill context is created. The kill buffer array is released, just in + * Delete all of the text saved in the kill buffer. Called by commands when + * a new kill context is created. The kill buffer array is released, just in * case the buffer has grown to an immense size. No errors. */ void @@ -578,10 +578,10 @@ kdelete() } /* - * Insert a character to the kill buffer, enlarging the buffer if there - * isn't any room. Always grow the buffer in chunks, on the assumption - * that if you put something in the kill buffer you are going to put more - * stuff there too later. Return TRUE if all is well, and FALSE on errors. + * Insert a character to the kill buffer, enlarging the buffer if there + * isn't any room. Always grow the buffer in chunks, on the assumption + * that if you put something in the kill buffer you are going to put more + * stuff there too later. Return TRUE if all is well, and FALSE on errors. * Print a message on errors. Dir says whether to put it at back or front. */ int @@ -633,8 +633,8 @@ kgrow(back) } /* - * This function gets characters from the kill buffer. If the character - * index "n" is off the end, it returns "-1". This lets the caller just + * This function gets characters from the kill buffer. If the character + * index "n" is off the end, it returns "-1". This lets the caller just * scan along until it gets a "-1" back. */ int diff --git a/usr.bin/mg/macro.c b/usr.bin/mg/macro.c index 83e8851f043..95fde18c81f 100644 --- a/usr.bin/mg/macro.c +++ b/usr.bin/mg/macro.c @@ -1,4 +1,4 @@ -/* $OpenBSD: macro.c,v 1.4 2001/01/29 01:58:08 niklas Exp $ */ +/* $OpenBSD: macro.c,v 1.5 2001/05/24 03:05:24 mickey Exp $ */ /* * Keyboard macros. @@ -60,7 +60,7 @@ executemacro(f, n) int i, j, flag, num; PF funct; - if (macrodef || + if (macrodef || (macrocount >= MAXMACRO && macro[MAXMACRO].m_funct != finishmacro)) return FALSE; diff --git a/usr.bin/mg/macro.h b/usr.bin/mg/macro.h index ee1c5abfa1f..abfc4765b29 100644 --- a/usr.bin/mg/macro.h +++ b/usr.bin/mg/macro.h @@ -1,4 +1,4 @@ -/* $OpenBSD: macro.h,v 1.3 2001/01/29 01:58:08 niklas Exp $ */ +/* $OpenBSD: macro.h,v 1.4 2001/05/24 03:05:24 mickey Exp $ */ /* definitions for keyboard macros */ @@ -18,8 +18,8 @@ EXTERN union { int m_count; /* for count-prefix */ } macro[MAXMACRO]; -EXTERN LINE *maclhead INIT(NULL); -EXTERN LINE *maclcur; +EXTERN LINE *maclhead INIT(NULL); +EXTERN LINE *maclcur; #undef EXTERN #undef INIT diff --git a/usr.bin/mg/main.c b/usr.bin/mg/main.c index abd5c34cba0..e218b286548 100644 --- a/usr.bin/mg/main.c +++ b/usr.bin/mg/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.9 2001/05/23 23:29:48 mickey Exp $ */ +/* $OpenBSD: main.c,v 1.10 2001/05/24 03:05:24 mickey Exp $ */ /* * Mainline. @@ -23,8 +23,8 @@ static void edinit __P((void)); int main(argc, argv) - int argc; - char **argv; + int argc; + char **argv; { char *cp; @@ -139,7 +139,7 @@ quit(f, n) } /* - * User abort. Should be called by any input routine that sees a C-g to abort + * User abort. Should be called by any input routine that sees a C-g to abort * whatever C-g is aborting these days. Currently does nothing. */ /* ARGSUSED */ diff --git a/usr.bin/mg/match.c b/usr.bin/mg/match.c index 7d0656518f9..3d2c528622a 100644 --- a/usr.bin/mg/match.c +++ b/usr.bin/mg/match.c @@ -1,13 +1,13 @@ -/* $OpenBSD: match.c,v 1.6 2001/05/23 22:20:36 art Exp $ */ +/* $OpenBSD: match.c,v 1.7 2001/05/24 03:05:24 mickey Exp $ */ /* * Limited parenthesis matching routines * - * The hacks in this file implement automatic matching * of (), [], {}, and - * other characters. It would be better to have a full-blown syntax table, + * The hacks in this file implement automatic matching * of (), [], {}, and + * other characters. It would be better to have a full-blown syntax table, * but there's enough overhead in the editor as it is. * - * Since I often edit Scribe code, I've made it possible to blink arbitrary + * Since I often edit Scribe code, I've made it possible to blink arbitrary * characters -- just bind delimiter characters to "blink-matching-paren-hack" */ @@ -45,7 +45,7 @@ static struct balance { }; /* - * Hack to show matching paren. Self-insert character, then show matching + * Hack to show matching paren. Self-insert character, then show matching * character, if any. Bound to "blink-matching-paren-command". */ int @@ -81,7 +81,7 @@ balance() int cbo; int c; int i; - int rbal; + int rbal; int lbal; int depth; @@ -140,8 +140,8 @@ balance() /* - * Display matching character. Matching characters that are not in the - * current window are displayed in the echo line. If in the current window, + * Display matching character. Matching characters that are not in the + * current window are displayed in the echo line. If in the current window, * move dot to the matching character, sit there a while, then move back. */ @@ -163,7 +163,7 @@ displaymatch(clp, cbo) * searching from the top of the window to dot. */ inwindow = FALSE; - for (tlp = curwp->w_linep; tlp != lforw(curwp->w_dotp); + for (tlp = curwp->w_linep; tlp != lforw(curwp->w_dotp); tlp = lforw(tlp)) if (tlp == clp) inwindow = TRUE; diff --git a/usr.bin/mg/modes.c b/usr.bin/mg/modes.c index eca9a1fa237..ab196ce4d52 100644 --- a/usr.bin/mg/modes.c +++ b/usr.bin/mg/modes.c @@ -1,8 +1,8 @@ -/* $OpenBSD: modes.c,v 1.4 2001/01/29 01:58:09 niklas Exp $ */ +/* $OpenBSD: modes.c,v 1.5 2001/05/24 03:05:25 mickey Exp $ */ /* - * Commands to toggle modes. Without an argument, these functions will - * toggle the given mode. A negative or zero argument will turn the mode + * Commands to toggle modes. Without an argument, these functions will + * toggle the given mode. A negative or zero argument will turn the mode * off. A positive argument will turn the mode on. */ @@ -47,7 +47,7 @@ changemode(f, n, mode) curbp->b_modes[++(curbp->b_nmodes)] = m; } else { /* fundamental is b_modes[0] and can't be unset */ - for (i = 1; i <= curbp->b_nmodes && m != curbp->b_modes[i]; + for (i = 1; i <= curbp->b_nmodes && m != curbp->b_modes[i]; i++); if (i > curbp->b_nmodes) return TRUE; /* mode wasn't set */ @@ -160,9 +160,9 @@ set_default_mode(f, n) defb_nmodes--; } if (strcmp(mode, "overwrite") == 0) { - if (n <= 0) + if (n <= 0) defb_flag &= ~BFOVERWRITE; - else + else defb_flag |= BFOVERWRITE; } #ifdef NOTAB diff --git a/usr.bin/mg/paragraph.c b/usr.bin/mg/paragraph.c index 498b040cc44..a3d0912e42a 100644 --- a/usr.bin/mg/paragraph.c +++ b/usr.bin/mg/paragraph.c @@ -1,4 +1,4 @@ -/* $OpenBSD: paragraph.c,v 1.5 2001/05/23 22:20:36 art Exp $ */ +/* $OpenBSD: paragraph.c,v 1.6 2001/05/24 03:05:25 mickey Exp $ */ /* * Code for dealing with paragraphs and filling. Adapted from MicroEMACS 3.6 @@ -12,8 +12,8 @@ static int fillcol = 70; #define MAXWORD 256 /* - * Move to start of paragraph. Go back to the begining of the current - * paragraph here we look for a <NL><NL> or <NL><TAB> or <NL><SPACE> + * Move to start of paragraph. Go back to the begining of the current + * paragraph here we look for a <NL><NL> or <NL><TAB> or <NL><SPACE> * combination to delimit the begining of a paragraph. */ /* ARGSUSED */ @@ -51,9 +51,9 @@ gotobop(f, n) * beond end of buffer, * cleanup time */ - curwp->w_dotp = + curwp->w_dotp = lback(curwp->w_dotp); - curwp->w_doto = + curwp->w_doto = llength(curwp->w_dotp); } } @@ -66,8 +66,8 @@ gotobop(f, n) } /* - * Move to end of paragraph. Go forword to the end of the current paragraph - * here we look for a <NL><NL> or <NL><TAB> or <NL><SPACE> combination to + * Move to end of paragraph. Go forword to the end of the current paragraph + * here we look for a <NL><NL> or <NL><TAB> or <NL><SPACE> combination to * delimit the begining of a paragraph. */ /* ARGSUSED */ @@ -111,7 +111,7 @@ gotoeop(f, n) } /* - * Justify a paragraph. Fill the current paragraph according to the current + * Justify a paragraph. Fill the current paragraph according to the current * fill column. */ /* ARGSUSED */ @@ -187,10 +187,10 @@ fillpara(f, n) * if at end of line or at doublespace and previous * character was one of '.','?','!' doublespace here. */ - if ((eolflag || - curwp->w_doto == llength(curwp->w_dotp) || + if ((eolflag || + curwp->w_doto == llength(curwp->w_dotp) || (c = lgetc(curwp->w_dotp, curwp->w_doto)) == ' ' - || c == '\t') && ISEOSP(wbuf[wordlen - 1]) && + || c == '\t') && ISEOSP(wbuf[wordlen - 1]) && wordlen < MAXWORD - 1) wbuf[wordlen++] = ' '; @@ -233,7 +233,7 @@ fillpara(f, n) return TRUE; } -/* +/* * Delete a paragraph. Delete n paragraphs starting with the current one. */ /* ARGSUSED */ diff --git a/usr.bin/mg/random.c b/usr.bin/mg/random.c index bd488201be4..933b1899ae7 100644 --- a/usr.bin/mg/random.c +++ b/usr.bin/mg/random.c @@ -1,19 +1,19 @@ -/* $OpenBSD: random.c,v 1.5 2001/05/23 22:20:36 art Exp $ */ +/* $OpenBSD: random.c,v 1.6 2001/05/24 03:05:25 mickey Exp $ */ /* * Assorted commands. - * This file contains the command processors for a large assortment of - * unrelated commands. The only thing they have in common is that they + * This file contains the command processors for a large assortment of + * unrelated commands. The only thing they have in common is that they * are all command processors. */ #include "def.h" /* - * Display a bunch of useful information about the current location of dot. - * The character under the cursor (in octal), the current line, row, and - * column, and approximate position of the cursor in the file (as a - * percentage) is displayed. The column position assumes an infinite + * Display a bunch of useful information about the current location of dot. + * The character under the cursor (in octal), the current line, row, and + * column, and approximate position of the cursor in the file (as a + * percentage) is displayed. The column position assumes an infinite * position display; it does not truncate just because the screen does. * This is normally bound to "C-X =". */ @@ -23,7 +23,7 @@ showcpos(f, n) int f, n; { LINE *clp; - long nchar; + long nchar; long cchar; int nline, row; int cline, cbyte; /* Current line/char/byte */ @@ -36,7 +36,7 @@ showcpos(f, n) cbyte = 0; nchar = 0; nline = 0; - for (;;) { + for (;;) { /* count this line */ ++nline; if (clp == curwp->w_dotp) { @@ -95,11 +95,11 @@ getcolpos() } /* - * Twiddle the two characters on either side of dot. If dot is at the end - * of the line twiddle the two characters before it. Return with an error - * if dot is at the beginning of line; it seems to be a bit pointless to - * make this work. This fixes up a very common typo with a single stroke. - * Normally bound to "C-T". This always works within a line, so "WFEDIT" + * Twiddle the two characters on either side of dot. If dot is at the end + * of the line twiddle the two characters before it. Return with an error + * if dot is at the beginning of line; it seems to be a bit pointless to + * make this work. This fixes up a very common typo with a single stroke. + * Normally bound to "C-T". This always works within a line, so "WFEDIT" * is good enough. */ /* ARGSUSED */ @@ -128,9 +128,9 @@ twiddle(f, n) } /* - * Open up some blank space. The basic plan is to insert a bunch of - * newlines, and then back up over them. Everything is done by the - * subcommand procerssors. They even handle the looping. Normally this + * Open up some blank space. The basic plan is to insert a bunch of + * newlines, and then back up over them. Everything is done by the + * subcommand procerssors. They even handle the looping. Normally this * is bound to "C-O". */ /* ARGSUSED */ @@ -161,9 +161,9 @@ openline(f, n) /* * Insert a newline. [following "feature" not present in current version of * Gnu, and now disabled here too] If you are at the end of the line and the - * next line is a blank line, just move into the blank line. This makes - * "C-O" and "C-X C-O" work nicely, and reduces the ammount of screen update - * that has to be done. This would not be as critical if screen update were a + * next line is a blank line, just move into the blank line. This makes + * "C-O" and "C-X C-O" work nicely, and reduces the ammount of screen update + * that has to be done. This would not be as critical if screen update were a * lot more efficient. */ /* ARGSUSED */ @@ -195,10 +195,10 @@ newline(f, n) /* * Delete blank lines around dot. What this command does depends if dot is - * sitting on a blank line. If dot is sitting on a blank line, this command - * deletes all the blank lines above and below the current line. If it is - * sitting on a non blank line then it deletes all of the blank lines after - * the line. Normally this command is bound to "C-X C-O". Any argument is + * sitting on a blank line. If dot is sitting on a blank line, this command + * deletes all the blank lines above and below the current line. If it is + * sitting on a non blank line then it deletes all of the blank lines after + * the line. Normally this command is bound to "C-X C-O". Any argument is * ignored. */ /* ARGSUSED */ @@ -266,10 +266,10 @@ delwhite(f, n) /* * Insert a newline, then enough tabs and spaces to duplicate the indentation - * of the previous line. Assumes tabs are every eight characters. Quite - * simple. Figure out the indentation of the current line. Insert a newline - * by calling the standard routine. Insert the indentation by inserting the - * right number of tabs and spaces. Return TRUE if all ok. Return FALSE if + * of the previous line. Assumes tabs are every eight characters. Quite + * simple. Figure out the indentation of the current line. Insert a newline + * by calling the standard routine. Insert the indentation by inserting the + * right number of tabs and spaces. Return TRUE if all ok. Return FALSE if * one of the subcomands failed. Normally bound to "C-J". */ /* ARGSUSED */ @@ -307,8 +307,8 @@ indent(f, n) /* * Delete forward. This is real easy, because the basic delete routine does - * all of the work. Watches for negative arguments, and does the right thing. - * If any argument is present, it kills rather than deletes, to prevent loss + * all of the work. Watches for negative arguments, and does the right thing. + * If any argument is present, it kills rather than deletes, to prevent loss * of text if typed with a big argument. Normally bound to "C-D". */ /* ARGSUSED */ @@ -330,8 +330,8 @@ forwdel(f, n) } /* - * Delete backwards. This is quite easy too, because it's all done with - * other functions. Just move the cursor back, and delete forwards. Like + * Delete backwards. This is quite easy too, because it's all done with + * other functions. Just move the cursor back, and delete forwards. Like * delete forward, this actually does a kill if presented with an argument. */ /* ARGSUSED */ @@ -357,12 +357,12 @@ backdel(f, n) } /* - * Kill line. If called without an argument, it kills from dot to the end - * of the line, unless it is at the end of the line, when it kills the - * newline. If called with an argument of 0, it kills from the start of the - * line to dot. If called with a positive argument, it kills from dot - * forward over that number of newlines. If called with a negative argument - * it kills any text before dot on the current line, then it kills back + * Kill line. If called without an argument, it kills from dot to the end + * of the line, unless it is at the end of the line, when it kills the + * newline. If called with an argument of 0, it kills from the start of the + * line to dot. If called with a positive argument, it kills from dot + * forward over that number of newlines. If called with a negative argument + * it kills any text before dot on the current line, then it kills back * abs(arg) lines. */ /* ARGSUSED */ @@ -420,13 +420,13 @@ killline(f, n) } /* - * Yank text back from the kill buffer. This is really easy. All of the work - * is done by the standard insert routines. All you do is run the loop, and + * Yank text back from the kill buffer. This is really easy. All of the work + * is done by the standard insert routines. All you do is run the loop, and * check for errors. The blank lines are inserted with a call to "newline" - * instead of a call to "lnewline" so that the magic stuff that happens when - * you type a carriage return also happens when a carriage return is yanked - * back from the kill buffer. An attempt has been made to fix the cosmetic - * bug associated with a yank when dot is on the top line of the window + * instead of a call to "lnewline" so that the magic stuff that happens when + * you type a carriage return also happens when a carriage return is yanked + * back from the kill buffer. An attempt has been made to fix the cosmetic + * bug associated with a yank when dot is on the top line of the window * (nothing moves, because all of the new text landed off screen). */ /* ARGSUSED */ diff --git a/usr.bin/mg/re_search.c b/usr.bin/mg/re_search.c index 2d46316309b..6067dbb4274 100644 --- a/usr.bin/mg/re_search.c +++ b/usr.bin/mg/re_search.c @@ -1,4 +1,4 @@ -/* $OpenBSD: re_search.c,v 1.8 2001/05/23 22:20:36 art Exp $ */ +/* $OpenBSD: re_search.c,v 1.9 2001/05/24 03:05:25 mickey Exp $ */ /* * regular expression search commands for Mg @@ -6,7 +6,7 @@ * This file contains functions to implement several of gnuemacs's regular * expression functions for Mg. Several of the routines below are just minor * re-arrangements of Mg's non-regular expression search functions. Some of - * them are similar in structure to the original MicroEMACS, others are + * them are similar in structure to the original MicroEMACS, others are * modifications of Rich Ellison's code. Peter Newton re-wrote about half of * them from scratch. */ @@ -41,8 +41,8 @@ static int countmatches __P((int)); /* * Search forward. - * Get a search string from the user and search for it starting at ".". If - * found, move "." to just after the matched characters. display does all + * Get a search string from the user and search for it starting at ".". If + * found, move "." to just after the matched characters. display does all * the hard stuff. If not found, it just prints a message. */ /* ARGSUSED */ @@ -87,8 +87,8 @@ re_backsearch(f, n) } /* - * Search again, using the same search string and direction as the last search - * command. The direction has been saved in "srch_lastdir", so you know which + * Search again, using the same search string and direction as the last search + * command. The direction has been saved in "srch_lastdir", so you know which * way to go. * * XXX: This code has problems -- some incompatibility(?) with extend.c causes @@ -110,7 +110,7 @@ re_searchagain(f, n) } return (TRUE); } - if (re_srch_lastdir == SRCH_BACK) + if (re_srch_lastdir == SRCH_BACK) if (re_backsrch() == FALSE) { ewprintf("Search failed: \"%s\"", re_pat); return (FALSE); @@ -143,7 +143,7 @@ re_queryrepl(f, n) if ((s = re_readpattern("RE Query replace")) != TRUE) return (s); - if ((s = + if ((s = ereply("Query replace %s with: ", news, NPAT, re_pat)) == ABORT) return (s); if (s == FALSE) @@ -216,9 +216,9 @@ stopsearch: */ static int re_doreplace(plen, st, f) - RSIZE plen; /* length to remove */ - char *st; /* replacement string */ - int f; /* case hack disable */ + RSIZE plen; /* length to remove */ + char *st; /* replacement string */ + int f; /* case hack disable */ { int j, k, s, more, num, state; LINE *clp; @@ -273,7 +273,7 @@ re_doreplace(plen, st, f) k = re_match[num].rm_eo - re_match[num].rm_so; if (j + k >= REPLEN) return (FALSE); - bcopy(&(clp->l_text[re_match[num].rm_so]), + bcopy(&(clp->l_text[re_match[num].rm_so]), &repstr[j], k); j += k; if (*st == '\0') @@ -302,8 +302,8 @@ re_doreplace(plen, st, f) /* - * This routine does the real work of a forward search. The pattern is - * sitting in the external variable "pat". If found, dot is updated, the + * This routine does the real work of a forward search. The pattern is + * sitting in the external variable "pat". If found, dot is updated, the * window system is notified of the change, and TRUE is returned. If the * string isn't found, FALSE is returned. */ @@ -332,7 +332,7 @@ re_forwsrch() while (clp != (curbp->b_linep)) { re_match[0].rm_so = tbo; re_match[0].rm_eo = llength(clp); - error = regexec(&re_buff, ltext(clp), RE_NMATCH, re_match, + error = regexec(&re_buff, ltext(clp), RE_NMATCH, re_match, REG_STARTEND); if (error != 0) { clp = lforw(clp); @@ -350,8 +350,8 @@ re_forwsrch() /* * This routine does the real work of a backward search. The pattern is sitting - * in the external variable "re_pat". If found, dot is updated, the window - * system is notified of the change, and TRUE is returned. If the string isn't + * in the external variable "re_pat". If found, dot is updated, the window + * system is notified of the change, and TRUE is returned. If the string isn't * found, FALSE is returned. */ static int @@ -486,7 +486,7 @@ delmatchlines(f, n) { int s; - if ((s = re_readpattern("Flush lines (containing match for regexp)")) + if ((s = re_readpattern("Flush lines (containing match for regexp)")) != TRUE) return (s); @@ -503,7 +503,7 @@ delnonmatchlines(f, n) { int s; - if ((s = re_readpattern("Keep lines (containing match for regexp)")) + if ((s = re_readpattern("Keep lines (containing match for regexp)")) != TRUE) return (s); @@ -511,8 +511,8 @@ delnonmatchlines(f, n) return (s); } -/* - * This function does the work of deleting matching lines +/* + * This function does the work of deleting matching lines */ static int killmatches(cond) @@ -531,7 +531,7 @@ killmatches(cond) /* see if line matches */ re_match[0].rm_so = 0; re_match[0].rm_eo = llength(clp); - error = regexec(&re_buff, ltext(clp), RE_NMATCH, re_match, + error = regexec(&re_buff, ltext(clp), RE_NMATCH, re_match, REG_STARTEND); /* Delete line when appropriate */ @@ -607,7 +607,7 @@ countmatches(cond) /* see if line matches */ re_match[0].rm_so = 0; re_match[0].rm_eo = llength(clp); - error = regexec(&re_buff, ltext(clp), RE_NMATCH, re_match, + error = regexec(&re_buff, ltext(clp), RE_NMATCH, re_match, REG_STARTEND); /* Count line when appropriate */ diff --git a/usr.bin/mg/region.c b/usr.bin/mg/region.c index 75fac8a3047..092f3090dbb 100644 --- a/usr.bin/mg/region.c +++ b/usr.bin/mg/region.c @@ -1,8 +1,8 @@ -/* $OpenBSD: region.c,v 1.5 2001/05/23 22:20:36 art Exp $ */ +/* $OpenBSD: region.c,v 1.6 2001/05/24 03:05:26 mickey Exp $ */ /* * Region based commands. - * The routines in this file deal with the region, that magic space between + * The routines in this file deal with the region, that magic space between * "." and mark. Some functions are commands. Some functions are just for * internal use. */ @@ -36,7 +36,7 @@ killregion(f, n) } /* - * Copy all of the characters in the region to the kill buffer. Don't move + * Copy all of the characters in the region to the kill buffer. Don't move * dot at all. This is a bit like a kill region followed by a yank. */ /* ARGSUSED */ @@ -79,9 +79,9 @@ copyregion(f, n) } /* - * Lower case region. Zap all of the upper case characters in the region to - * lower case. Use the region code to set the limits. Scan the buffer, doing - * the changes. Call "lchange" to ensure that redisplay is done in all + * Lower case region. Zap all of the upper case characters in the region to + * lower case. Use the region code to set the limits. Scan the buffer, doing + * the changes. Call "lchange" to ensure that redisplay is done in all * buffers. */ /* ARGSUSED */ @@ -113,9 +113,9 @@ lowerregion(f, n) } /* - * Upper case region. Zap all of the lower case characters in the region to + * Upper case region. Zap all of the lower case characters in the region to * upper case. Use the region code to set the limits. Scan the buffer, - * doing the changes. Call "lchange" to ensure that redisplay is done in all + * doing the changes. Call "lchange" to ensure that redisplay is done in all * buffers. */ /* ARGSUSED */ @@ -147,14 +147,14 @@ upperregion(f, n) } /* - * This routine figures out the bound of the region in the current window, - * and stores the results into the fields of the REGION structure. Dot and - * mark are usually close together, but I don't know the order, so I scan - * outward from dot, in both directions, looking for mark. The size is kept - * in a long. At the end, after the size is figured out, it is assigned to - * the size field of the region structure. If this assignment loses any bits, - * then we print an error. This is "type independent" overflow checking. All - * of the callers of this routine should be ready to get an ABORT status, + * This routine figures out the bound of the region in the current window, + * and stores the results into the fields of the REGION structure. Dot and + * mark are usually close together, but I don't know the order, so I scan + * outward from dot, in both directions, looking for mark. The size is kept + * in a long. At the end, after the size is figured out, it is assigned to + * the size field of the region structure. If this assignment loses any bits, + * then we print an error. This is "type independent" overflow checking. All + * of the callers of this routine should be ready to get an ABORT status, * because I might add a "if regions is big, ask before clobberring" flag. */ static int @@ -240,8 +240,8 @@ setsize(rp, size) static char prefix_string[PREFIXLENGTH] = {'>', '\0'}; /* - * Prefix the region with whatever is in prefix_string. Leaves dot at the - * beginning of the line after the end of the region. If an argument is + * Prefix the region with whatever is in prefix_string. Leaves dot at the + * beginning of the line after the end of the region. If an argument is * given, prompts for the line prefix string. */ /* ARGSUSED */ diff --git a/usr.bin/mg/search.c b/usr.bin/mg/search.c index 2a88aec017d..be9d9b20528 100644 --- a/usr.bin/mg/search.c +++ b/usr.bin/mg/search.c @@ -1,8 +1,8 @@ -/* $OpenBSD: search.c,v 1.6 2001/05/23 22:20:36 art Exp $ */ +/* $OpenBSD: search.c,v 1.7 2001/05/24 03:05:26 mickey Exp $ */ /* * Search commands. - * The functions in this file implement the search commands (both plain and + * The functions in this file implement the search commands (both plain and * incremental searches are supported) and the query-replace command. * * The plain old search code is part of the original MicroEMACS "distribution". @@ -46,8 +46,8 @@ int srch_lastdir = SRCH_NOPR; /* Last search flags. */ /* * Search forward. Get a search string from the user, and search for it - * starting at ".". If found, "." gets moved to just after the matched - * characters, and display does all the hard stuff. If not found, it just + * starting at ".". If found, "." gets moved to just after the matched + * characters, and display does all the hard stuff. If not found, it just * prints a message. */ /* ARGSUSED */ @@ -68,9 +68,9 @@ forwsearch(f, n) } /* - * Reverse search. Get a search string from the user, and search, starting - * at "." and proceeding toward the front of the buffer. If found "." is - * left pointing at the first character of the pattern [the last character + * Reverse search. Get a search string from the user, and search, starting + * at "." and proceeding toward the front of the buffer. If found "." is + * left pointing at the first character of the pattern [the last character * that was matched]. */ /* ARGSUSED */ @@ -91,8 +91,8 @@ backsearch(f, n) } /* - * Search again, using the same search string and direction as the last - * search command. The direction has been saved in "srch_lastdir", so you + * Search again, using the same search string and direction as the last + * search command. The direction has been saved in "srch_lastdir", so you * know which way to go. */ /* ARGSUSED */ @@ -119,7 +119,7 @@ searchagain(f, n) } /* - * Use incremental searching, initially in the forward direction. + * Use incremental searching, initially in the forward direction. * isearch ignores any explicit arguments. */ /* ARGSUSED */ @@ -425,9 +425,9 @@ is_find(dir) } /* - * If called with "dir" not one of SRCH_FORW or SRCH_BACK, this routine used - * to print an error message. It also used to return TRUE or FALSE, depending - * on if it liked the "dir". However, none of the callers looked at the + * If called with "dir" not one of SRCH_FORW or SRCH_BACK, this routine used + * to print an error message. It also used to return TRUE or FALSE, depending + * on if it liked the "dir". However, none of the callers looked at the * status, so I just made the checking vanish. */ static void @@ -449,7 +449,7 @@ is_prompt(dir, flag, success) } /* - * Prompt writing routine for the incremental search. The "prompt" is just + * Prompt writing routine for the incremental search. The "prompt" is just * a string. The "flag" determines whether pat should be printed. */ static void @@ -546,9 +546,9 @@ stopsearch: } /* - * This routine does the real work of a forward search. The pattern is sitting + * This routine does the real work of a forward search. The pattern is sitting * in the external variable "pat". If found, dot is updated, the window system - * is notified of the change, and TRUE is returned. If the string isn't found, + * is notified of the change, and TRUE is returned. If the string isn't found, * FALSE is returned. */ int @@ -595,8 +595,8 @@ fail: ; } /* - * This routine does the real work of a backward search. The pattern is - * sitting in the external variable "pat". If found, dot is updated, the + * This routine does the real work of a backward search. The pattern is + * sitting in the external variable "pat". If found, dot is updated, the * window system is notified of the change, and TRUE is returned. If the * string isn't found, FALSE is returned. */ @@ -650,7 +650,7 @@ fail: ; } /* - * Compare two characters. The "bc" comes from the buffer. It has its case + * Compare two characters. The "bc" comes from the buffer. It has its case * folded out. The "pc" is from the pattern. */ static int @@ -669,10 +669,10 @@ eq(bc, pc) } /* - * Read a pattern. Stash it in the external variable "pat". The "pat" is not - * updated if the user types in an empty line. If the user typed an empty - * line, and there is no old pattern, it is an error. Display the old pattern, - * in the style of Jeff Lomicka. There is some do-it-yourself control + * Read a pattern. Stash it in the external variable "pat". The "pat" is not + * updated if the user types in an empty line. If the user typed an empty + * line, and there is no old pattern, it is an error. Display the old pattern, + * in the style of Jeff Lomicka. There is some do-it-yourself control * expansion. */ int diff --git a/usr.bin/mg/spawn.c b/usr.bin/mg/spawn.c index 63e8f43efd0..082a66fb50b 100644 --- a/usr.bin/mg/spawn.c +++ b/usr.bin/mg/spawn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: spawn.c,v 1.6 2001/01/29 01:58:09 niklas Exp $ */ +/* $OpenBSD: spawn.c,v 1.7 2001/05/24 03:05:26 mickey Exp $ */ /* * Spawn. Actually just suspends Mg. @@ -12,8 +12,8 @@ #include <term.h> /* - * This causes mg to send itself a stop signal. It assumes the parent - * shell supports POSIX job control. If the terminal supports an alternate + * This causes mg to send itself a stop signal. It assumes the parent + * shell supports POSIX job control. If the terminal supports an alternate * screen, we will switch to it. */ /* ARGSUSED */ diff --git a/usr.bin/mg/sysdef.h b/usr.bin/mg/sysdef.h index be69c28735b..87c9848cbd6 100644 --- a/usr.bin/mg/sysdef.h +++ b/usr.bin/mg/sysdef.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sysdef.h,v 1.8 2001/05/04 22:00:36 art Exp $ */ +/* $OpenBSD: sysdef.h,v 1.9 2001/05/24 03:05:26 mickey Exp $ */ /* * POSIX system header file @@ -13,15 +13,15 @@ #define SYMBLINK 1 /* Handle symbolic links */ #define MAXPATH PATH_MAX /* Maximum length of path for chdir */ -typedef int RSIZE; /* Type for file/region sizes */ -typedef short KCHAR; /* Type for internal keystrokes */ +typedef int RSIZE; /* Type for file/region sizes */ +typedef short KCHAR; /* Type for internal keystrokes */ #define MALLOCROUND(m) (m+=7,m&=~7) /* round up to 8 byte boundry */ #define gettermtype() getenv("TERM") /* determine terminal type */ struct fileinfo { - mode_t fi_mode; - uid_t fi_uid; - gid_t short fi_gid; + mode_t fi_mode; + uid_t fi_uid; + gid_t short fi_gid; }; diff --git a/usr.bin/mg/tty.c b/usr.bin/mg/tty.c index d33f798a227..6b6789df031 100644 --- a/usr.bin/mg/tty.c +++ b/usr.bin/mg/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.8 2001/05/23 22:20:36 art Exp $ */ +/* $OpenBSD: tty.c,v 1.9 2001/05/24 03:05:26 mickey Exp $ */ /* * Terminfo display driver @@ -105,7 +105,7 @@ ttinit() tcdell = NROW * NCOL; /* Flag to indicate that we can both insert and delete lines */ - insdel = (insert_line || parm_insert_line) && + insdel = (insert_line || parm_insert_line) && (delete_line || parm_delete_line); if (enter_ca_mode) @@ -133,8 +133,8 @@ ttreinit() } /* - * Clean up the terminal, in anticipation of a return to the command - * interpreter. This is a no-op on the ANSI display. On the SCALD display, + * Clean up the terminal, in anticipation of a return to the command + * interpreter. This is a no-op on the ANSI display. On the SCALD display, * it sets the window back to half screen scrolling. Perhaps it should * query the display for the increment, and put it back to what it was. */ @@ -220,9 +220,9 @@ ttbeep() } /* - * Insert nchunk blank line(s) onto the screen, scrolling the last line on - * the screen off the bottom. Use the scrolling region if possible for a - * smoother display. If there is no scrolling region, use a set of insert + * Insert nchunk blank line(s) onto the screen, scrolling the last line on + * the screen off the bottom. Use the scrolling region if possible for a + * smoother display. If there is no scrolling region, use a set of insert * and delete line sequences. */ void @@ -273,9 +273,9 @@ ttinsl(row, bot, nchunk) } /* - * Delete nchunk line(s) from "row", replacing the bottom line on the - * screen with a blank line. Unless we're using the scrolling region, - * this is done with crafty sequences of insert and delete lines. The + * Delete nchunk line(s) from "row", replacing the bottom line on the + * screen with a blank line. Unless we're using the scrolling region, + * this is done with crafty sequences of insert and delete lines. The * presence of the echo area makes a boundry condition go away. */ void @@ -325,11 +325,11 @@ ttdell(row, bot, nchunk) } /* - * This routine sets the scrolling window on the display to go from line - * "top" to line "bot" (origin 0, inclusive). The caller checks for the - * pathological 1-line scroll window which doesn't work right and avoids - * it. The "ttrow" and "ttcol" variables are set to a crazy value to - * ensure that the next call to "ttmove" does not turn into a no-op (the + * This routine sets the scrolling window on the display to go from line + * "top" to line "bot" (origin 0, inclusive). The caller checks for the + * pathological 1-line scroll window which doesn't work right and avoids + * it. The "ttrow" and "ttcol" variables are set to a crazy value to + * ensure that the next call to "ttmove" does not turn into a no-op (the * window adjustment moves the cursor). */ void @@ -346,11 +346,11 @@ ttwindow(top, bot) } /* - * Switch to full screen scroll. This is used by "spawn.c" just before it - * suspends the editor and by "display.c" when it is getting ready to - * exit. This function does a full screen scroll by telling the terminal - * to set a scrolling region that is lines or nrow rows high, whichever is - * larger. This behavior seems to work right on systems where you can set + * Switch to full screen scroll. This is used by "spawn.c" just before it + * suspends the editor and by "display.c" when it is getting ready to + * exit. This function does a full screen scroll by telling the terminal + * to set a scrolling region that is lines or nrow rows high, whichever is + * larger. This behavior seems to work right on systems where you can set * your terminal size. */ void @@ -367,10 +367,10 @@ ttnowindow() } /* - * Set the current writing color to the specified color. Watch for color + * Set the current writing color to the specified color. Watch for color * changes that are not going to do anything (the color is already right) - * and don't send anything to the display. The rainbow version does this - * in putline.s on a line by line basis, so don't bother sending out the + * and don't send anything to the display. The rainbow version does this + * in putline.s on a line by line basis, so don't bother sending out the * color shift. */ void @@ -390,10 +390,10 @@ ttcolor(color) } /* - * This routine is called by the "refresh the screen" command to try - * to resize the display. The new size, which must not exceed the NROW - * and NCOL limits, is stored back into "nrow" and * "ncol". Display can - * always deal with a screen NROW by NCOL. Look in "window.c" to see how + * This routine is called by the "refresh the screen" command to try + * to resize the display. The new size, which must not exceed the NROW + * and NCOL limits, is stored back into "nrow" and * "ncol". Display can + * always deal with a screen NROW by NCOL. Look in "window.c" to see how * the caller deals with a change. */ void @@ -423,7 +423,7 @@ setttysize() #endif /* NO_RESIZE */ /* - * fake char output for charcost() + * fake char output for charcost() */ /* ARGSUSED */ static int diff --git a/usr.bin/mg/ttyio.c b/usr.bin/mg/ttyio.c index 42b5967c03b..13d2c8ee23b 100644 --- a/usr.bin/mg/ttyio.c +++ b/usr.bin/mg/ttyio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ttyio.c,v 1.15 2001/05/23 22:20:36 art Exp $ */ +/* $OpenBSD: ttyio.c,v 1.16 2001/05/24 03:05:27 mickey Exp $ */ /* * POSIX terminal I/O. @@ -40,7 +40,7 @@ ttopen() { if (!isatty(STDIN_FILENO) || !isatty(STDOUT_FILENO)) - panic("standard input and output must be a terminal"); + panic("standard input and output must be a terminal"); if (ttraw() == FALSE) panic("aborting due to terminal initialize failure"); @@ -223,7 +223,7 @@ ttwait(int msec) fd_set readfds; struct timeval tmout; - FD_ZERO(&readfds); + FD_ZERO(&readfds); FD_SET(0, &readfds); tmout.tv_sec = msec/1000; diff --git a/usr.bin/mg/ttykbd.c b/usr.bin/mg/ttykbd.c index f05c7be2466..187724d6ee7 100644 --- a/usr.bin/mg/ttykbd.c +++ b/usr.bin/mg/ttykbd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ttykbd.c,v 1.8 2001/05/23 22:12:10 art Exp $ */ +/* $OpenBSD: ttykbd.c,v 1.9 2001/05/24 03:05:27 mickey Exp $ */ /* * Name: MG 2a @@ -20,7 +20,7 @@ * extend.c. */ -char *keystrings[] = {NULL}; +char *keystrings[] = {NULL}; #endif /* FKEYS */ /* diff --git a/usr.bin/mg/tutorial b/usr.bin/mg/tutorial index d623febf889..316692553a5 100644 --- a/usr.bin/mg/tutorial +++ b/usr.bin/mg/tutorial @@ -60,7 +60,7 @@ move your hand from the keyboard, it is also not supported on other machines that do support Emacs. Emacs runs on everything from a CP/M machine to large mainframes. Here then, in a more graphical form are the commands: - + Previous line, C-p : : @@ -145,10 +145,10 @@ sentence moving commands: Like all other commands in Emacs, these commands can be given arguments which cause them to be executed repeatedly. The way you give a command a repeat count is by typing C-u and then the digits -before you type the command. +before you type the command. For instance, C-u 8 C-f moves forward eight characters. - + >> Try giving a suitable argument to C-n or C-p to come as close as you can to this line in one jump. @@ -241,7 +241,7 @@ Emacs and correcting errors. You can delete by words or lines as well. Here is a summary of the delete operations: <DEL> delete the character just before the cursor - C-d delete the next character after the cursor + C-d delete the next character after the cursor M-<DEL> kill the word immediately before the cursor M-d kill the next word after the cursor @@ -326,9 +326,9 @@ file). After you type the command C-x C-f Find a file Emacs asks you to type the file name. It echoes on the bottom line of -the screen. When you type <Return> to end the file name it disappears. +the screen. When you type <Return> to end the file name it disappears. ->> Type C-x C-f, then type C-g. This cancels the C-x C-f command +>> Type C-x C-f, then type C-g. This cancels the C-x C-f command that was using the minibuffer. So you do not find any file. In a little while the file contents appear on the screen. You can @@ -337,7 +337,7 @@ issue the command C-x C-s Save the file -The contents of Emacs are written into the file. +The contents of Emacs are written into the file. When saving is finished, Emacs prints the name of the file written. You should save fairly often, so that you will not lose very much @@ -357,7 +357,7 @@ BUFFERS ------- If you find a second file with C-x C-f, the first file remains inside -Emacs. This way you can get quite a number of files inside Emacs. +Emacs. This way you can get quite a number of files inside Emacs. The object inside Emacs which holds the text read from one file is called a "buffer." Finding a file makes a new buffer inside Emacs. @@ -417,7 +417,7 @@ Emacs; you can resume editing by ending that CLI or depth arranging. You would use C-x C-c if you were running out of memory. You would also use it to exit an Emacs invoked under mail handling programs and other random utilities, since they may not believe you have really -finished using the Emacs if it continues to exist. +finished using the Emacs if it continues to exist. There are many C-x commands. The ones you know are: @@ -453,7 +453,7 @@ at the bottom of the screen in an area called the "echo area." The echo area contains the bottom line of the screen. The line immediately above it is called the MODE LINE. The mode line says something like ---**-Mg: TUTORIAL (fundamental)------------------------ +--**-Mg: TUTORIAL (fundamental)------------------------ This is a very useful "information" line. @@ -530,7 +530,7 @@ cursor is at the first occurrence of 'cu'. If you now type <DEL>, the 'u' on the search line is erased and you'll be repositioned in the text to the occurrence of 'c' where the search took you before you typed the 'u'. This provides a useful means for backing up while you -are searching. +are searching. If you are in the middle of a search and happen to type a control character (other than a C-s or C-r, which tell Emacs to search for the @@ -550,7 +550,7 @@ In this tutorial we have tried to supply just enough information to get you started using Emacs. There is so much available in Emacs that it would be impossible to explain it all here. However, you may want to learn more about Emacs since it has numerous desirable features -that you don't know about yet. +that you don't know about yet. CONCLUSION diff --git a/usr.bin/mg/window.c b/usr.bin/mg/window.c index b17b1a9a83c..7e8b33bfc3d 100644 --- a/usr.bin/mg/window.c +++ b/usr.bin/mg/window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window.c,v 1.6 2001/05/23 22:36:15 art Exp $ */ +/* $OpenBSD: window.c,v 1.7 2001/05/24 03:05:27 mickey Exp $ */ /* * Window handling. @@ -7,11 +7,11 @@ #include "def.h" /* - * Reposition dot in the current window to line "n". If the argument is - * positive, it is that line. If it is negative it is that line from the - * bottom. If it is 0 the window is centered (this is what the standard - * redisplay code does). If GOSREC is undefined, default is 0, so it acts - * like GNU. If GOSREC is defined, with no argument it defaults to 1 and + * Reposition dot in the current window to line "n". If the argument is + * positive, it is that line. If it is negative it is that line from the + * bottom. If it is 0 the window is centered (this is what the standard + * redisplay code does). If GOSREC is undefined, default is 0, so it acts + * like GNU. If GOSREC is defined, with no argument it defaults to 1 and * works like in Gosling. */ /* ARGSUSED */ @@ -30,14 +30,14 @@ reposition(f, n) } /* - * Refresh the display. A call is made to the "ttresize" entry in the - * terminal handler, which tries to reset "nrow" and "ncol". They will, + * Refresh the display. A call is made to the "ttresize" entry in the + * terminal handler, which tries to reset "nrow" and "ncol". They will, * however, never be set outside of the NROW or NCOL range. If the display - * changed size, arrange that everything is redone, then call "update" to - * fix the display. We do this so the new size can be displayed. In the - * normal case the call to "update" in "main.c" refreshes the screen, and - * all of the windows need not be recomputed. Note that when you get to the - * "display unusable" message, the screen will be messed up. If you make the + * changed size, arrange that everything is redone, then call "update" to + * fix the display. We do this so the new size can be displayed. In the + * normal case the call to "update" in "main.c" refreshes the screen, and + * all of the windows need not be recomputed. Note that when you get to the + * "display unusable" message, the screen will be messed up. If you make the * window bigger again, and send another command, everything will get fixed! */ /* ARGSUSED */ @@ -74,8 +74,8 @@ refresh(f, n) } /* - * The command to make the next window (next => down the screen) the current - * window. There are no real errors, although the command does nothing if + * The command to make the next window (next => down the screen) the current + * window. There are no real errors, although the command does nothing if * there is only 1 window on the screen. */ /* ARGSUSED */ @@ -97,7 +97,7 @@ nextwind(f, n) /* not in Gnu Emacs */ /* * This command makes the previous window (previous => up the screen) the - * current window. There are no errors, although the command does not do + * current window. There are no errors, although the command does not do * a lot if there is only 1 window. */ /* ARGSUSED */ @@ -120,10 +120,10 @@ prevwind(f, n) #endif /* GOSEMACS */ /* - * This command makes the current window the only window on the screen. Try - * to set the framing so that "." does not have to move on the display. Some - * care has to be taken to keep the values of dot and mark in the buffer - * structures right if the distruction of a window makes a buffer become + * This command makes the current window the only window on the screen. Try + * to set the framing so that "." does not have to move on the display. Some + * care has to be taken to keep the values of dot and mark in the buffer + * structures right if the distruction of a window makes a buffer become * undisplayed. */ /* ARGSUSED */ @@ -174,7 +174,7 @@ onlywind(f, n) /* * Split the current window. A window smaller than 3 lines cannot be split. - * The only other error that is possible is a "malloc" failure allocating the + * The only other error that is possible is a "malloc" failure allocating the * structure for the new window. */ /* ARGSUSED */ @@ -258,9 +258,9 @@ splitwind(f, n) } /* - * Enlarge the current window. Find the window that loses space. Make sure - * it is big enough. If so, hack the window descriptions, and ask redisplay - * to do all the hard work. You don't just set "force reframe" because dot + * Enlarge the current window. Find the window that loses space. Make sure + * it is big enough. If so, hack the window descriptions, and ask redisplay + * to do all the hard work. You don't just set "force reframe" because dot * would move. */ /* ARGSUSED */ @@ -311,7 +311,7 @@ enlargewind(f, n) } /* - * Shrink the current window. Find the window that gains space. Hack at the + * Shrink the current window. Find the window that gains space. Hack at the * window descriptions. Ask the redisplay to do all the hard work. */ int @@ -365,7 +365,7 @@ shrinkwind(f, n) } /* - * Delete current window. Call shrink-window to do the screen updating, then + * Delete current window. Call shrink-window to do the screen updating, then * throw away the window. */ /* ARGSUSED */ @@ -403,7 +403,7 @@ delwind(f, n) } /* - * Pick a window for a pop-up. Split the screen if there is only one window. + * Pick a window for a pop-up. Split the screen if there is only one window. * Pick the uppermost window that isn't the current window. An LRU algorithm * might be better. Return a pointer, or NULL on error. */ diff --git a/usr.bin/mg/word.c b/usr.bin/mg/word.c index 6c020f0885b..754c521ce07 100644 --- a/usr.bin/mg/word.c +++ b/usr.bin/mg/word.c @@ -1,15 +1,15 @@ -/* $OpenBSD: word.c,v 1.4 2001/01/29 01:58:10 niklas Exp $ */ +/* $OpenBSD: word.c,v 1.5 2001/05/24 03:05:28 mickey Exp $ */ /* * Word mode commands. - * The routines in this file implement commands that work word at a time. + * The routines in this file implement commands that work word at a time. * There are all sorts of word mode commands. */ #include "def.h" /* - * Move the cursor backward by "n" words. All of the details of motion are + * Move the cursor backward by "n" words. All of the details of motion are * performed by the "backchar" and "forwchar" routines. */ /* ARGSUSED */ @@ -124,8 +124,8 @@ lowerword(f, n) /* * Move the cursor forward by the specified number of words. As you move - * convert the first character of the word to upper case, and subsequent - * characters to lower case. Error if you try to move past the end of the + * convert the first character of the word to upper case, and subsequent + * characters to lower case. Error if you try to move past the end of the * buffer. */ /* ARGSUSED */ @@ -211,12 +211,12 @@ out: } /* - * Kill backwards by "n" words. The rules for success and failure are now - * different, to prevent strange behavior at the start of the buffer. The - * command only fails if something goes wrong with the actual delete of the - * characters. It is successful even if no characters are deleted, or if you - * say delete 5 words, and there are only 4 words left. I considered making - * the first call to "backchar" special, but decided that that would just be + * Kill backwards by "n" words. The rules for success and failure are now + * different, to prevent strange behavior at the start of the buffer. The + * command only fails if something goes wrong with the actual delete of the + * characters. It is successful even if no characters are deleted, or if you + * say delete 5 words, and there are only 4 words left. I considered making + * the first call to "backchar" special, but decided that that would just be * weird. Normally this is bound to "M-Rubout" and to "M-Backspace". */ /* ARGSUSED */ |