summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/mg/basic.c20
-rw-r--r--usr.bin/mg/buffer.c95
-rw-r--r--usr.bin/mg/cinfo.c6
-rw-r--r--usr.bin/mg/def.h592
-rw-r--r--usr.bin/mg/dired.c55
-rw-r--r--usr.bin/mg/display.c78
-rw-r--r--usr.bin/mg/echo.c36
-rw-r--r--usr.bin/mg/extend.c22
-rw-r--r--usr.bin/mg/file.c32
-rw-r--r--usr.bin/mg/fileio.c20
-rw-r--r--usr.bin/mg/funmap.c6
-rw-r--r--usr.bin/mg/funmap.h4
-rw-r--r--usr.bin/mg/grep.c32
-rw-r--r--usr.bin/mg/help.c12
-rw-r--r--usr.bin/mg/kbd.c10
-rw-r--r--usr.bin/mg/kbd.h48
-rw-r--r--usr.bin/mg/keymap.c21
-rw-r--r--usr.bin/mg/line.c42
-rw-r--r--usr.bin/mg/macro.c8
-rw-r--r--usr.bin/mg/macro.h6
-rw-r--r--usr.bin/mg/mail.c4
-rw-r--r--usr.bin/mg/main.c14
-rw-r--r--usr.bin/mg/match.c10
-rw-r--r--usr.bin/mg/modes.c8
-rw-r--r--usr.bin/mg/paragraph.c4
-rw-r--r--usr.bin/mg/random.c14
-rw-r--r--usr.bin/mg/re_search.c12
-rw-r--r--usr.bin/mg/region.c34
-rw-r--r--usr.bin/mg/search.c18
-rw-r--r--usr.bin/mg/theo.c6
-rw-r--r--usr.bin/mg/undo.c34
-rw-r--r--usr.bin/mg/window.c49
-rw-r--r--usr.bin/mg/word.c14
33 files changed, 683 insertions, 683 deletions
diff --git a/usr.bin/mg/basic.c b/usr.bin/mg/basic.c
index c24f0a242e0..cba7fc9657a 100644
--- a/usr.bin/mg/basic.c
+++ b/usr.bin/mg/basic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: basic.c,v 1.20 2005/08/09 00:53:48 kjell Exp $ */
+/* $OpenBSD: basic.c,v 1.21 2005/11/18 20:56:52 deraadt Exp $ */
/* This file is in the public domain */
@@ -36,7 +36,7 @@ gotobol(int f, int n)
int
backchar(int f, int n)
{
- LINE *lp;
+ struct line *lp;
if (n < 0)
return (forwchar(f, -n));
@@ -137,7 +137,7 @@ gotoeob(int f, int n)
int
forwline(int f, int n)
{
- LINE *dlp;
+ struct line *dlp;
if (n < 0)
return (backline(f | FFRAND, -n));
@@ -183,7 +183,7 @@ forwline(int f, int n)
int
backline(int f, int n)
{
- LINE *dlp;
+ struct line *dlp;
if (n < 0)
return (forwline(f | FFRAND, -n));
@@ -219,7 +219,7 @@ setgoal(void)
* when a vertical motion is made into the line.
*/
int
-getgoal(LINE *dlp)
+getgoal(struct line *dlp)
{
int c, i, col = 0;
@@ -260,7 +260,7 @@ getgoal(LINE *dlp)
int
forwpage(int f, int n)
{
- LINE *lp;
+ struct line *lp;
if (!(f & FFARG)) {
n = curwp->w_ntrows - 2; /* Default scroll. */
@@ -298,7 +298,7 @@ forwpage(int f, int n)
int
backpage(int f, int n)
{
- LINE *lp;
+ struct line *lp;
if (!(f & FFARG)) {
n = curwp->w_ntrows - 2; /* Default scroll. */
@@ -357,7 +357,7 @@ back1page(int f, int n)
int
pagenext(int f, int n)
{
- MGWIN *wp;
+ struct mgwin *wp;
if (wheadp->w_wndp == NULL) {
ewprintf("No other window");
@@ -406,7 +406,7 @@ setmark(int f, int n)
int
swapmark(int f, int n)
{
- LINE *odotp;
+ struct line *odotp;
int odoto;
if (curwp->w_markp == NULL) {
@@ -434,7 +434,7 @@ swapmark(int f, int n)
int
gotoline(int f, int n)
{
- LINE *clp;
+ struct line *clp;
char buf[32], *bufp, *tmp;
long nl;
diff --git a/usr.bin/mg/buffer.c b/usr.bin/mg/buffer.c
index 0f912c97a36..b9a7e466b1d 100644
--- a/usr.bin/mg/buffer.c
+++ b/usr.bin/mg/buffer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: buffer.c,v 1.51 2005/11/13 07:49:02 kjell Exp $ */
+/* $OpenBSD: buffer.c,v 1.52 2005/11/18 20:56:52 deraadt Exp $ */
/* This file is in the public domain. */
@@ -10,7 +10,7 @@
#include "kbd.h" /* needed for modes */
#include <stdarg.h>
-static BUFFER *makelist(void);
+static struct buffer *makelist(void);
/* ARGSUSED */
int
@@ -38,7 +38,7 @@ togglereadonly(int f, int n)
int
usebuffer(int f, int n)
{
- BUFFER *bp;
+ struct buffer *bp;
char bufn[NBUFN], *bufp;
/* Get buffer to use from user */
@@ -68,8 +68,8 @@ usebuffer(int f, int n)
int
poptobuffer(int f, int n)
{
- BUFFER *bp;
- MGWIN *wp;
+ struct buffer *bp;
+ struct mgwin *wp;
char bufn[NBUFN], *bufp;
/* Get buffer to use from user */
@@ -106,7 +106,7 @@ poptobuffer(int f, int n)
int
killbuffer_cmd(int f, int n)
{
- BUFFER *bp;
+ struct buffer *bp;
char bufn[NBUFN], *bufp;
if ((bufp = eread("Kill buffer: (default %s) ", bufn, NBUFN,
@@ -120,11 +120,11 @@ killbuffer_cmd(int f, int n)
}
int
-killbuffer(BUFFER *bp)
+killbuffer(struct buffer *bp)
{
- BUFFER *bp1;
- BUFFER *bp2;
- MGWIN *wp;
+ struct buffer *bp1;
+ struct buffer *bp2;
+ struct mgwin *wp;
int s;
struct undo_rec *rec, *next;
@@ -243,9 +243,9 @@ static struct KEYMAPE (2 + IMAPEXT) listbufmap = {
int
listbuffers(int f, int n)
{
- static int initialized = 0;
- BUFFER *bp;
- MGWIN *wp;
+ static int initialized = 0;
+ struct buffer *bp;
+ struct mgwin *wp;
if (!initialized) {
maps_add((KEYMAP *)&listbufmap, "listbufmap");
@@ -270,13 +270,12 @@ listbuffers(int f, int n)
* Return NULL if there is an error (if
* there is no memory).
*/
-static BUFFER *
+static struct buffer *
makelist(void)
{
- int w = ncol / 2;
- BUFFER *bp, *blp;
- LINE *lp;
-
+ int w = ncol / 2;
+ struct buffer *bp, *blp;
+ struct line *lp;
if ((blp = bfind("*Buffer List*", TRUE)) == NULL)
return (NULL);
@@ -339,10 +338,10 @@ listbuf_goto_buffer_one(int f, int n)
static int
listbuf_goto_buffer_helper(int f, int n, int only)
{
- BUFFER *bp;
- MGWIN *wp;
- char *line = NULL;
- int i, ret = FALSE;
+ struct buffer *bp;
+ struct mgwin *wp;
+ char *line = NULL;
+ int i, ret = FALSE;
if (curwp->w_dotp->l_text[listbuf_ncol/2 - 1] == '$') {
ewprintf("buffer name truncated");
@@ -391,10 +390,10 @@ cleanup:
* FALSE if you ran out of room.
*/
int
-addlinef(BUFFER *bp, char *fmt, ...)
+addlinef(struct buffer *bp, char *fmt, ...)
{
- va_list ap;
- LINE *lp;
+ va_list ap;
+ struct line *lp;
if ((lp = lalloc(0)) == NULL)
return (FALSE);
@@ -424,9 +423,9 @@ addlinef(BUFFER *bp, char *fmt, ...)
int
anycb(int f)
{
- BUFFER *bp;
- int s = FALSE, save = FALSE, ret;
- char prompt[NFILEN + 11];
+ struct buffer *bp;
+ int s = FALSE, save = FALSE, ret;
+ char prompt[NFILEN + 11];
for (bp = bheadp; bp != NULL; bp = bp->b_bufp) {
if (bp->b_fname != NULL && *(bp->b_fname) != '\0' &&
@@ -460,12 +459,12 @@ anycb(int f)
* all buffers. Return pointer to the BUFFER
* block for the buffer.
*/
-BUFFER *
+struct buffer *
bfind(const char *bname, int cflag)
{
- BUFFER *bp;
- LINE *lp;
- int i;
+ struct buffer *bp;
+ struct line *lp;
+ int i;
bp = bheadp;
while (bp != NULL) {
@@ -476,9 +475,9 @@ bfind(const char *bname, int cflag)
if (cflag != TRUE)
return (NULL);
- bp = calloc(1, sizeof(BUFFER));
+ bp = calloc(1, sizeof(struct buffer));
if (bp == NULL) {
- ewprintf("Can't get %d bytes", sizeof(BUFFER));
+ ewprintf("Can't get %d bytes", sizeof(struct buffer));
return (NULL);
}
if ((bp->b_bname = strdup(bname)) == NULL) {
@@ -527,10 +526,10 @@ bfind(const char *bname, int cflag)
* looks good.
*/
int
-bclear(BUFFER *bp)
+bclear(struct buffer *bp)
{
- LINE *lp;
- int s;
+ struct line *lp;
+ int s;
if ((bp->b_flag & BFCHG) != 0 && /* Changed. */
(s = eyesno("Buffer modified; kill anyway")) != TRUE)
@@ -550,10 +549,10 @@ bclear(BUFFER *bp)
* action on redisplay.
*/
int
-showbuffer(BUFFER *bp, MGWIN *wp, int flags)
+showbuffer(struct buffer *bp, struct mgwin *wp, int flags)
{
- BUFFER *obp;
- MGWIN *owp;
+ struct buffer *obp;
+ struct mgwin *owp;
if (wp->w_bufp == bp) { /* Easy case! */
wp->w_flag |= flags;
@@ -596,10 +595,10 @@ showbuffer(BUFFER *bp, MGWIN *wp, int flags)
* Pop the buffer we got passed onto the screen.
* Returns a status.
*/
-MGWIN *
-popbuf(BUFFER *bp)
+struct mgwin *
+popbuf(struct buffer *bp)
{
- MGWIN *wp;
+ struct mgwin *wp;
if (bp->b_nwnd == 0) { /* Not on screen yet. */
if ((wp = wpopup()) == NULL)
@@ -622,8 +621,8 @@ popbuf(BUFFER *bp)
int
bufferinsert(int f, int n)
{
- BUFFER *bp;
- LINE *clp;
+ struct buffer *bp;
+ struct line *clp;
int clo, nline;
char bufn[NBUFN], *bufp;
@@ -679,7 +678,7 @@ bufferinsert(int f, int n)
int
notmodified(int f, int n)
{
- MGWIN *wp;
+ struct mgwin *wp;
curbp->b_flag &= ~BFCHG;
wp = wheadp; /* Update mode lines. */
@@ -698,9 +697,9 @@ notmodified(int f, int n)
* help functions.
*/
int
-popbuftop(BUFFER *bp)
+popbuftop(struct buffer *bp)
{
- MGWIN *wp;
+ struct mgwin *wp;
bp->b_dotp = lforw(bp->b_linep);
bp->b_doto = 0;
diff --git a/usr.bin/mg/cinfo.c b/usr.bin/mg/cinfo.c
index fd5a2cff421..26d05bea8ee 100644
--- a/usr.bin/mg/cinfo.c
+++ b/usr.bin/mg/cinfo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cinfo.c,v 1.13 2005/10/13 06:20:25 kjell Exp $ */
+/* $OpenBSD: cinfo.c,v 1.14 2005/11/18 20:56:52 deraadt Exp $ */
/* This file is in the public domain. */
@@ -94,8 +94,8 @@ const char cinfo[256] = {
char *
keyname(char *cp, size_t len, int k)
{
- const char *np;
- size_t copied;
+ const char *np;
+ size_t copied;
if (k < 0)
k = CHARMASK(k); /* sign extended char */
diff --git a/usr.bin/mg/def.h b/usr.bin/mg/def.h
index 87ecd96c97b..2e19a7a6eb6 100644
--- a/usr.bin/mg/def.h
+++ b/usr.bin/mg/def.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: def.h,v 1.73 2005/11/18 17:35:17 kjell Exp $ */
+/* $OpenBSD: def.h,v 1.74 2005/11/18 20:56:52 deraadt Exp $ */
/* This file is in the public domain. */
@@ -119,11 +119,11 @@ typedef int (*PF)(int, int); /* generally useful type */
* region of a buffer. This makes passing the specification
* of a region around a little bit easier.
*/
-typedef struct {
- struct LINE *r_linep; /* Origin LINE address. */
- int r_offset; /* Origin LINE offset. */
+struct region {
+ struct line *r_linep; /* Origin line address. */
+ int r_offset; /* Origin line offset. */
RSIZE r_size; /* Length in characters. */
-} REGION;
+};
/*
@@ -138,13 +138,13 @@ typedef struct {
* additions will include update hints, and a
* 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 */
+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 */
char *l_text; /* Content of the line */
-} LINE;
+};
/*
* The rationale behind these macros is that you
@@ -170,14 +170,14 @@ typedef struct LINE {
* bytes per window. I feel that this is an acceptable price,
* considering that there are usually only one or two windows.
*/
-typedef struct LIST {
+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;
const char *l_name;
-} LIST;
+};
/*
* Usual hack - to keep from uglifying the code with lotsa
@@ -195,20 +195,20 @@ typedef struct LIST {
* terms of decoupling, the full blown redisplay is just too
* 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" */
+struct mgwin {
+ struct 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. */
- struct LINE *w_wrapline;
-} MGWIN;
+ struct line *w_wrapline;
+};
#define w_wndp w_list.l_p.l_wp
#define w_name w_list.l_name
@@ -239,13 +239,13 @@ struct undo_rec;
* the buffer is kept in a circularly linked list of lines, with
* 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 */
+struct buffer {
+ struct 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 */
@@ -257,7 +257,7 @@ typedef struct BUFFER {
int b_undopos; /* Where we were during the */
/* last undo action. */
struct undo_rec *b_undoptr;
-} BUFFER;
+};
#define b_bufp b_list.l_p.x_bp
#define b_bname b_list.l_name
@@ -279,7 +279,7 @@ struct undo_rec {
DELETE,
BOUNDARY
} type;
- REGION region;
+ struct region region;
int pos;
char *content;
};
@@ -289,355 +289,355 @@ struct undo_rec {
*/
/* tty.c X */
-void ttinit(void);
-void ttreinit(void);
-void tttidy(void);
-void ttmove(int, int);
-void tteeol(void);
-void tteeop(void);
-void ttbeep(void);
-void ttinsl(int, int, int);
-void ttdell(int, int, int);
-void ttwindow(int, int);
-void ttnowindow(void);
-void ttcolor(int);
-void ttresize(void);
+void ttinit(void);
+void ttreinit(void);
+void tttidy(void);
+void ttmove(int, int);
+void tteeol(void);
+void tteeop(void);
+void ttbeep(void);
+void ttinsl(int, int, int);
+void ttdell(int, int, int);
+void ttwindow(int, int);
+void ttnowindow(void);
+void ttcolor(int);
+void ttresize(void);
volatile sig_atomic_t winch_flag;
/* ttyio.c */
-void ttopen(void);
-int ttraw(void);
-void ttclose(void);
-int ttcooked(void);
-int ttputc(int);
-void ttflush(void);
-int ttgetc(void);
-int ttwait(int);
-int typeahead(void);
+void ttopen(void);
+int ttraw(void);
+void ttclose(void);
+int ttcooked(void);
+int ttputc(int);
+void ttflush(void);
+int ttgetc(void);
+int ttwait(int);
+int typeahead(void);
/* dir.c */
-void dirinit(void);
-int changedir(int, int);
-int showcwdir(int, int);
+void dirinit(void);
+int changedir(int, int);
+int showcwdir(int, int);
#ifndef NO_DIRED
/* dired.c */
-BUFFER *dired_(char *);
+struct buffer *dired_(char *);
#endif /* !NO_DIRED */
/* file.c X */
-int fileinsert(int, int);
-int filevisit(int, int);
-int filevisitalt(int, int);
-int filevisitro(int, int);
-int poptofile(int, int);
-BUFFER *findbuffer(char *);
-int readin(char *);
-int insertfile(char *, char *, int);
-int filewrite(int, int);
-int filesave(int, int);
-int buffsave(BUFFER *);
-int makebkfile(int, int);
-int writeout(BUFFER *, char *);
-void upmodes(BUFFER *);
+int fileinsert(int, int);
+int filevisit(int, int);
+int filevisitalt(int, int);
+int filevisitro(int, int);
+int poptofile(int, int);
+struct buffer *findbuffer(char *);
+int readin(char *);
+int insertfile(char *, char *, int);
+int filewrite(int, int);
+int filesave(int, int);
+int buffsave(struct buffer *);
+int makebkfile(int, int);
+int writeout(struct buffer *, char *);
+void upmodes(struct buffer *);
/* line.c X */
-LINE *lalloc(int);
-int lrealloc(LINE *, int);
-void lfree(LINE *);
-void lchange(int);
-int linsert_str(const char *, int);
-int linsert(int, int);
-int lnewline_at(LINE *, int);
-int lnewline(void);
-int ldelete(RSIZE, int);
-int ldelnewline(void);
-int lreplace(RSIZE, char *);
-void kdelete(void);
-int kinsert(int, int);
-int kremove(int);
+struct line *lalloc(int);
+int lrealloc(struct line *, int);
+void lfree(struct line *);
+void lchange(int);
+int linsert_str(const char *, int);
+int linsert(int, int);
+int lnewline_at(struct line *, int);
+int lnewline(void);
+int ldelete(RSIZE, int);
+int ldelnewline(void);
+int lreplace(RSIZE, char *);
+void kdelete(void);
+int kinsert(int, int);
+int kremove(int);
/* window.c X */
-MGWIN *new_window(BUFFER *);
-void free_window(MGWIN *);
-int reposition(int, int);
-int refresh(int, int);
-int nextwind(int, int);
-int prevwind(int, int);
-int onlywind(int, int);
-int splitwind(int, int);
-int enlargewind(int, int);
-int shrinkwind(int, int);
-int delwind(int, int);
-MGWIN *wpopup(void);
+struct mgwin *new_window(struct buffer *);
+void free_window(struct mgwin *);
+int reposition(int, int);
+int refresh(int, int);
+int nextwind(int, int);
+int prevwind(int, int);
+int onlywind(int, int);
+int splitwind(int, int);
+int enlargewind(int, int);
+int shrinkwind(int, int);
+int delwind(int, int);
+struct mgwin *wpopup(void);
/* buffer.c */
-int togglereadonly(int, int);
-BUFFER *bfind(const char *, int);
-int poptobuffer(int, int);
-int killbuffer(BUFFER *);
-int killbuffer_cmd(int, int);
-int savebuffers(int, int);
-int listbuffers(int, int);
-int addlinef(BUFFER *, char *, ...);
+int togglereadonly(int, int);
+struct buffer *bfind(const char *, int);
+int poptobuffer(int, int);
+int killbuffer(struct buffer *);
+int killbuffer_cmd(int, int);
+int savebuffers(int, int);
+int listbuffers(int, int);
+int addlinef(struct buffer *, char *, ...);
#define addline(bp, text) addlinef(bp, "%s", text)
-int anycb(int);
-int bclear(BUFFER *);
-int showbuffer(BUFFER *, MGWIN *, int);
-MGWIN *popbuf(BUFFER *);
-int bufferinsert(int, int);
-int usebuffer(int, int);
-int notmodified(int, int);
-int popbuftop(BUFFER *);
+int anycb(int);
+int bclear(struct buffer *);
+int showbuffer(struct buffer *, struct mgwin *, int);
+struct mgwin *popbuf(struct buffer *);
+int bufferinsert(int, int);
+int usebuffer(int, int);
+int notmodified(int, int);
+int popbuftop(struct buffer *);
/* display.c */
-int vtresize(int, int, int);
-void vtinit(void);
-void vttidy(void);
-void update(void);
+int vtresize(int, int, int);
+void vtinit(void);
+void vttidy(void);
+void update(void);
/* echo.c X */
-void eerase(void);
-int eyorn(const char *);
-int eyesno(const char *);
-void ewprintf(const char *fmt, ...);
-char *ereply(const char *, char *, size_t, ...);
-char *eread(const char *, char *, size_t, int, ...);
-int getxtra(LIST *, LIST *, int, int);
-void free_file_list(LIST *);
+void eerase(void);
+int eyorn(const char *);
+int eyesno(const char *);
+void ewprintf(const char *fmt, ...);
+char *ereply(const char *, char *, size_t, ...);
+char *eread(const char *, char *, size_t, int, ...);
+int getxtra(struct list *, struct list *, int, int);
+void free_file_list(struct list *);
/* fileio.c */
-int ffropen(const char *, BUFFER *);
-int ffwopen(const char *, BUFFER *);
-int ffclose(BUFFER *);
-int ffputbuf(BUFFER *);
-int ffgetline(char *, int, int *);
-int fbackupfile(const char *);
-char *adjustname(const char *);
-char *startupfile(char *);
-int copy(char *, char *);
-LIST *make_file_list(char *);
-int fisdir(const char *);
+int ffropen(const char *, struct buffer *);
+int ffwopen(const char *, struct buffer *);
+int ffclose(struct buffer *);
+int ffputbuf(struct buffer *);
+int ffgetline(char *, int, int *);
+int fbackupfile(const char *);
+char *adjustname(const char *);
+char *startupfile(char *);
+int copy(char *, char *);
+struct list *make_file_list(char *);
+int fisdir(const char *);
/* kbd.c X */
-int do_meta(int, int);
-int bsmap(int, int);
-void ungetkey(int);
-int getkey(int);
-int doin(void);
-int rescan(int, int);
-int universal_argument(int, int);
-int digit_argument(int, int);
-int negative_argument(int, int);
-int selfinsert(int, int);
-int quote(int, int);
+int do_meta(int, int);
+int bsmap(int, int);
+void ungetkey(int);
+int getkey(int);
+int doin(void);
+int rescan(int, int);
+int universal_argument(int, int);
+int digit_argument(int, int);
+int negative_argument(int, int);
+int selfinsert(int, int);
+int quote(int, int);
/* main.c */
-int ctrlg(int, int);
-int quit(int, int);
+int ctrlg(int, int);
+int quit(int, int);
/* ttyio.c */
-void panic(char *);
+void panic(char *);
/* cinfo.c */
-char *keyname(char *, size_t, int);
+char *keyname(char *, size_t, int);
/* basic.c */
-int gotobol(int, int);
-int backchar(int, int);
-int gotoeol(int, int);
-int forwchar(int, int);
-int gotobob(int, int);
-int gotoeob(int, int);
-int forwline(int, int);
-int backline(int, int);
-void setgoal(void);
-int getgoal(LINE *);
-int forwpage(int, int);
-int backpage(int, int);
-int forw1page(int, int);
-int back1page(int, int);
-int pagenext(int, int);
-void isetmark(void);
-int setmark(int, int);
-int swapmark(int, int);
-int gotoline(int, int);
+int gotobol(int, int);
+int backchar(int, int);
+int gotoeol(int, int);
+int forwchar(int, int);
+int gotobob(int, int);
+int gotoeob(int, int);
+int forwline(int, int);
+int backline(int, int);
+void setgoal(void);
+int getgoal(struct line *);
+int forwpage(int, int);
+int backpage(int, int);
+int forw1page(int, int);
+int back1page(int, int);
+int pagenext(int, int);
+void isetmark(void);
+int setmark(int, int);
+int swapmark(int, int);
+int gotoline(int, int);
/* random.c X */
-int showcpos(int, int);
-int getcolpos(void);
-int twiddle(int, int);
-int openline(int, int);
-int newline(int, int);
-int deblank(int, int);
-int justone(int, int);
-int delwhite(int, int);
-int indent(int, int);
-int forwdel(int, int);
-int backdel(int, int);
-int killline(int, int);
-int yank(int, int);
-int space_to_tabstop(int, int);
+int showcpos(int, int);
+int getcolpos(void);
+int twiddle(int, int);
+int openline(int, int);
+int newline(int, int);
+int deblank(int, int);
+int justone(int, int);
+int delwhite(int, int);
+int indent(int, int);
+int forwdel(int, int);
+int backdel(int, int);
+int killline(int, int);
+int yank(int, int);
+int space_to_tabstop(int, int);
/* extend.c X */
-int insert(int, int);
-int bindtokey(int, int);
-int localbind(int, int);
-int define_key(int, int);
-int unbindtokey(int, int);
-int localunbind(int, int);
-int extend(int, int);
-int evalexpr(int, int);
-int evalbuffer(int, int);
-int evalfile(int, int);
-int load(const char *);
-int excline(char *);
+int insert(int, int);
+int bindtokey(int, int);
+int localbind(int, int);
+int define_key(int, int);
+int unbindtokey(int, int);
+int localunbind(int, int);
+int extend(int, int);
+int evalexpr(int, int);
+int evalbuffer(int, int);
+int evalfile(int, int);
+int load(const char *);
+int excline(char *);
/* help.c X */
-int desckey(int, int);
-int wallchart(int, int);
-int help_help(int, int);
-int apropos_command(int, int);
+int desckey(int, int);
+int wallchart(int, int);
+int help_help(int, int);
+int apropos_command(int, int);
/* paragraph.c X */
-int gotobop(int, int);
-int gotoeop(int, int);
-int fillpara(int, int);
-int killpara(int, int);
-int fillword(int, int);
-int setfillcol(int, int);
+int gotobop(int, int);
+int gotoeop(int, int);
+int fillpara(int, int);
+int killpara(int, int);
+int fillword(int, int);
+int setfillcol(int, int);
/* word.c X */
-int backword(int, int);
-int forwword(int, int);
-int upperword(int, int);
-int lowerword(int, int);
-int capword(int, int);
-int delfword(int, int);
-int delbword(int, int);
-int inword(void);
+int backword(int, int);
+int forwword(int, int);
+int upperword(int, int);
+int lowerword(int, int);
+int capword(int, int);
+int delfword(int, int);
+int delbword(int, int);
+int inword(void);
/* region.c X */
-int killregion(int, int);
-int copyregion(int, int);
-int lowerregion(int, int);
-int upperregion(int, int);
-int prefixregion(int, int);
-int setprefix(int, int);
-int region_get_data(REGION *, char *, int);
-int region_put_data(const char *, int);
+int killregion(int, int);
+int copyregion(int, int);
+int lowerregion(int, int);
+int upperregion(int, int);
+int prefixregion(int, int);
+int setprefix(int, int);
+int region_get_data(struct region *, char *, int);
+int region_put_data(const char *, int);
/* search.c X */
-int forwsearch(int, int);
-int backsearch(int, int);
-int searchagain(int, int);
-int forwisearch(int, int);
-int backisearch(int, int);
-int queryrepl(int, int);
-int forwsrch(void);
-int backsrch(void);
-int readpattern(char *);
+int forwsearch(int, int);
+int backsearch(int, int);
+int searchagain(int, int);
+int forwisearch(int, int);
+int backisearch(int, int);
+int queryrepl(int, int);
+int forwsrch(void);
+int backsrch(void);
+int readpattern(char *);
/* spawn.c X */
-int spawncli(int, int);
+int spawncli(int, int);
/* ttykbd.c X */
-void ttykeymapinit(void);
-void ttykeymaptidy(void);
+void ttykeymapinit(void);
+void ttykeymaptidy(void);
/* match.c X */
-int showmatch(int, int);
+int showmatch(int, int);
/* version.c X */
-int showversion(int, int);
+int showversion(int, int);
#ifndef NO_MACRO
/* macro.c X */
-int definemacro(int, int);
-int finishmacro(int, int);
-int executemacro(int, int);
+int definemacro(int, int);
+int finishmacro(int, int);
+int executemacro(int, int);
#endif /* !NO_MACRO */
/* modes.c X */
-int indentmode(int, int);
-int fillmode(int, int);
-int blinkparen(int, int);
+int indentmode(int, int);
+int fillmode(int, int);
+int blinkparen(int, int);
#ifdef NOTAB
-int notabmode(int, int);
+int notabmode(int, int);
#endif /* NOTAB */
-int overwrite(int, int);
-int set_default_mode(int,int);
+int overwrite(int, int);
+int set_default_mode(int,int);
#ifdef REGEX
/* re_search.c X */
-int re_forwsearch(int, int);
-int re_backsearch(int, int);
-int re_searchagain(int, int);
-int re_queryrepl(int, int);
-int replstr(int, int);
-int setcasefold(int, int);
-int delmatchlines(int, int);
-int delnonmatchlines(int, int);
-int cntmatchlines(int, int);
-int cntnonmatchlines(int, int);
+int re_forwsearch(int, int);
+int re_backsearch(int, int);
+int re_searchagain(int, int);
+int re_queryrepl(int, int);
+int replstr(int, int);
+int setcasefold(int, int);
+int delmatchlines(int, int);
+int delnonmatchlines(int, int);
+int cntmatchlines(int, int);
+int cntnonmatchlines(int, int);
#endif /* REGEX */
/* undo.c X */
-void free_undo_record(struct undo_rec *);
-int undo_dump(int, int);
-int undo_enable(int);
-int undo_add_boundary(void);
-int undo_add_insert(LINE *, int, int);
-int undo_add_delete(LINE *, int, int);
-void undo_no_boundary(int);
-int undo_add_change(LINE *, int, int);
-int undo(int, int);
+void free_undo_record(struct undo_rec *);
+int undo_dump(int, int);
+int undo_enable(int);
+int undo_add_boundary(void);
+int undo_add_insert(struct line *, int, int);
+int undo_add_delete(struct line *, int, int);
+void undo_no_boundary(int);
+int undo_add_change(struct line *, int, int);
+int undo(int, int);
/* autoexec.c X */
-int auto_execute(int, int);
-PF *find_autoexec(const char *);
-int add_autoexec(const char *, const char *);
+int auto_execute(int, int);
+PF *find_autoexec(const char *);
+int add_autoexec(const char *, const char *);
/* mail.c X */
-void mail_init(void);
+void mail_init(void);
/* grep.c X */
-int next_error(int, int);
+int next_error(int, int);
/*
* Externals.
*/
-extern BUFFER *bheadp;
-extern BUFFER *curbp;
-extern MGWIN *curwp;
-extern MGWIN *wheadp;
-extern int thisflag;
-extern int lastflag;
-extern int curgoal;
-extern int startrow;
-extern int epresf;
-extern int sgarbf;
-extern int mode;
-extern int nrow;
-extern int ncol;
-extern int ttrow;
-extern int ttcol;
-extern int tttop;
-extern int ttbot;
-extern int tthue;
-extern int defb_nmodes;
-extern int defb_flag;
-extern const char cinfo[];
-extern char *keystrings[];
-extern char pat[NPAT];
+extern struct buffer *bheadp;
+extern struct buffer *curbp;
+extern struct mgwin *curwp;
+extern struct mgwin *wheadp;
+extern int thisflag;
+extern int lastflag;
+extern int curgoal;
+extern int startrow;
+extern int epresf;
+extern int sgarbf;
+extern int mode;
+extern int nrow;
+extern int ncol;
+extern int ttrow;
+extern int ttcol;
+extern int tttop;
+extern int ttbot;
+extern int tthue;
+extern int defb_nmodes;
+extern int defb_flag;
+extern const char cinfo[];
+extern char *keystrings[];
+extern char pat[NPAT];
#ifndef NO_DPROMPT
-extern char prompt[];
+extern char prompt[];
#endif /* !NO_DPROMPT */
/*
* Globals.
*/
-int tceeol;
-int tcinsl;
-int tcdell;
+int tceeol;
+int tcinsl;
+int tcdell;
diff --git a/usr.bin/mg/dired.c b/usr.bin/mg/dired.c
index 18de56e82fb..1a53b4e82ee 100644
--- a/usr.bin/mg/dired.c
+++ b/usr.bin/mg/dired.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dired.c,v 1.30 2005/11/13 07:49:02 kjell Exp $ */
+/* $OpenBSD: dired.c,v 1.31 2005/11/18 20:56:52 deraadt Exp $ */
/* This file is in the public domain. */
@@ -37,7 +37,7 @@ static int d_del(int, int);
static int d_rename(int, int);
static int d_shell_command(int, int);
static int d_create_directory(int, int);
-static int d_makename(LINE *, char *, int);
+static int d_makename(struct line *, char *, int);
extern struct keymap_s helpmap, cXmap, metamap;
@@ -177,8 +177,8 @@ dired_init(void)
int
dired(int f, int n)
{
- char dirname[NFILEN], *bufp, *slash;
- BUFFER *bp;
+ char dirname[NFILEN], *bufp, *slash;
+ struct buffer *bp;
if (curbp->b_fname && curbp->b_fname[0] != '\0') {
(void)strlcpy(dirname, curbp->b_fname, sizeof(dirname));
@@ -206,9 +206,9 @@ dired(int f, int n)
int
d_otherwindow(int f, int n)
{
- char dirname[NFILEN], *bufp, *slash;
- BUFFER *bp;
- MGWIN *wp;
+ char dirname[NFILEN], *bufp, *slash;
+ struct buffer *bp;
+ struct mgwin *wp;
if (curbp->b_fname && curbp->b_fname[0] != '\0') {
(void)strlcpy(dirname, curbp->b_fname, sizeof(dirname));
@@ -289,9 +289,9 @@ d_undelbak(int f, int n)
int
d_findfile(int f, int n)
{
- BUFFER *bp;
- int s;
- char fname[NFILEN];
+ struct buffer *bp;
+ int s;
+ char fname[NFILEN];
if ((s = d_makename(curwp->w_dotp, fname, sizeof(fname))) == ABORT)
return (FALSE);
@@ -313,10 +313,10 @@ d_findfile(int f, int n)
int
d_ffotherwindow(int f, int n)
{
- char fname[NFILEN];
- int s;
- BUFFER *bp;
- MGWIN *wp;
+ char fname[NFILEN];
+ int s;
+ struct buffer *bp;
+ struct mgwin *wp;
if ((s = d_makename(curwp->w_dotp, fname, sizeof(fname))) == ABORT)
return (FALSE);
@@ -335,8 +335,8 @@ d_ffotherwindow(int f, int n)
int
d_expunge(int f, int n)
{
- LINE *lp, *nlp;
- char fname[NFILEN];
+ struct line *lp, *nlp;
+ char fname[NFILEN];
for (lp = lforw(curbp->b_linep); lp != curbp->b_linep; lp = nlp) {
nlp = lforw(lp);
@@ -374,7 +374,7 @@ d_copy(int f, int n)
char frname[NFILEN], toname[NFILEN], *bufp;
int stat;
size_t off;
- BUFFER *bp;
+ struct buffer *bp;
if (d_makename(curwp->w_dotp, frname, sizeof(frname)) != FALSE) {
ewprintf("Not a file");
@@ -401,10 +401,10 @@ d_copy(int f, int n)
int
d_rename(int f, int n)
{
- char frname[NFILEN], toname[NFILEN], *bufp;
- int stat;
- size_t off;
- BUFFER *bp;
+ char frname[NFILEN], toname[NFILEN], *bufp;
+ int stat;
+ size_t off;
+ struct buffer *bp;
if (d_makename(curwp->w_dotp, frname, sizeof(frname)) != FALSE) {
ewprintf("Not a file");
@@ -427,6 +427,7 @@ d_rename(int f, int n)
return (showbuffer(bp, curwp, WFHARD | WFMODE));
}
+/* ARGSUSED */
void
reaper(int signo __attribute__((unused)))
{
@@ -448,8 +449,8 @@ d_shell_command(int f, int n)
int infd, fds[2];
pid_t pid;
struct sigaction olda, newa;
- BUFFER *bp;
- MGWIN *wp;
+ struct buffer *bp;
+ struct mgwin *wp;
FILE *fin;
bp = bfind("*Shell Command Output*", TRUE);
@@ -535,7 +536,7 @@ d_create_directory(int f, int n)
{
char tocreate[MAXPATHLEN], *bufp;
size_t off;
- BUFFER *bp;
+ struct buffer *bp;
off = strlcpy(tocreate, curbp->b_fname, sizeof(tocreate));
if (off >= sizeof(tocreate) - 1)
@@ -557,7 +558,7 @@ d_create_directory(int f, int n)
#define NAME_FIELD 8
static int
-d_makename(LINE *lp, char *fn, int len)
+d_makename(struct line *lp, char *fn, int len)
{
int i;
char *p, *ep;
@@ -584,10 +585,10 @@ d_makename(LINE *lp, char *fn, int len)
/*
* XXX dirname needs to have enough place to store an additional '/'.
*/
-BUFFER *
+struct buffer *
dired_(char *dirname)
{
- BUFFER *bp;
+ struct buffer *bp;
FILE *dirpipe;
char line[256];
int len, ret;
diff --git a/usr.bin/mg/display.c b/usr.bin/mg/display.c
index df381b66aac..66ed5a715fe 100644
--- a/usr.bin/mg/display.c
+++ b/usr.bin/mg/display.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: display.c,v 1.22 2005/06/14 18:14:40 kjell Exp $ */
+/* $OpenBSD: display.c,v 1.23 2005/11/18 20:56:52 deraadt Exp $ */
/* This file is in the public domain. */
@@ -43,13 +43,13 @@
* the longest line possible. v_text is allocated
* dynamically to fit the screen width.
*/
-typedef struct {
+struct video {
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; /* The actual characters. */
-} VIDEO;
+};
#define VFCHG 0x0001 /* Changed. */
#define VFHBAD 0x0002 /* Hash and cost are bad. */
@@ -63,11 +63,11 @@ typedef struct {
* fields can be "char", and the cost a "short", but
* this makes the code worse on the VAX.
*/
-typedef struct {
+struct score {
XCHAR s_itrace; /* "i" index for track back. */
XCHAR s_jtrace; /* "j" index for trace back. */
XSHORT s_cost; /* Display cost. */
-} SCORE;
+};
void vtmove(int, int);
void vtputc(int);
@@ -75,12 +75,12 @@ void vtpute(int);
int vtputs(const char *);
void vteeol(void);
void updext(int, int);
-void modeline(MGWIN *);
+void modeline(struct mgwin *);
void setscores(int, int);
void traceback(int, int, int, int);
-void ucopy(VIDEO *, VIDEO *);
-void uline(int, VIDEO *, VIDEO *);
-void hash(VIDEO *);
+void ucopy(struct video *, struct video *);
+void uline(int, struct video *, struct video *);
+void hash(struct video *);
int sgarbf = TRUE; /* TRUE if screen is garbage. */
@@ -94,10 +94,10 @@ int ttbot = HUGE; /* Bottom of scroll region. */
int lbound = 0; /* leftmost bound of the current */
/* line being displayed */
-VIDEO **vscreen; /* Edge vector, virtual. */
-VIDEO **pscreen; /* Edge vector, physical. */
-VIDEO *video; /* Actual screen data. */
-VIDEO blanks; /* Blank line image. */
+struct video **vscreen; /* Edge vector, virtual. */
+struct video **pscreen; /* Edge vector, physical. */
+struct video *video; /* Actual screen data. */
+struct video blanks; /* Blank line image. */
#ifdef GOSLING
/*
@@ -107,7 +107,7 @@ VIDEO blanks; /* Blank line image. */
* It would be "SCORE score[NROW][NROW]" in old speak.
* Look at "setscores" to understand what is up.
*/
-SCORE *score; /* [NROW * NROW] */
+struct score *score; /* [NROW * NROW] */
#endif
/*
@@ -120,7 +120,7 @@ vtresize(int force, int newrow, int newcol)
int i;
int rowchanged, colchanged;
static int first_run = 1;
- VIDEO *vp;
+ struct video *vp;
if (newrow < 1 || newcol < 1)
return (FALSE);
@@ -165,17 +165,17 @@ vtresize(int force, int newrow, int newcol)
}
#ifdef GOSLING
- TRYREALLOC(score, newrow * newrow * sizeof(SCORE));
+ TRYREALLOC(score, newrow * newrow * sizeof(struct score));
#endif
- TRYREALLOC(vscreen, (newrow - 1) * sizeof(VIDEO *));
- TRYREALLOC(pscreen, (newrow - 1) * sizeof(VIDEO *));
- TRYREALLOC(video, (2 * (newrow - 1)) * sizeof(VIDEO));
+ TRYREALLOC(vscreen, (newrow - 1) * sizeof(struct video *));
+ TRYREALLOC(pscreen, (newrow - 1) * sizeof(struct video *));
+ TRYREALLOC(video, (2 * (newrow - 1)) * sizeof(struct video));
/*
* Zero-out the entries we just allocated.
*/
for (i = vidstart; i < 2 * (newrow - 1); i++)
- memset(&video[i], 0, sizeof(VIDEO));
+ memset(&video[i], 0, sizeof(struct video));
/*
* Reinitialize vscreen and pscreen arrays completely.
@@ -285,7 +285,7 @@ vtmove(int row, int col)
void
vtputc(int c)
{
- VIDEO *vp;
+ struct video *vp;
c &= 0xff;
@@ -321,7 +321,7 @@ vtputc(int c)
void
vtpute(int c)
{
- VIDEO *vp;
+ struct video *vp;
c &= 0xff;
@@ -354,7 +354,7 @@ vtpute(int c)
void
vteeol(void)
{
- VIDEO *vp;
+ struct video *vp;
vp = vscreen[vtrow];
while (vtcol < ncol)
@@ -373,10 +373,10 @@ vteeol(void)
void
update(void)
{
- LINE *lp;
- MGWIN *wp;
- VIDEO *vp1;
- VIDEO *vp2;
+ struct line *lp;
+ struct mgwin *wp;
+ struct video *vp1;
+ struct video *vp2;
int c, i, j;
int hflag;
int currow, curcol;
@@ -609,14 +609,14 @@ update(void)
/*
* Update a saved copy of a line,
- * kept in a VIDEO structure. The "vvp" is
+ * kept in a video structure. The "vvp" is
* the one in the "vscreen". The "pvp" is the one
* in the "pscreen". This is called to make the
* virtual and physical screens the same when
* display has done an update.
*/
void
-ucopy(VIDEO *vvp, VIDEO *pvp)
+ucopy(struct video *vvp, struct video *pvp)
{
vvp->v_flag &= ~VFCHG; /* Changes done. */
pvp->v_flag = vvp->v_flag; /* Update model. */
@@ -634,7 +634,7 @@ ucopy(VIDEO *vvp, VIDEO *pvp)
void
updext(int currow, int curcol)
{
- LINE *lp; /* pointer to current line */
+ struct line *lp; /* pointer to current line */
int j; /* index into line */
if (ncol < 2)
@@ -661,14 +661,14 @@ updext(int currow, int curcol)
/*
* Update a single line. This routine only
* uses basic functionality (no insert and delete character,
- * but erase to end of line). The "vvp" points at the VIDEO
+ * but erase to end of line). The "vvp" points at the video
* structure for the line on the virtual screen, and the "pvp"
* is the same for the physical screen. Avoid erase to end of
* line when updating CMODE color lines, because of the way that
* reverse video works on most terminals.
*/
void
-uline(int row, VIDEO *vvp, VIDEO *pvp)
+uline(int row, struct video *vvp, struct video *pvp)
{
char *cp1;
char *cp2;
@@ -763,10 +763,10 @@ uline(int row, VIDEO *vvp, VIDEO *pvp)
* characters may never be seen.
*/
void
-modeline(MGWIN *wp)
+modeline(struct mgwin *wp)
{
int n;
- BUFFER *bp;
+ struct buffer *bp;
int mode;
n = wp->w_toprow + wp->w_ntrows; /* Location. */
@@ -840,7 +840,7 @@ vtputs(const char *s)
* just about any machine.
*/
void
-hash(VIDEO *vp)
+hash(struct video *vp)
{
int i, n;
char *s;
@@ -890,10 +890,10 @@ hash(VIDEO *vp)
void
setscores(int offs, int size)
{
- SCORE *sp;
- SCORE *sp1;
- VIDEO **vp, **pp;
- VIDEO **vbase, **pbase;
+ struct score *sp;
+ struct score *sp1;
+ struct video **vp, **pp;
+ struct video **vbase, **pbase;
int tempcost;
int bestcost;
int j, i;
diff --git a/usr.bin/mg/echo.c b/usr.bin/mg/echo.c
index f78d4eff663..cc6a9aedfe3 100644
--- a/usr.bin/mg/echo.c
+++ b/usr.bin/mg/echo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: echo.c,v 1.39 2005/11/11 18:40:51 deraadt Exp $ */
+/* $OpenBSD: echo.c,v 1.40 2005/11/18 20:56:52 deraadt Exp $ */
/* This file is in the public domain. */
@@ -28,7 +28,7 @@ static void eputi(int, int);
static void eputl(long, int);
static void eputs(const char *);
static void eputc(char);
-static LIST *copy_list(LIST *);
+static struct list *copy_list(struct list *);
int epresf = FALSE; /* stuff in echo line flag */
@@ -95,7 +95,7 @@ eyesno(const char *sp)
if (rep[0] != '\0') {
#ifndef NO_MACRO
if (macrodef) {
- LINE *lp = maclcur;
+ struct line *lp = maclcur;
maclcur = lp->l_bp;
maclcur->l_fp = lp->l_fp;
@@ -150,8 +150,8 @@ veread(const char *fp, char *buf, size_t nbuf, int flag, va_list ap)
int mr = 0; /* match left arrow */
int ml = 0; /* match right arrow */
int esc = 0; /* position in esc pattern */
- BUFFER *bp; /* completion list buffer */
- MGWIN *wp; /* window for compl list */
+ struct buffer *bp; /* completion list buffer */
+ struct mgwin *wp; /* window for compl list */
int match; /* esc match found */
int cc, rr; /* saved ttcol, ttrow */
char *ret; /* return value */
@@ -340,7 +340,7 @@ veread(const char *fp, char *buf, size_t nbuf, int flag, va_list ap)
}
#ifndef NO_MACRO
if (macrodef) {
- LINE *lp;
+ struct line *lp;
if ((lp = lalloc(cpos)) == NULL) {
static char falseval[] = "";
@@ -488,8 +488,8 @@ fail:
static int
complt(int flags, int c, char *buf, size_t nbuf, int cpos, int *nx)
{
- LIST *lh, *lh2;
- LIST *wholelist = NULL;
+ struct list *lh, *lh2;
+ struct list *wholelist = NULL;
int i, nxtra, nhits, bxtra, msglen, nshown;
int wflag = FALSE;
char *msg;
@@ -585,9 +585,9 @@ complt(int flags, int c, char *buf, size_t nbuf, int cpos, int *nx)
static int
complt_list(int flags, int c, char *buf, int cpos)
{
- LIST *lh, *lh2, *lh3;
- LIST *wholelist = NULL;
- BUFFER *bp;
+ struct list *lh, *lh2, *lh3;
+ struct list *wholelist = NULL;
+ struct buffer *bp;
int i, maxwidth, width;
int preflen = 0;
int oldrow = ttrow;
@@ -738,7 +738,7 @@ complt_list(int flags, int c, char *buf, int cpos)
* this is normal.
*/
int
-getxtra(LIST *lp1, LIST *lp2, int cpos, int wflag)
+getxtra(struct list *lp1, struct list *lp2, int cpos, int wflag)
{
int i;
@@ -918,9 +918,9 @@ eputc(char c)
}
void
-free_file_list(LIST *lp)
+free_file_list(struct list *lp)
{
- LIST *next;
+ struct list *next;
while (lp) {
next = lp->l_next;
@@ -929,14 +929,14 @@ free_file_list(LIST *lp)
}
}
-static LIST *
-copy_list(LIST *lp)
+static struct list *
+copy_list(struct list *lp)
{
- LIST *current, *last, *nxt;
+ struct list *current, *last, *nxt;
last = NULL;
while (lp) {
- current = (LIST *)malloc(sizeof(LIST));
+ current = (struct list *)malloc(sizeof(struct list));
if (current == NULL) {
for (current = last; current; current = nxt) {
nxt = current->l_next;
diff --git a/usr.bin/mg/extend.c b/usr.bin/mg/extend.c
index cd889a000e1..2c91901f582 100644
--- a/usr.bin/mg/extend.c
+++ b/usr.bin/mg/extend.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: extend.c,v 1.39 2005/11/07 23:49:09 kjell Exp $ */
+/* $OpenBSD: extend.c,v 1.40 2005/11/18 20:56:52 deraadt Exp $ */
/* This file is in the public domain. */
@@ -100,7 +100,7 @@ remap(KEYMAP *curmap, /* pointer to the map being changed */
int i, n1, n2, nold;
KEYMAP *mp, *newmap;
PF *pfp;
- MAP_ELEMENT *mep;
+ struct map_element *mep;
if (ele >= &curmap->map_element[curmap->map_num] || c < ele->k_base) {
if (ele > &curmap->map_element[0] && (funct != NULL ||
@@ -171,7 +171,7 @@ remap(KEYMAP *curmap, /* pointer to the map being changed */
ele->k_prefmap = pref_map;
else {
if ((mp = (KEYMAP *)malloc(sizeof(KEYMAP) +
- (MAPINIT - 1) * sizeof(MAP_ELEMENT))) == NULL) {
+ (MAPINIT - 1) * sizeof(struct map_element))) == NULL) {
ewprintf("Out of memory");
ele->k_funcp[c - ele->k_base] =
curmap->map_default;
@@ -200,7 +200,7 @@ remap(KEYMAP *curmap, /* pointer to the map being changed */
else {
if ((mp = malloc(sizeof(KEYMAP) +
(MAPINIT - 1) *
- sizeof(MAP_ELEMENT))) == NULL) {
+ sizeof(struct map_element))) == NULL) {
ewprintf("Out of memory");
ele->k_funcp[c - ele->k_base] =
curmap->map_default;
@@ -247,7 +247,7 @@ remap(KEYMAP *curmap, /* pointer to the map being changed */
curmap->map_num++;
if (pref_map == NULL) {
if ((mp = malloc(sizeof(KEYMAP) + (MAPINIT - 1)
- * sizeof(MAP_ELEMENT))) == NULL) {
+ * sizeof(struct map_element))) == NULL) {
ewprintf("Out of memory");
ele->k_funcp[c - ele->k_base] =
curmap->map_default;
@@ -270,13 +270,13 @@ remap(KEYMAP *curmap, /* pointer to the map being changed */
static KEYMAP *
reallocmap(KEYMAP *curmap)
{
- MAPS *mps;
+ struct maps_s *mps;
KEYMAP *mp;
int i;
if ((mp = (KEYMAP *)malloc((unsigned)(sizeof(KEYMAP) +
(curmap->map_max + (MAPGROW - 1)) *
- sizeof(MAP_ELEMENT)))) == NULL) {
+ sizeof(struct map_element)))) == NULL) {
ewprintf("Out of memory");
return (NULL);
}
@@ -557,7 +557,7 @@ extend(int f, int n)
if ((funct = name_function(bufp)) != NULL) {
#ifndef NO_MACRO
if (macrodef) {
- LINE *lp = maclcur;
+ struct line *lp = maclcur;
macro[macrocount - 1].m_funct = funct;
maclcur = lp->l_bp;
maclcur->l_fp = lp->l_fp;
@@ -611,8 +611,8 @@ evalexpr(int f, int n)
int
evalbuffer(int f, int n)
{
- LINE *lp;
- BUFFER *bp = curbp;
+ struct line *lp;
+ struct buffer *bp = curbp;
int s;
static char excbuf[128];
@@ -690,7 +690,7 @@ int
excline(char *line)
{
PF fp;
- LINE *lp, *np;
+ struct line *lp, *np;
int status, c, f, n;
char *funcp, *tmp;
char *argp = NULL;
diff --git a/usr.bin/mg/file.c b/usr.bin/mg/file.c
index 8aee558914d..589fb0a60f8 100644
--- a/usr.bin/mg/file.c
+++ b/usr.bin/mg/file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: file.c,v 1.44 2005/11/13 07:24:48 kjell Exp $ */
+/* $OpenBSD: file.c,v 1.45 2005/11/18 20:56:52 deraadt Exp $ */
/* This file is in the public domain. */
@@ -41,7 +41,7 @@ fileinsert(int f, int n)
int
filevisit(int f, int n)
{
- BUFFER *bp;
+ struct buffer *bp;
char fname[NFILEN], *bufp, *adjf, *slash;
int status;
@@ -86,7 +86,7 @@ filevisit(int f, int n)
int
filevisitalt(int f, int n)
{
- BUFFER *bp;
+ struct buffer *bp;
char fname[NFILEN], *bufp, *adjf, *slash;
int status;
@@ -145,8 +145,8 @@ filevisitro(int f, int n)
int
poptofile(int f, int n)
{
- BUFFER *bp;
- MGWIN *wp;
+ struct buffer *bp;
+ struct mgwin *wp;
char fname[NFILEN], *adjf, *bufp;
int status;
@@ -176,10 +176,10 @@ poptofile(int f, int n)
* Given a file name, either find the buffer it uses, or create a new
* empty buffer to put it in.
*/
-BUFFER *
+struct buffer *
findbuffer(char *fn)
{
- BUFFER *bp;
+ struct buffer *bp;
char bname[NBUFN], fname[NBUFN];
unsigned int count, remain, i;
@@ -211,7 +211,7 @@ findbuffer(char *fn)
int
readin(char *fname)
{
- MGWIN *wp;
+ struct mgwin *wp;
int status, i, ro = FALSE;
PF *ael;
@@ -288,10 +288,10 @@ static int linesize = 0;
int
insertfile(char *fname, char *newname, int replacebuf)
{
- BUFFER *bp;
- LINE *lp1, *lp2;
- LINE *olp; /* line we started at */
- MGWIN *wp;
+ struct buffer *bp;
+ struct line *lp1, *lp2;
+ struct line *olp; /* line we started at */
+ struct mgwin *wp;
int nbytes, s, nline, siz, x = -1, x2;
int opos; /* offset we started at */
@@ -540,7 +540,7 @@ filesave(int f, int n)
* the value of makebackup.
*/
int
-buffsave(BUFFER *bp)
+buffsave(struct buffer *bp)
{
int s;
@@ -615,7 +615,7 @@ makebkfile(int f, int n)
* "fileio.c" package. Most of the grief is checking of some sort.
*/
int
-writeout(BUFFER *bp, char *fn)
+writeout(struct buffer *bp, char *fn)
{
int s;
@@ -639,9 +639,9 @@ writeout(BUFFER *bp, char *fn)
* mode line updated.
*/
void
-upmodes(BUFFER *bp)
+upmodes(struct buffer *bp)
{
- MGWIN *wp;
+ struct mgwin *wp;
for (wp = wheadp; wp != NULL; wp = wp->w_wndp)
if (bp == NULL || curwp->w_bufp == bp)
diff --git a/usr.bin/mg/fileio.c b/usr.bin/mg/fileio.c
index 8300bb43842..228c1b96d1d 100644
--- a/usr.bin/mg/fileio.c
+++ b/usr.bin/mg/fileio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fileio.c,v 1.61 2005/11/13 07:49:02 kjell Exp $ */
+/* $OpenBSD: fileio.c,v 1.62 2005/11/18 20:56:52 deraadt Exp $ */
/* This file is in the public domain. */
@@ -28,7 +28,7 @@ static FILE *ffp;
* Open a file for reading.
*/
int
-ffropen(const char *fn, BUFFER *bp)
+ffropen(const char *fn, struct buffer *bp)
{
struct stat statbuf;
@@ -60,7 +60,7 @@ ffropen(const char *fn, BUFFER *bp)
* Open a file for writing.
*/
int
-ffwopen(const char *fn, BUFFER *bp)
+ffwopen(const char *fn, struct buffer *bp)
{
int fd;
mode_t mode = DEFFILEMODE;
@@ -101,7 +101,7 @@ ffwopen(const char *fn, BUFFER *bp)
*/
/* ARGSUSED */
int
-ffclose(BUFFER *bp)
+ffclose(struct buffer *bp)
{
(void) fclose(ffp);
return (FIOSUC);
@@ -112,9 +112,9 @@ ffclose(BUFFER *bp)
* buffer. Return the status.
*/
int
-ffputbuf(BUFFER *bp)
+ffputbuf(struct buffer *bp)
{
- LINE *lp, *lpend;
+ struct line *lp, *lpend;
lpend = bp->b_linep;
for (lp = lforw(lpend); lp != lpend; lp = lforw(lp)) {
@@ -412,21 +412,21 @@ copy(char *frname, char *toname)
#endif /* NO_DIRED */
struct filelist {
- LIST fl_l;
+ struct list fl_l;
char fl_name[NFILEN + 2];
};
/*
* return list of file names that match the name in buf.
*/
-LIST *
+struct list *
make_file_list(char *buf)
{
char *dir, *file, *cp;
int len, preflen, ret;
DIR *dirp;
struct dirent *dent;
- LIST *last;
+ struct list *last;
struct filelist *current;
char prefixx[NFILEN + 1];
@@ -540,7 +540,7 @@ make_file_list(char *buf)
}
current->fl_l.l_next = last;
current->fl_l.l_name = current->fl_name;
- last = (LIST *) current;
+ last = (struct list *) current;
}
closedir(dirp);
diff --git a/usr.bin/mg/funmap.c b/usr.bin/mg/funmap.c
index 7a7469b638e..9994783a771 100644
--- a/usr.bin/mg/funmap.c
+++ b/usr.bin/mg/funmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: funmap.c,v 1.16 2005/11/07 23:32:20 kjell Exp $ */
+/* $OpenBSD: funmap.c,v 1.17 2005/11/18 20:56:52 deraadt Exp $ */
/*
* Copyright (c) 2001 Artur Grabowski <art@openbsd.org>. All rights reserved.
*
@@ -278,11 +278,11 @@ function_name(PF fun)
/*
* List possible function name completions.
*/
-LIST *
+struct list *
complete_function_list(const char *fname)
{
struct funmap *fn;
- LIST *head, *el;
+ struct list *head, *el;
int len;
len = strlen(fname);
diff --git a/usr.bin/mg/funmap.h b/usr.bin/mg/funmap.h
index ffbe3bdb79f..36773b911d3 100644
--- a/usr.bin/mg/funmap.h
+++ b/usr.bin/mg/funmap.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: funmap.h,v 1.5 2005/04/28 07:23:56 otto Exp $ */
+/* $OpenBSD: funmap.h,v 1.6 2005/11/18 20:56:52 deraadt Exp $ */
/*
* Copyright (c) 2001 Artur Grabowski <art@openbsd.org>. All rights reserved.
*
@@ -26,5 +26,5 @@
void funmap_init(void);
PF name_function(const char *);
const char *function_name(PF);
-LIST *complete_function_list(const char *);
+struct list *complete_function_list(const char *);
int funmap_add(PF, const char *);
diff --git a/usr.bin/mg/grep.c b/usr.bin/mg/grep.c
index 4862eed0648..bf7eafd4d4e 100644
--- a/usr.bin/mg/grep.c
+++ b/usr.bin/mg/grep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: grep.c,v 1.23 2005/11/12 19:13:09 deraadt Exp $ */
+/* $OpenBSD: grep.c,v 1.24 2005/11/18 20:56:53 deraadt Exp $ */
/*
* Copyright (c) 2001 Artur Grabowski <art@openbsd.org>.
* Copyright (c) 2005 Kjell Wooding <kjell@openbsd.org>.
@@ -39,7 +39,7 @@ int next_error(int, int);
static int grep(int, int);
static int compile(int, int);
static int gid(int, int);
-static BUFFER *compile_mode(const char *, const char *, const char *);
+static struct buffer *compile_mode(const char *, const char *, const char *);
static int getbufcwd(char *, size_t);
void grep_init(void);
@@ -51,8 +51,8 @@ static char compile_last_command[NFILEN] = "make ";
*
* XXX - need some kind of callback to find out when those get killed.
*/
-MGWIN *compile_win;
-BUFFER *compile_buffer;
+struct mgwin *compile_win;
+struct buffer *compile_buffer;
static PF compile_pf[] = {
compile_goto_error
@@ -84,8 +84,8 @@ grep(int f, int n)
{
char command[NFILEN + 20];
char prompt[NFILEN], *bufp;
- BUFFER *bp;
- MGWIN *wp;
+ struct buffer *bp;
+ struct mgwin *wp;
char path[NFILEN];
/* get buffer cwd */
@@ -118,8 +118,8 @@ compile(int f, int n)
{
char command[NFILEN + 20];
char prompt[NFILEN], *bufp;
- BUFFER *bp;
- MGWIN *wp;
+ struct buffer *bp;
+ struct mgwin *wp;
char path[NFILEN];
/* get buffer cwd */
@@ -157,8 +157,8 @@ gid(int f, int n)
{
char command[NFILEN + 20];
char prompt[NFILEN], c, *bufp;
- BUFFER *bp;
- MGWIN *wp;
+ struct buffer *bp;
+ struct mgwin *wp;
int i, j;
char path[NFILEN];
@@ -213,10 +213,10 @@ gid(int f, int n)
return (TRUE);
}
-BUFFER *
+struct buffer *
compile_mode(const char *name, const char *command, const char *path)
{
- BUFFER *bp;
+ struct buffer *bp;
FILE *pipe;
char *buf;
size_t len;
@@ -280,13 +280,13 @@ compile_mode(const char *name, const char *command, const char *path)
static int
compile_goto_error(int f, int n)
{
- BUFFER *bp;
- MGWIN *wp;
+ struct buffer *bp;
+ struct mgwin *wp;
char *fname, *line, *lp, *ln;
int lineno, len;
char *adjf;
const char *errstr;
- LINE *last;
+ struct line *last;
compile_win = curwp;
compile_buffer = curbp;
@@ -310,7 +310,7 @@ compile_goto_error(int f, int n)
goto fail;
if ((ln = strsep(&lp, ":")) == NULL || *ln == '\0')
goto fail;
- lineno = strtonum(ln, INT_MIN, INT_MAX, &errstr);
+ lineno = (int)strtonum(ln, INT_MIN, INT_MAX, &errstr);
if (errstr)
goto fail;
diff --git a/usr.bin/mg/help.c b/usr.bin/mg/help.c
index ca793febe72..7a1c5d5457b 100644
--- a/usr.bin/mg/help.c
+++ b/usr.bin/mg/help.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: help.c,v 1.26 2005/10/14 15:41:33 deraadt Exp $ */
+/* $OpenBSD: help.c,v 1.27 2005/11/18 20:56:53 deraadt Exp $ */
/* This file is in the public domain. */
@@ -16,7 +16,7 @@
#include "macro.h"
#endif /* !NO_MACRO */
-static int showall(BUFFER *, KEYMAP *, char *);
+static int showall(struct buffer *, KEYMAP *, char *);
static int findbind(KEYMAP *, PF, char *, size_t);
/*
@@ -104,7 +104,7 @@ int
wallchart(int f, int n)
{
int m;
- BUFFER *bp;
+ struct buffer *bp;
bp = bfind("*help*", TRUE);
if (bclear(bp) != TRUE)
@@ -125,7 +125,7 @@ wallchart(int f, int n)
}
static int
-showall(BUFFER *bp, KEYMAP *map, char *prefix)
+showall(struct buffer *bp, KEYMAP *map, char *prefix)
{
KEYMAP *newmap;
char buf[80], key[16];
@@ -177,8 +177,8 @@ help_help(int f, int n)
int
apropos_command(int f, int n)
{
- BUFFER *bp;
- LIST *fnames, *el;
+ struct buffer *bp;
+ struct list *fnames, *el;
char string[32];
if (eread("apropos: ", string, sizeof(string), EFNUL | EFNEW) == NULL)
diff --git a/usr.bin/mg/kbd.c b/usr.bin/mg/kbd.c
index 59b1adcba65..02cd6494ab2 100644
--- a/usr.bin/mg/kbd.c
+++ b/usr.bin/mg/kbd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kbd.c,v 1.17 2005/06/14 18:14:40 kjell Exp $ */
+/* $OpenBSD: kbd.c,v 1.18 2005/11/18 20:56:53 deraadt Exp $ */
/* This file is in the public domain. */
@@ -28,7 +28,7 @@ static int use_metakey = TRUE;
static int pushed = FALSE;
static int pushedc;
-MAP_ELEMENT *ele;
+struct map_element *ele;
struct key key;
@@ -132,8 +132,8 @@ getkey(int flag)
PF
doscan(KEYMAP *map, int c, KEYMAP **newmap)
{
- MAP_ELEMENT *elec = &map->map_element[0];
- MAP_ELEMENT *last = &map->map_element[map->map_num];
+ struct map_element *elec = &map->map_element[0];
+ struct map_element *last = &map->map_element[map->map_num];
PF ret;
while (elec < last && c > elec->k_num)
@@ -346,7 +346,7 @@ int
selfinsert(int f, int n)
{
#ifndef NO_MACRO
- LINE *lp;
+ struct line *lp;
#endif /* !NO_MACRO */
int c;
int count;
diff --git a/usr.bin/mg/kbd.h b/usr.bin/mg/kbd.h
index 6b7f3845140..d51f5839898 100644
--- a/usr.bin/mg/kbd.h
+++ b/usr.bin/mg/kbd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: kbd.h,v 1.16 2005/06/14 18:14:40 kjell Exp $ */
+/* $OpenBSD: kbd.h,v 1.17 2005/11/18 20:56:53 deraadt Exp $ */
/* This file is in the public domain. */
@@ -6,14 +6,14 @@
* 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 */
+struct map_element {
+ 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 */
-} MAP_ELEMENT;
+};
/*
* Predefined keymaps are NOT type KEYMAP because final array needs
@@ -22,10 +22,10 @@ typedef struct {
*/
#define KEYMAPE(NUM) { \
- short map_num; /* elements used */ \
- short map_max; /* elements allocated */ \
- PF map_default; /* default function */ \
- MAP_ELEMENT map_element[NUM]; /* really [e_max] */ \
+ short map_num; /* elements used */ \
+ short map_max; /* elements allocated */\
+ PF map_default; /* default function */ \
+ struct map_element map_element[NUM]; /* really [e_max] */ \
}
typedef struct keymap_s KEYMAPE(1) KEYMAP;
@@ -37,23 +37,23 @@ typedef struct keymap_s KEYMAPE(1) KEYMAP;
/* Max number of default bindings added to avoid creating new element */
#define MAPELEDEF 4
-typedef struct MAPS_S {
+struct maps_s {
KEYMAP *p_map;
const char *p_name;
- struct MAPS_S *p_next;
-} MAPS;
+ struct maps_s *p_next;
+};
-extern MAPS *maps;
-extern MAPS fundamental_mode;
+extern struct maps_s *maps;
+extern struct maps_s fundamental_mode;
#define fundamental_map (fundamental_mode.p_map)
-int dobindkey(KEYMAP *, const char *, const char *);
-KEYMAP *name_map(const char *);
-MAPS *name_mode(const char *);
-PF doscan(KEYMAP *, int, KEYMAP **);
-const char *map_name(KEYMAP *);
-void maps_init(void);
-int maps_add(KEYMAP *, const char *);
+int dobindkey(KEYMAP *, const char *, const char *);
+KEYMAP *name_map(const char *);
+struct maps_s *name_mode(const char *);
+PF doscan(KEYMAP *, int, KEYMAP **);
+const char *map_name(KEYMAP *);
+void maps_init(void);
+int maps_add(KEYMAP *, const char *);
-extern MAP_ELEMENT *ele;
-extern MAPS *defb_modes[];
+extern struct map_element *ele;
+extern struct maps_s *defb_modes[];
diff --git a/usr.bin/mg/keymap.c b/usr.bin/mg/keymap.c
index babdd4731e7..b3aedc8c82e 100644
--- a/usr.bin/mg/keymap.c
+++ b/usr.bin/mg/keymap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: keymap.c,v 1.36 2005/11/07 23:32:20 kjell Exp $ */
+/* $OpenBSD: keymap.c,v 1.37 2005/11/18 20:56:53 deraadt Exp $ */
/* This file is in the public domain. */
@@ -443,7 +443,7 @@ static struct KEYMAPE (1 + IMAPEXT) overwmap = {
/*
* The basic (root) keyboard map
*/
-MAPS fundamental_mode = { (KEYMAP *)&fundmap, "fundamental" };
+struct maps_s fundamental_mode = { (KEYMAP *)&fundmap, "fundamental" };
/*
* give names to the maps, for use by help etc. If the map is to be bindable,
@@ -454,7 +454,7 @@ MAPS fundamental_mode = { (KEYMAP *)&fundmap, "fundamental" };
* modes.c also.
*/
-static MAPS map_table[] = {
+static struct maps_s map_table[] = {
{(KEYMAP *) &fillmap, "fill",},
{(KEYMAP *) &indntmap, "indent",},
{(KEYMAP *) &blinkmap, "blink",},
@@ -471,13 +471,13 @@ static MAPS map_table[] = {
{NULL, NULL}
};
-MAPS *maps;
+struct maps_s *maps;
void
maps_init(void)
{
int i;
- MAPS *mp;
+ struct maps_s *mp;
maps = &fundamental_mode;
for (i = 0; map_table[i].p_name != NULL; i++) {
@@ -493,7 +493,7 @@ maps_init(void)
int
maps_add(KEYMAP *map, const char *name)
{
- MAPS *mp;
+ struct maps_s *mp;
if ((mp = malloc(sizeof(*mp))) == NULL)
return (FALSE);
@@ -509,7 +509,7 @@ maps_add(KEYMAP *map, const char *name)
const char *
map_name(KEYMAP *map)
{
- MAPS *mp;
+ struct maps_s *mp;
for (mp = maps; mp != NULL; mp = mp->p_next)
if (mp->p_map == map)
@@ -517,10 +517,10 @@ map_name(KEYMAP *map)
return (NULL);
}
-MAPS *
+struct maps_s *
name_mode(const char *name)
{
- MAPS *mp;
+ struct maps_s *mp;
for (mp = maps; mp != NULL; mp = mp->p_next)
if (strcmp(mp->p_name, name) == 0)
@@ -531,6 +531,7 @@ name_mode(const char *name)
KEYMAP *
name_map(const char *name)
{
- MAPS *mp;
+ struct maps_s *mp;
+
return ((mp = name_mode(name)) == NULL ? NULL : mp->p_map);
}
diff --git a/usr.bin/mg/line.c b/usr.bin/mg/line.c
index 814b8c0903d..34b11f0b169 100644
--- a/usr.bin/mg/line.c
+++ b/usr.bin/mg/line.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: line.c,v 1.27 2005/11/18 17:35:17 kjell Exp $ */
+/* $OpenBSD: line.c,v 1.28 2005/11/18 20:56:53 deraadt Exp $ */
/* This file is in the public domain. */
@@ -48,10 +48,10 @@ static int kgrow(int);
* Allocate a new line of size `used'. lrealloc() can be called if the line
* ever needs to grow beyond that.
*/
-LINE *
+struct line *
lalloc(int used)
{
- LINE *lp;
+ struct line *lp;
if ((lp = malloc(sizeof(*lp))) == NULL)
return (NULL);
@@ -66,7 +66,7 @@ lalloc(int used)
}
int
-lrealloc(LINE *lp, int newsize)
+lrealloc(struct line *lp, int newsize)
{
char *tmp;
@@ -86,10 +86,10 @@ lrealloc(LINE *lp, int newsize)
* magic conditions described in the above comments don't hold here.
*/
void
-lfree(LINE *lp)
+lfree(struct line *lp)
{
- BUFFER *bp;
- MGWIN *wp;
+ struct buffer *bp;
+ struct mgwin *wp;
for (wp = wheadp; wp != NULL; wp = wp->w_wndp) {
if (wp->w_linep == lp)
@@ -132,7 +132,7 @@ lfree(LINE *lp)
void
lchange(int flag)
{
- MGWIN *wp;
+ struct mgwin *wp;
/* update mode lines if this is the first change. */
if ((curbp->b_flag & BFCHG) == 0) {
@@ -160,8 +160,8 @@ lchange(int flag)
int
linsert_str(const char *s, int n)
{
- LINE *lp1;
- MGWIN *wp;
+ struct line *lp1;
+ struct mgwin *wp;
RSIZE i;
int doto;
@@ -180,7 +180,7 @@ linsert_str(const char *s, int n)
/* special case for the end */
if (lp1 == curbp->b_linep) {
- LINE *lp2, *lp3;
+ struct line *lp2, *lp3;
/* now should only happen in empty buffer */
if (curwp->w_doto != 0)
@@ -250,8 +250,8 @@ linsert_str(const char *s, int n)
int
linsert(int n, int c)
{
- LINE *lp1;
- MGWIN *wp;
+ struct line *lp1;
+ struct mgwin *wp;
RSIZE i;
int doto;
@@ -270,7 +270,7 @@ linsert(int n, int c)
/* special case for the end */
if (lp1 == curbp->b_linep) {
- LINE *lp2, *lp3;
+ struct line *lp2, *lp3;
/* now should only happen in empty buffer */
if (curwp->w_doto != 0) {
@@ -331,11 +331,11 @@ linsert(int n, int c)
}
int
-lnewline_at(LINE *lp1, int doto)
+lnewline_at(struct line *lp1, int doto)
{
- LINE *lp2;
+ struct line *lp2;
int nlen;
- MGWIN *wp;
+ struct mgwin *wp;
int retval = TRUE;
lchange(WFHARD);
@@ -414,9 +414,9 @@ lnewline(void)
int
ldelete(RSIZE n, int kflag)
{
- LINE *dotp;
+ struct line *dotp;
RSIZE chunk;
- MGWIN *wp;
+ struct mgwin *wp;
int doto;
char *cp1, *cp2;
@@ -509,8 +509,8 @@ ldelete(RSIZE n, int kflag)
int
ldelnewline(void)
{
- LINE *lp1, *lp2, *lp3;
- MGWIN *wp;
+ struct line *lp1, *lp2, *lp3;
+ struct mgwin *wp;
if (curbp->b_flag & BFREADONLY) {
ewprintf("Buffer is read only");
diff --git a/usr.bin/mg/macro.c b/usr.bin/mg/macro.c
index 4d55b51039a..90d39bc259e 100644
--- a/usr.bin/mg/macro.c
+++ b/usr.bin/mg/macro.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: macro.c,v 1.9 2005/06/14 18:14:40 kjell Exp $ */
+/* $OpenBSD: macro.c,v 1.10 2005/11/18 20:56:53 deraadt Exp $ */
/* This file is in the public domain. */
@@ -15,8 +15,8 @@ int inmacro = FALSE;
int macrodef = FALSE;
int macrocount = 0;
-LINE *maclhead = NULL;
-LINE *maclcur;
+struct line *maclhead = NULL;
+struct line *maclcur;
union macrodef macro[MAXMACRO];
@@ -24,7 +24,7 @@ union macrodef macro[MAXMACRO];
int
definemacro(int f, int n)
{
- LINE *lp1, *lp2;
+ struct line *lp1, *lp2;
macrocount = 0;
diff --git a/usr.bin/mg/macro.h b/usr.bin/mg/macro.h
index 5c1f431805e..52cc83d263b 100644
--- a/usr.bin/mg/macro.h
+++ b/usr.bin/mg/macro.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: macro.h,v 1.6 2005/06/14 18:14:40 kjell Exp $ */
+/* $OpenBSD: macro.h,v 1.7 2005/11/18 20:56:53 deraadt Exp $ */
/* This file is in the public domain. */
@@ -17,5 +17,5 @@ union macrodef {
extern union macrodef macro[MAXMACRO];
-extern LINE *maclhead;
-extern LINE *maclcur;
+extern struct line *maclhead;
+extern struct line *maclcur;
diff --git a/usr.bin/mg/mail.c b/usr.bin/mg/mail.c
index 1337e3dc101..1309683ac2d 100644
--- a/usr.bin/mg/mail.c
+++ b/usr.bin/mg/mail.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mail.c,v 1.8 2005/10/14 19:46:46 kjell Exp $ */
+/* $OpenBSD: mail.c,v 1.9 2005/11/18 20:56:53 deraadt Exp $ */
/*
* This file is in the public domain.
*
@@ -127,7 +127,7 @@ fake_self_insert(int f, int n)
*/
const char *trail;
int save_doto = curwp->w_doto;
- LINE *save_dotp = curwp->w_dotp;
+ struct line *save_dotp = curwp->w_dotp;
int tlen = len - col;
trail = curwp->w_dotp->l_text + col;
diff --git a/usr.bin/mg/main.c b/usr.bin/mg/main.c
index e0db0087e50..2cf9bbd40fe 100644
--- a/usr.bin/mg/main.c
+++ b/usr.bin/mg/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.44 2005/10/13 20:43:17 deraadt Exp $ */
+/* $OpenBSD: main.c,v 1.45 2005/11/18 20:56:53 deraadt Exp $ */
/* This file is in the public domain. */
@@ -20,10 +20,10 @@ int thisflag; /* flags, this command */
int lastflag; /* flags, last command */
int curgoal; /* goal column */
int startrow; /* row to start */
-BUFFER *curbp; /* current buffer */
-BUFFER *bheadp; /* BUFFER list head */
-MGWIN *curwp; /* current window */
-MGWIN *wheadp; /* MGWIN listhead */
+struct buffer *curbp; /* current buffer */
+struct buffer *bheadp; /* BUFFER list head */
+struct mgwin *curwp; /* current window */
+struct mgwin *wheadp; /* MGWIN listhead */
char pat[NPAT]; /* pattern */
static void edinit(PF);
@@ -173,8 +173,8 @@ notnum:
static void
edinit(PF init_fcn)
{
- BUFFER *bp;
- MGWIN *wp;
+ struct buffer *bp;
+ struct mgwin *wp;
bheadp = NULL;
bp = bfind("*scratch*", TRUE); /* Text buffer. */
diff --git a/usr.bin/mg/match.c b/usr.bin/mg/match.c
index a166da66a4c..64fa3d8f46d 100644
--- a/usr.bin/mg/match.c
+++ b/usr.bin/mg/match.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: match.c,v 1.11 2005/06/14 18:14:40 kjell Exp $ */
+/* $OpenBSD: match.c,v 1.12 2005/11/18 20:56:53 deraadt Exp $ */
/* This file is in the public domain. */
@@ -17,7 +17,7 @@
#include "key.h"
static int balance(void);
-static void displaymatch(LINE *, int);
+static void displaymatch(struct line *, int);
/*
* Balance table. When balance() encounters a character that is to be
@@ -76,7 +76,7 @@ showmatch(int f, int n)
static int
balance(void)
{
- LINE *clp;
+ struct line *clp;
int cbo;
int c, i, depth;
int rbal, lbal;
@@ -140,9 +140,9 @@ balance(void)
* move dot to the matching character, sit there a while, then move back.
*/
static void
-displaymatch(LINE *clp, int cbo)
+displaymatch(struct line *clp, int cbo)
{
- LINE *tlp;
+ struct line *tlp;
int tbo;
int cp;
int bufo;
diff --git a/usr.bin/mg/modes.c b/usr.bin/mg/modes.c
index df9f30c8b98..4d312018f08 100644
--- a/usr.bin/mg/modes.c
+++ b/usr.bin/mg/modes.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: modes.c,v 1.12 2005/08/09 00:53:48 kjell Exp $ */
+/* $OpenBSD: modes.c,v 1.13 2005/11/18 20:56:53 deraadt Exp $ */
/* This file is in the public domain. */
@@ -14,14 +14,14 @@
static int changemode(int, int, char *);
int defb_nmodes = 0;
-MAPS *defb_modes[PBMODES] = { &fundamental_mode };
+struct maps_s *defb_modes[PBMODES] = { &fundamental_mode };
int defb_flag = 0;
static int
changemode(int f, int n, char *mode)
{
int i;
- MAPS *m;
+ struct maps_s *m;
if ((m = name_mode(mode)) == NULL) {
ewprintf("Can't find mode %s", mode);
@@ -116,7 +116,7 @@ int
set_default_mode(int f, int n)
{
int i;
- MAPS *m;
+ struct maps_s *m;
char mode[32], *bufp;
if ((bufp = eread("Set Default Mode: ", mode, sizeof(mode),
diff --git a/usr.bin/mg/paragraph.c b/usr.bin/mg/paragraph.c
index f26ca82eba6..8d3439d7a1e 100644
--- a/usr.bin/mg/paragraph.c
+++ b/usr.bin/mg/paragraph.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: paragraph.c,v 1.12 2005/10/18 18:54:48 kjell Exp $ */
+/* $OpenBSD: paragraph.c,v 1.13 2005/11/18 20:56:53 deraadt Exp $ */
/* This file is in the public domain. */
@@ -127,7 +127,7 @@ fillpara(int f, int n)
int newlength; /* tentative new line length */
int eolflag; /* was at end of line */
int retval; /* return value */
- LINE *eopline; /* pointer to line just past EOP */
+ struct line *eopline; /* pointer to line just past EOP */
char wbuf[MAXWORD]; /* buffer for current word */
undo_add_boundary();
diff --git a/usr.bin/mg/random.c b/usr.bin/mg/random.c
index 25ba3a64d69..cbe7504d621 100644
--- a/usr.bin/mg/random.c
+++ b/usr.bin/mg/random.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: random.c,v 1.14 2005/11/18 19:04:09 kjell Exp $ */
+/* $OpenBSD: random.c,v 1.15 2005/11/18 20:56:53 deraadt Exp $ */
/* This file is in the public domain. */
@@ -24,7 +24,7 @@
int
showcpos(int f, int n)
{
- LINE *clp;
+ struct line *clp;
long nchar, cchar;
int nline, row;
int cline, cbyte; /* Current line/char/byte */
@@ -114,7 +114,7 @@ getcolpos(void)
int
twiddle(int f, int n)
{
- LINE *dotp;
+ struct line *dotp;
int doto, cr;
dotp = curwp->w_dotp;
@@ -170,7 +170,7 @@ openline(int f, int n)
int
newline(int f, int n)
{
- LINE *lp;
+ struct line *lp;
int s;
if (n < 0)
@@ -196,7 +196,7 @@ newline(int f, int n)
int
deblank(int f, int n)
{
- LINE *lp1, *lp2;
+ struct line *lp1, *lp2;
RSIZE nld;
lp1 = curwp->w_dotp;
@@ -352,7 +352,7 @@ backdel(int f, int n)
int
killline(int f, int n)
{
- LINE *nextp;
+ struct line *nextp;
RSIZE chunk;
int i, c;
@@ -415,7 +415,7 @@ killline(int f, int n)
int
yank(int f, int n)
{
- LINE *lp;
+ struct line *lp;
int c, i, nline;
if (n < 0)
diff --git a/usr.bin/mg/re_search.c b/usr.bin/mg/re_search.c
index 70fa6eb48c2..ffe546240fe 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.20 2005/11/18 17:35:17 kjell Exp $ */
+/* $OpenBSD: re_search.c,v 1.21 2005/11/18 20:56:53 deraadt Exp $ */
/* This file is in the public domain. */
@@ -211,7 +211,7 @@ static int
re_doreplace(RSIZE plen, char *st)
{
int j, k, s, more, num, state;
- LINE *clp;
+ struct line *clp;
char repstr[REPLEN];
clp = curwp->w_dotp;
@@ -299,7 +299,7 @@ static int
re_forwsrch(void)
{
int tbo, error;
- LINE *clp;
+ struct line *clp;
clp = curwp->w_dotp;
tbo = curwp->w_doto;
@@ -344,7 +344,7 @@ re_forwsrch(void)
static int
re_backsrch(void)
{
- LINE *clp;
+ struct line *clp;
int tbo;
regmatch_t lastmatch;
@@ -505,7 +505,7 @@ killmatches(int cond)
{
int s, error;
int count = 0;
- LINE *clp;
+ struct line *clp;
clp = curwp->w_dotp;
if (curwp->w_doto == llength(clp))
@@ -578,7 +578,7 @@ countmatches(int cond)
{
int error;
int count = 0;
- LINE *clp;
+ struct line *clp;
clp = curwp->w_dotp;
if (curwp->w_doto == llength(clp))
diff --git a/usr.bin/mg/region.c b/usr.bin/mg/region.c
index c1af414f488..dc0c0c50b60 100644
--- a/usr.bin/mg/region.c
+++ b/usr.bin/mg/region.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: region.c,v 1.18 2005/08/09 00:53:48 kjell Exp $ */
+/* $OpenBSD: region.c,v 1.19 2005/11/18 20:56:53 deraadt Exp $ */
/* This file is in the public domain. */
@@ -11,8 +11,8 @@
#include "def.h"
-static int getregion(REGION *);
-static int setsize(REGION *, RSIZE);
+static int getregion(struct region *);
+static int setsize(struct region *, RSIZE);
/*
* Kill the region. Ask "getregion" to figure out the bounds of the region.
@@ -23,7 +23,7 @@ int
killregion(int f, int n)
{
int s;
- REGION region;
+ struct region region;
if ((s = getregion(&region)) != TRUE)
return (s);
@@ -44,8 +44,8 @@ killregion(int f, int n)
int
copyregion(int f, int n)
{
- LINE *linep;
- REGION region;
+ struct line *linep;
+ struct region region;
int loffs;
int s;
@@ -88,8 +88,8 @@ copyregion(int f, int n)
int
lowerregion(int f, int n)
{
- LINE *linep;
- REGION region;
+ struct line *linep;
+ struct region region;
int loffs, c, s;
if (curbp->b_flag & BFREADONLY) {
@@ -129,8 +129,8 @@ lowerregion(int f, int n)
int
upperregion(int f, int n)
{
- LINE *linep;
- REGION region;
+ struct line *linep;
+ struct region region;
int loffs, c, s;
if (curbp->b_flag & BFREADONLY) {
@@ -171,9 +171,9 @@ upperregion(int f, int n)
* because I might add a "if regions is big, ask before clobbering" flag.
*/
static int
-getregion(REGION *rp)
+getregion(struct region *rp)
{
- LINE *flp, *blp;
+ struct line *flp, *blp;
long fsize, bsize;
if (curwp->w_markp == NULL) {
@@ -227,7 +227,7 @@ getregion(REGION *rp)
* Set size, and check for overflow.
*/
static int
-setsize(REGION *rp, RSIZE size)
+setsize(struct region *rp, RSIZE size)
{
rp->r_size = size;
if (rp->r_size != size) {
@@ -258,8 +258,8 @@ static char prefix_string[PREFIXLENGTH] = {'>', '\0'};
int
prefixregion(int f, int n)
{
- LINE *first, *last;
- REGION region;
+ struct line *first, *last;
+ struct region region;
char *prefix = prefix_string;
int nline;
int s;
@@ -325,10 +325,10 @@ setprefix(int f, int n)
#endif /* PREFIXREGION */
int
-region_get_data(REGION *reg, char *buf, int len)
+region_get_data(struct region *reg, char *buf, int len)
{
int i, off;
- LINE *lp;
+ struct line *lp;
off = reg->r_offset;
lp = reg->r_linep;
diff --git a/usr.bin/mg/search.c b/usr.bin/mg/search.c
index e3ebcd29510..e8ddff9a7ab 100644
--- a/usr.bin/mg/search.c
+++ b/usr.bin/mg/search.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: search.c,v 1.24 2005/11/18 17:35:17 kjell Exp $ */
+/* $OpenBSD: search.c,v 1.25 2005/11/18 20:56:53 deraadt Exp $ */
/* This file is in the public domain. */
@@ -25,11 +25,11 @@
#define SRCH_ACCM (-4)
#define SRCH_MARK (-5)
-typedef struct {
+struct srchcom {
int s_code;
- LINE *s_dotp;
+ struct line *s_dotp;
int s_doto;
-} SRCHCOM;
+};
static int isearch(int);
static void is_cpush(int);
@@ -42,7 +42,7 @@ static void is_prompt(int, int, int);
static void is_dspl(char *, int);
static int eq(int, int, int);
-static SRCHCOM cmds[NSRCH];
+static struct srchcom cmds[NSRCH];
static int cip;
int srch_lastdir = SRCH_NOPR; /* Last search flags. */
@@ -154,7 +154,7 @@ backisearch(int f, int n)
static int
isearch(int dir)
{
- LINE *clp;
+ struct line *clp;
int c;
int cbo;
@@ -446,7 +446,7 @@ static int
is_find(int dir)
{
int plen, odoto;
- LINE *odotp;
+ struct line *odotp;
odoto = curwp->w_doto;
odotp = curwp->w_dotp;
@@ -643,7 +643,7 @@ replstr(int f, int n)
int
forwsrch(void)
{
- LINE *clp, *tlp;
+ struct line *clp, *tlp;
int cbo, tbo, c, i, xcase = 0;
char *pp;
@@ -695,7 +695,7 @@ fail: ;
int
backsrch(void)
{
- LINE *clp, *tlp;
+ struct line *clp, *tlp;
int cbo, tbo, c, i, xcase = 0;
char *epp, *pp;
diff --git a/usr.bin/mg/theo.c b/usr.bin/mg/theo.c
index fcdea4301df..2ee732d9c6d 100644
--- a/usr.bin/mg/theo.c
+++ b/usr.bin/mg/theo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: theo.c,v 1.96 2005/11/18 01:41:08 kjell Exp $ */
+/* $OpenBSD: theo.c,v 1.97 2005/11/18 20:56:53 deraadt Exp $ */
/*
* Copyright (c) 2002 Artur Grabowski <art@openbsd.org>
* All rights reserved.
@@ -56,8 +56,8 @@ theo_init(void)
static int
theo(int f, int n)
{
- BUFFER *bp;
- MGWIN *wp;
+ struct buffer *bp;
+ struct mgwin *wp;
bp = bfind("theo", TRUE);
if (bclear(bp) != TRUE)
diff --git a/usr.bin/mg/undo.c b/usr.bin/mg/undo.c
index 8c2836261a7..3e7ac4bfdfe 100644
--- a/usr.bin/mg/undo.c
+++ b/usr.bin/mg/undo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: undo.c,v 1.34 2005/11/18 17:11:21 kjell Exp $ */
+/* $OpenBSD: undo.c,v 1.35 2005/11/18 20:56:53 deraadt Exp $ */
/*
* Copyright (c) 2002 Vincent Labrecque <vincent@openbsd.org>
* All rights reserved.
@@ -49,8 +49,8 @@ int undo_disable_flag;
/*
* Local functions
*/
-static int find_dot(LINE *, int);
-static int find_lo(int, LINE **, int *);
+static int find_dot(struct line *, int);
+static int find_lo(int, struct line **, int *);
static struct undo_rec *new_undo_record(void);
static int drop_oldest_undo_record(void);
@@ -63,10 +63,10 @@ static int drop_oldest_undo_record(void);
* need to have an absolute dot to have something reliable.
*/
static int
-find_dot(LINE *lp, int off)
+find_dot(struct line *lp, int off)
{
int count = 0;
- LINE *p;
+ struct line *p;
for (p = curbp->b_linep; p != lp; p = lforw(p)) {
if (count != 0) {
@@ -84,9 +84,9 @@ find_dot(LINE *lp, int off)
}
static int
-find_lo(int pos, LINE **olp, int *offset)
+find_lo(int pos, struct line **olp, int *offset)
{
- LINE *p;
+ struct line *p;
p = curbp->b_linep;
while (pos > llength(p)) {
@@ -225,9 +225,9 @@ undo_add_boundary(void)
}
int
-undo_add_insert(LINE *lp, int offset, int size)
+undo_add_insert(struct line *lp, int offset, int size)
{
- REGION reg;
+ struct region reg;
struct undo_rec *rec;
int pos;
@@ -256,7 +256,7 @@ undo_add_insert(LINE *lp, int offset, int size)
rec = new_undo_record();
rec->pos = pos;
rec->type = INSERT;
- memmove(&rec->region, &reg, sizeof(REGION));
+ memmove(&rec->region, &reg, sizeof(struct region));
rec->content = NULL;
undo_add_boundary();
@@ -270,9 +270,9 @@ undo_add_insert(LINE *lp, int offset, int size)
* This of course must be done _before_ the actual deletion is done.
*/
int
-undo_add_delete(LINE *lp, int offset, int size)
+undo_add_delete(struct line *lp, int offset, int size)
{
- REGION reg;
+ struct region reg;
struct undo_rec *rec;
int pos;
@@ -301,7 +301,7 @@ undo_add_delete(LINE *lp, int offset, int size)
rec->pos = pos;
rec->type = DELETE;
- memmove(&rec->region, &reg, sizeof(REGION));
+ memmove(&rec->region, &reg, sizeof(struct region));
do {
rec->content = malloc(reg.r_size + 1);
} while ((rec->content == NULL) && drop_oldest_undo_record());
@@ -323,7 +323,7 @@ undo_add_delete(LINE *lp, int offset, int size)
* This of course must be called before the change takes place.
*/
int
-undo_add_change(LINE *lp, int offset, int size)
+undo_add_change(struct line *lp, int offset, int size)
{
if (undo_disable_flag)
return (TRUE);
@@ -345,8 +345,8 @@ int
undo_dump(int f, int n)
{
struct undo_rec *rec;
- BUFFER *bp;
- MGWIN *wp;
+ struct buffer *bp;
+ struct mgwin *wp;
char buf[4096], tmp[1024];
int num;
@@ -435,7 +435,7 @@ undo(int f, int n)
{
struct undo_rec *ptr, *nptr;
int done, rval;
- LINE *lp;
+ struct line *lp;
int offset, save, dot;
static int nulled = FALSE;
diff --git a/usr.bin/mg/window.c b/usr.bin/mg/window.c
index b56722605b1..bdde3099ee6 100644
--- a/usr.bin/mg/window.c
+++ b/usr.bin/mg/window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: window.c,v 1.18 2005/10/11 01:08:53 kjell Exp $ */
+/* $OpenBSD: window.c,v 1.19 2005/11/18 20:56:53 deraadt Exp $ */
/* This file is in the public domain. */
@@ -8,12 +8,12 @@
#include "def.h"
-MGWIN *
-new_window(BUFFER *bp)
+struct mgwin *
+new_window(struct buffer *bp)
{
- MGWIN *wp;
+ struct mgwin *wp;
- wp = calloc(1, sizeof(MGWIN));
+ wp = calloc(1, sizeof(struct mgwin));
if (wp == NULL)
return (NULL);
@@ -67,9 +67,8 @@ reposition(int f, int n)
int
refresh(int f, int n)
{
- MGWIN *wp;
- int oldnrow;
- int oldncol;
+ struct mgwin *wp;
+ int oldnrow, oldncol;
oldnrow = nrow;
oldncol = ncol;
@@ -103,7 +102,7 @@ refresh(int f, int n)
int
nextwind(int f, int n)
{
- MGWIN *wp;
+ struct mgwin *wp;
if ((wp = curwp->w_wndp) == NULL)
wp = wheadp;
@@ -122,7 +121,7 @@ nextwind(int f, int n)
int
prevwind(int f, int n)
{
- MGWIN *wp1, *wp2;
+ struct mgwin *wp1, *wp2;
wp1 = wheadp;
wp2 = curwp;
@@ -146,9 +145,9 @@ prevwind(int f, int n)
int
onlywind(int f, int n)
{
- MGWIN *wp;
- LINE *lp;
- int i;
+ struct mgwin *wp;
+ struct line *lp;
+ int i;
while (wheadp != curwp) {
wp = wheadp;
@@ -196,9 +195,9 @@ onlywind(int f, int n)
int
splitwind(int f, int n)
{
- MGWIN *wp, *wp1, *wp2;
- LINE *lp;
- int ntru, ntrd, ntrl;
+ struct mgwin *wp, *wp1, *wp2;
+ struct line *lp;
+ int ntru, ntrd, ntrl;
if (curwp->w_ntrows < 3) {
ewprintf("Cannot split a %d line window", curwp->w_ntrows);
@@ -279,9 +278,9 @@ splitwind(int f, int n)
int
enlargewind(int f, int n)
{
- MGWIN *adjwp;
- LINE *lp;
- int i;
+ struct mgwin *adjwp;
+ struct line *lp;
+ int i;
if (n < 0)
return (shrinkwind(f, -n));
@@ -328,9 +327,9 @@ enlargewind(int f, int n)
int
shrinkwind(int f, int n)
{
- MGWIN *adjwp;
- LINE *lp;
- int i;
+ struct mgwin *adjwp;
+ struct line *lp;
+ int i;
if (n < 0)
return (enlargewind(f, -n));
@@ -382,7 +381,7 @@ shrinkwind(int f, int n)
int
delwind(int f, int n)
{
- MGWIN *wp, *nwp;
+ struct mgwin *wp, *nwp;
wp = curwp; /* Cheap... */
@@ -416,10 +415,10 @@ delwind(int f, int n)
* Pick the uppermost window that isn't the current window. An LRU algorithm
* might be better. Return a pointer, or NULL on error.
*/
-MGWIN *
+struct mgwin *
wpopup(void)
{
- MGWIN *wp;
+ struct mgwin *wp;
if (wheadp->w_wndp == NULL &&
splitwind(FFRAND, 0) == FALSE)
diff --git a/usr.bin/mg/word.c b/usr.bin/mg/word.c
index 452a4dae7b3..41518fc4134 100644
--- a/usr.bin/mg/word.c
+++ b/usr.bin/mg/word.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: word.c,v 1.12 2005/11/11 18:40:51 deraadt Exp $ */
+/* $OpenBSD: word.c,v 1.13 2005/11/18 20:56:53 deraadt Exp $ */
/* This file is in the public domain. */
@@ -197,9 +197,9 @@ capword(int f, int n)
RSIZE
countfword()
{
- RSIZE size;
- LINE *dotp;
- int doto;
+ RSIZE size;
+ struct line *dotp;
+ int doto;
dotp = curwp->w_dotp;
doto = curwp->w_doto;
@@ -225,9 +225,9 @@ out:
int
delfword(int f, int n)
{
- RSIZE size;
- LINE *dotp;
- int doto;
+ RSIZE size;
+ struct line *dotp;
+ int doto;
if (curbp->b_flag & BFREADONLY) {
ewprintf("Buffer is read-only");