summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjell Wooding <kjell@cvs.openbsd.org>2006-07-25 08:22:33 +0000
committerKjell Wooding <kjell@cvs.openbsd.org>2006-07-25 08:22:33 +0000
commitb27fa2f6a9aae6a0a87897200334b193aa2882dd (patch)
tree78c6dd499c6a7fa94bfdc2b904111a8000d3f2e4
parent13c96fecbc7c5b3efb9b2f86588c8027f4de4ae0 (diff)
Rename the header line of a buffer to b_headp, from the remarkably
unintuitive b_linep. No binary change.
-rw-r--r--usr.bin/mg/basic.c32
-rw-r--r--usr.bin/mg/buffer.c32
-rw-r--r--usr.bin/mg/def.h6
-rw-r--r--usr.bin/mg/dired.c12
-rw-r--r--usr.bin/mg/display.c8
-rw-r--r--usr.bin/mg/extend.c4
-rw-r--r--usr.bin/mg/file.c10
-rw-r--r--usr.bin/mg/fileio.c4
-rw-r--r--usr.bin/mg/grep.c10
-rw-r--r--usr.bin/mg/line.c12
-rw-r--r--usr.bin/mg/main.c4
-rw-r--r--usr.bin/mg/match.c4
-rw-r--r--usr.bin/mg/paragraph.c10
-rw-r--r--usr.bin/mg/random.c12
-rw-r--r--usr.bin/mg/re_search.c12
-rw-r--r--usr.bin/mg/region.c10
-rw-r--r--usr.bin/mg/search.c14
-rw-r--r--usr.bin/mg/undo.c12
-rw-r--r--usr.bin/mg/window.c12
-rw-r--r--usr.bin/mg/yank.c8
20 files changed, 114 insertions, 114 deletions
diff --git a/usr.bin/mg/basic.c b/usr.bin/mg/basic.c
index 023b88d7ee1..8160966cdf9 100644
--- a/usr.bin/mg/basic.c
+++ b/usr.bin/mg/basic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: basic.c,v 1.24 2006/06/01 09:45:05 kjell Exp $ */
+/* $OpenBSD: basic.c,v 1.25 2006/07/25 08:22:32 kjell Exp $ */
/* This file is in the public domain */
@@ -42,7 +42,7 @@ backchar(int f, int n)
return (forwchar(f, -n));
while (n--) {
if (curwp->w_doto == 0) {
- if ((lp = lback(curwp->w_dotp)) == curbp->b_linep) {
+ if ((lp = lback(curwp->w_dotp)) == curbp->b_headp) {
if (!(f & FFRAND))
ewprintf("Beginning of buffer");
return (FALSE);
@@ -83,7 +83,7 @@ forwchar(int f, int n)
while (n--) {
if (curwp->w_doto == llength(curwp->w_dotp)) {
curwp->w_dotp = lforw(curwp->w_dotp);
- if (curwp->w_dotp == curbp->b_linep) {
+ if (curwp->w_dotp == curbp->b_headp) {
curwp->w_dotp = lback(curwp->w_dotp);
if (!(f & FFRAND))
ewprintf("End of buffer");
@@ -107,7 +107,7 @@ int
gotobob(int f, int n)
{
(void) setmark(f, n);
- curwp->w_dotp = lforw(curbp->b_linep);
+ curwp->w_dotp = lforw(curbp->b_headp);
curwp->w_doto = 0;
curwp->w_flag |= WFFULL;
curwp->w_dotline = 1;
@@ -123,7 +123,7 @@ int
gotoeob(int f, int n)
{
(void) setmark(f, n);
- curwp->w_dotp = lback(curbp->b_linep);
+ curwp->w_dotp = lback(curbp->b_headp);
curwp->w_doto = llength(curwp->w_dotp);
curwp->w_dotline = curwp->w_bufp->b_lines;
curwp->w_flag |= WFFULL;
@@ -145,7 +145,7 @@ forwline(int f, int n)
if (n < 0)
return (backline(f | FFRAND, -n));
- if ((dlp = curwp->w_dotp) == curbp->b_linep)
+ if ((dlp = curwp->w_dotp) == curbp->b_headp)
return(TRUE);
if ((lastflag & CFCPCN) == 0) /* Fix goal. */
setgoal();
@@ -154,7 +154,7 @@ forwline(int f, int n)
return (TRUE);
while (n--) {
dlp = lforw(dlp);
- if (dlp == curbp->b_linep) {
+ if (dlp == curbp->b_headp) {
curwp->w_dotp = lback(dlp);
curwp->w_doto = llength(curwp->w_dotp);
curwp->w_flag |= WFMOVE;
@@ -188,7 +188,7 @@ backline(int f, int n)
setgoal();
thisflag |= CFCPCN;
dlp = curwp->w_dotp;
- while (n-- && lback(dlp) != curbp->b_linep) {
+ while (n-- && lback(dlp) != curbp->b_headp) {
dlp = lback(dlp);
curwp->w_dotline--;
}
@@ -271,14 +271,14 @@ forwpage(int f, int n)
n *= curwp->w_ntrows; /* to lines. */
#endif
lp = curwp->w_linep;
- while (n-- && lforw(lp) != curbp->b_linep) {
+ while (n-- && lforw(lp) != curbp->b_headp) {
lp = lforw(lp);
curwp->w_dotline++;
}
curwp->w_linep = lp;
curwp->w_flag |= WFFULL;
/* if in current window, don't move dot */
- for (n = curwp->w_ntrows; n-- && lp != curbp->b_linep; lp = lforw(lp))
+ for (n = curwp->w_ntrows; n-- && lp != curbp->b_headp; lp = lforw(lp))
if (lp == curwp->w_dotp)
return (TRUE);
curwp->w_dotp = curwp->w_linep;
@@ -311,14 +311,14 @@ backpage(int f, int n)
n *= curwp->w_ntrows; /* to lines. */
#endif
lp = curwp->w_linep;
- while (n-- && lback(lp) != curbp->b_linep) {
+ while (n-- && lback(lp) != curbp->b_headp) {
lp = lback(lp);
curwp->w_dotline--;
}
curwp->w_linep = lp;
curwp->w_flag |= WFFULL;
/* if in current window, don't move dot */
- for (n = curwp->w_ntrows; n-- && lp != curbp->b_linep; lp = lforw(lp))
+ for (n = curwp->w_ntrows; n-- && lp != curbp->b_headp; lp = lforw(lp))
if (lp == curwp->w_dotp)
return (TRUE);
curwp->w_dotp = curwp->w_linep;
@@ -460,9 +460,9 @@ gotoline(int f, int n)
if (n == 0)
n++;
curwp->w_dotline = n;
- clp = lforw(curbp->b_linep); /* "clp" is first line */
+ clp = lforw(curbp->b_headp); /* "clp" is first line */
while (--n > 0) {
- if (lforw(clp) == curbp->b_linep) {
+ if (lforw(clp) == curbp->b_headp) {
curwp->w_dotline = curwp->w_bufp->b_lines;
break;
}
@@ -470,9 +470,9 @@ gotoline(int f, int n)
}
} else {
curwp->w_dotline = curwp->w_bufp->b_lines + n;
- clp = lback(curbp->b_linep); /* "clp" is last line */
+ clp = lback(curbp->b_headp); /* "clp" is last line */
while (n < 0) {
- if (lback(clp) == curbp->b_linep) {
+ if (lback(clp) == curbp->b_headp) {
curwp->w_dotline = 1;
break;
}
diff --git a/usr.bin/mg/buffer.c b/usr.bin/mg/buffer.c
index db77f912b59..1649d458ecb 100644
--- a/usr.bin/mg/buffer.c
+++ b/usr.bin/mg/buffer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: buffer.c,v 1.61 2006/07/08 17:50:30 kjell Exp $ */
+/* $OpenBSD: buffer.c,v 1.62 2006/07/25 08:22:32 kjell Exp $ */
/* This file is in the public domain. */
@@ -162,7 +162,7 @@ killbuffer(struct buffer *bp)
}
if (bp == curbp)
curbp = bp1;
- free(bp->b_linep); /* Release header line. */
+ free(bp->b_headp); /* Release header line. */
bp2 = NULL; /* Find the header. */
bp1 = bheadp;
while (bp1 != bp) {
@@ -299,8 +299,8 @@ makelist(void)
nbytes = 0; /* Count bytes in buf. */
if (bp != blp) {
- lp = lforw(bp->b_linep);
- while (lp != bp->b_linep) {
+ lp = lforw(bp->b_headp);
+ while (lp != bp->b_headp) {
nbytes += llength(lp) + 1;
lp = lforw(lp);
}
@@ -321,7 +321,7 @@ makelist(void)
bp->b_fname) == FALSE)
return (NULL);
}
- blp->b_dotp = lforw(blp->b_linep); /* put dot at beginning of
+ blp->b_dotp = lforw(blp->b_headp); /* put dot at beginning of
* buffer */
blp->b_doto = 0;
return (blp); /* All done */
@@ -410,10 +410,10 @@ addlinef(struct buffer *bp, char *fmt, ...)
lp->l_used = strlen(lp->l_text);
va_end(ap);
- bp->b_linep->l_bp->l_fp = lp; /* Hook onto the end */
- lp->l_bp = bp->b_linep->l_bp;
- bp->b_linep->l_bp = lp;
- lp->l_fp = bp->b_linep;
+ bp->b_headp->l_bp->l_fp = lp; /* Hook onto the end */
+ lp->l_bp = bp->b_headp->l_bp;
+ bp->b_headp->l_bp = lp;
+ lp->l_fp = bp->b_headp;
bp->b_lines++;
return (TRUE);
@@ -515,7 +515,7 @@ bnew()
bp->b_marko = 0;
bp->b_flag = defb_flag;
bp->b_nwnd = 0;
- bp->b_linep = lp;
+ bp->b_headp = lp;
bp->b_nmodes = defb_nmodes;
LIST_INIT(&bp->b_undo);
bp->b_undoptr = NULL;
@@ -557,9 +557,9 @@ bclear(struct buffer *bp)
(s = eyesno("Buffer modified; kill anyway")) != TRUE)
return (s);
bp->b_flag &= ~BFCHG; /* Not changed */
- while ((lp = lforw(bp->b_linep)) != bp->b_linep)
+ while ((lp = lforw(bp->b_headp)) != bp->b_headp)
lfree(lp);
- bp->b_dotp = bp->b_linep; /* Fix dot */
+ bp->b_dotp = bp->b_headp; /* Fix dot */
bp->b_doto = 0;
bp->b_markp = NULL; /* Invalidate "mark" */
bp->b_marko = 0;
@@ -700,12 +700,12 @@ bufferinsert(int f, int n)
}
/* insert the buffer */
nline = 0;
- clp = lforw(bp->b_linep);
+ clp = lforw(bp->b_headp);
for (;;) {
for (clo = 0; clo < llength(clp); clo++)
if (linsert(1, lgetc(clp, clo)) == FALSE)
return (FALSE);
- if ((clp = lforw(clp)) == bp->b_linep)
+ if ((clp = lforw(clp)) == bp->b_headp)
break;
if (newline(FFRAND, 1) == FALSE) /* fake newline */
return (FALSE);
@@ -718,7 +718,7 @@ bufferinsert(int f, int n)
clp = curwp->w_linep; /* cosmetic adjustment */
if (curwp->w_dotp == clp) { /* for offscreen insert */
- while (nline-- && lback(clp) != curbp->b_linep)
+ while (nline-- && lback(clp) != curbp->b_headp)
clp = lback(clp);
curwp->w_linep = clp; /* adjust framing. */
curwp->w_flag |= WFFULL;
@@ -756,7 +756,7 @@ popbuftop(struct buffer *bp)
{
struct mgwin *wp;
- bp->b_dotp = lforw(bp->b_linep);
+ bp->b_dotp = lforw(bp->b_headp);
bp->b_doto = 0;
if (bp->b_nwnd != 0) {
for (wp = wheadp; wp != NULL; wp = wp->w_wndp)
diff --git a/usr.bin/mg/def.h b/usr.bin/mg/def.h
index 7592cc8086a..78083f12d39 100644
--- a/usr.bin/mg/def.h
+++ b/usr.bin/mg/def.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: def.h,v 1.93 2006/07/08 17:56:10 kjell Exp $ */
+/* $OpenBSD: def.h,v 1.94 2006/07/25 08:22:32 kjell Exp $ */
/* This file is in the public domain. */
@@ -236,14 +236,14 @@ struct undo_rec;
* dot and mark in the header, but this is only valid if the buffer
* is not being displayed (that is, if "b_nwnd" is 0). The text for
* the buffer is kept in a circularly linked list of lines, with
- * a pointer to the header line in "b_linep".
+ * a pointer to the header line in "b_headp".
*/
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 line *b_headp; /* 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" */
diff --git a/usr.bin/mg/dired.c b/usr.bin/mg/dired.c
index 396a992c421..8aeffa6a1a2 100644
--- a/usr.bin/mg/dired.c
+++ b/usr.bin/mg/dired.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dired.c,v 1.39 2006/06/01 09:00:50 kjell Exp $ */
+/* $OpenBSD: dired.c,v 1.40 2006/07/25 08:22:32 kjell Exp $ */
/* This file is in the public domain. */
@@ -241,7 +241,7 @@ d_del(int f, int n)
while (n--) {
if (llength(curwp->w_dotp) > 0)
lputc(curwp->w_dotp, 0, 'D');
- if (lforw(curwp->w_dotp) != curbp->b_linep)
+ if (lforw(curwp->w_dotp) != curbp->b_headp)
curwp->w_dotp = lforw(curwp->w_dotp);
}
curwp->w_flag |= WFEDIT | WFMOVE;
@@ -258,7 +258,7 @@ d_undel(int f, int n)
while (n--) {
if (llength(curwp->w_dotp) > 0)
lputc(curwp->w_dotp, 0, ' ');
- if (lforw(curwp->w_dotp) != curbp->b_linep)
+ if (lforw(curwp->w_dotp) != curbp->b_headp)
curwp->w_dotp = lforw(curwp->w_dotp);
}
curwp->w_flag |= WFEDIT | WFMOVE;
@@ -275,7 +275,7 @@ d_undelbak(int f, int n)
while (n--) {
if (llength(curwp->w_dotp) > 0)
lputc(curwp->w_dotp, 0, ' ');
- if (lback(curwp->w_dotp) != curbp->b_linep)
+ if (lback(curwp->w_dotp) != curbp->b_headp)
curwp->w_dotp = lback(curwp->w_dotp);
}
curwp->w_doto = 0;
@@ -336,7 +336,7 @@ d_expunge(int f, int n)
struct line *lp, *nlp;
char fname[NFILEN];
- for (lp = lforw(curbp->b_linep); lp != curbp->b_linep; lp = nlp) {
+ for (lp = lforw(curbp->b_headp); lp != curbp->b_headp; lp = nlp) {
nlp = lforw(lp);
if (llength(lp) && lgetc(lp, 0) == 'D') {
switch (d_makename(lp, fname, sizeof(fname))) {
@@ -630,7 +630,7 @@ dired_(char *dname)
strerror(errno));
return (NULL);
}
- bp->b_dotp = lforw(bp->b_linep); /* go to first line */
+ bp->b_dotp = lforw(bp->b_headp); /* go to first line */
(void)strlcpy(bp->b_fname, dname, sizeof(bp->b_fname));
(void)strlcpy(bp->b_cwd, dname, sizeof(bp->b_cwd));
if ((bp->b_modes[1] = name_mode("dired")) == NULL) {
diff --git a/usr.bin/mg/display.c b/usr.bin/mg/display.c
index cf9f947f6f1..a70f1fdd98d 100644
--- a/usr.bin/mg/display.c
+++ b/usr.bin/mg/display.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: display.c,v 1.29 2006/06/01 09:00:50 kjell Exp $ */
+/* $OpenBSD: display.c,v 1.30 2006/07/25 08:22:32 kjell Exp $ */
/* This file is in the public domain. */
@@ -425,7 +425,7 @@ update(void)
for (i = 0; i < wp->w_ntrows; ++i) {
if (lp == wp->w_dotp)
goto out;
- if (lp == wp->w_bufp->b_linep)
+ if (lp == wp->w_bufp->b_headp)
break;
lp = lforw(lp);
}
@@ -449,7 +449,7 @@ update(void)
* Find the line.
*/
lp = wp->w_dotp;
- while (i != 0 && lback(lp) != wp->w_bufp->b_linep) {
+ while (i != 0 && lback(lp) != wp->w_bufp->b_headp) {
--i;
lp = lback(lp);
}
@@ -475,7 +475,7 @@ update(void)
vscreen[i]->v_color = CTEXT;
vscreen[i]->v_flag |= (VFCHG | VFHBAD);
vtmove(i, 0);
- if (lp != wp->w_bufp->b_linep) {
+ if (lp != wp->w_bufp->b_headp) {
for (j = 0; j < llength(lp); ++j)
vtputc(lgetc(lp, j));
lp = lforw(lp);
diff --git a/usr.bin/mg/extend.c b/usr.bin/mg/extend.c
index 07d9637c56f..7080486f2a4 100644
--- a/usr.bin/mg/extend.c
+++ b/usr.bin/mg/extend.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: extend.c,v 1.46 2006/06/01 05:34:52 jason Exp $ */
+/* $OpenBSD: extend.c,v 1.47 2006/07/25 08:22:32 kjell Exp $ */
/* This file is in the public domain. */
@@ -621,7 +621,7 @@ evalbuffer(int f, int n)
int s;
static char excbuf[128];
- for (lp = lforw(bp->b_linep); lp != bp->b_linep; lp = lforw(lp)) {
+ for (lp = lforw(bp->b_headp); lp != bp->b_headp; lp = lforw(lp)) {
if (llength(lp) >= 128)
return (FALSE);
(void)strncpy(excbuf, ltext(lp), llength(lp));
diff --git a/usr.bin/mg/file.c b/usr.bin/mg/file.c
index f96f19b3319..75b3b006f88 100644
--- a/usr.bin/mg/file.c
+++ b/usr.bin/mg/file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: file.c,v 1.60 2006/07/08 17:56:10 kjell Exp $ */
+/* $OpenBSD: file.c,v 1.61 2006/07/25 08:22:32 kjell Exp $ */
/* This file is in the public domain. */
@@ -218,7 +218,7 @@ readin(char *fname)
for (wp = wheadp; wp != NULL; wp = wp->w_wndp) {
if (wp->w_bufp == curbp) {
- wp->w_dotp = wp->w_linep = lforw(curbp->b_linep);
+ wp->w_dotp = wp->w_linep = lforw(curbp->b_headp);
wp->w_doto = 0;
wp->w_markp = NULL;
wp->w_marko = 0;
@@ -341,7 +341,7 @@ insertfile(char *fname, char *newname, int replacebuf)
oline = curwp->w_dotline;
(void)lnewline();
olp = lback(curwp->w_dotp);
- if (olp == curbp->b_linep) {
+ if (olp == curbp->b_headp) {
/* if at end of buffer, create a line to insert before */
(void)lnewline();
curwp->w_dotp = lback(curwp->w_dotp);
@@ -423,7 +423,7 @@ endoffile:
curwp->w_dotp = olp;
curwp->w_doto = opos;
curwp->w_dotline = oline;
- if (olp == curbp->b_linep)
+ if (olp == curbp->b_headp)
curwp->w_dotp = lforw(olp);
if (newname != NULL)
bp->b_flag |= BFCHG | BFBAK; /* Need a backup. */
@@ -436,7 +436,7 @@ endoffile:
* pointers in other windows correctly if they are also at the end of
* buffer.
*/
- lp1 = bp->b_linep;
+ lp1 = bp->b_headp;
if (curwp->w_markp == lp1) {
lp2 = curwp->w_dotp;
} else {
diff --git a/usr.bin/mg/fileio.c b/usr.bin/mg/fileio.c
index ab6dbd3b6d6..5d8583abaaf 100644
--- a/usr.bin/mg/fileio.c
+++ b/usr.bin/mg/fileio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fileio.c,v 1.76 2006/06/29 21:59:08 jason Exp $ */
+/* $OpenBSD: fileio.c,v 1.77 2006/07/25 08:22:32 kjell Exp $ */
/* This file is in the public domain. */
@@ -113,7 +113,7 @@ ffputbuf(struct buffer *bp)
{
struct line *lp, *lpend;
- lpend = bp->b_linep;
+ lpend = bp->b_headp;
for (lp = lforw(lpend); lp != lpend; lp = lforw(lp)) {
if (fwrite(ltext(lp), 1, llength(lp), ffp) != llength(lp)) {
ewprintf("Write I/O error");
diff --git a/usr.bin/mg/grep.c b/usr.bin/mg/grep.c
index 2270f6b6078..8fe20157b9a 100644
--- a/usr.bin/mg/grep.c
+++ b/usr.bin/mg/grep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: grep.c,v 1.30 2006/06/01 05:34:52 jason Exp $ */
+/* $OpenBSD: grep.c,v 1.31 2006/07/25 08:22:32 kjell Exp $ */
/*
* Copyright (c) 2001 Artur Grabowski <art@openbsd.org>.
* Copyright (c) 2005 Kjell Wooding <kjell@openbsd.org>.
@@ -269,7 +269,7 @@ compile_mode(const char *name, const char *command)
else
addlinef(bp, "Command finished at %s", timestr);
- bp->b_dotp = lforw(bp->b_linep); /* go to first line */
+ bp->b_dotp = lforw(bp->b_headp); /* go to first line */
bp->b_modes[0] = name_mode("fundamental");
bp->b_modes[1] = name_mode("compile");
bp->b_nmodes = 1;
@@ -297,7 +297,7 @@ compile_goto_error(int f, int n)
compile_win = curwp;
compile_buffer = curbp;
- last = lback(compile_buffer->b_linep);
+ last = lback(compile_buffer->b_headp);
retry:
/* last line is compilation result */
@@ -340,7 +340,7 @@ compile_goto_error(int f, int n)
return (TRUE);
fail:
free(line);
- if (curwp->w_dotp != lback(curbp->b_linep)) {
+ if (curwp->w_dotp != lback(curbp->b_headp)) {
curwp->w_dotp = lforw(curwp->w_dotp);
curwp->w_flag |= WFMOVE;
goto retry;
@@ -359,7 +359,7 @@ next_error(int f, int n)
}
curwp = compile_win;
curbp = compile_buffer;
- if (curwp->w_dotp == lback(curbp->b_linep)) {
+ if (curwp->w_dotp == lback(curbp->b_headp)) {
ewprintf("No more hits");
return (FALSE);
}
diff --git a/usr.bin/mg/line.c b/usr.bin/mg/line.c
index 20d90ccb303..12d55c2851e 100644
--- a/usr.bin/mg/line.c
+++ b/usr.bin/mg/line.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: line.c,v 1.40 2006/06/01 09:00:50 kjell Exp $ */
+/* $OpenBSD: line.c,v 1.41 2006/07/25 08:22:32 kjell Exp $ */
/* This file is in the public domain. */
@@ -158,7 +158,7 @@ linsert_str(const char *s, int n)
lp1 = curwp->w_dotp;
/* special case for the end */
- if (lp1 == curbp->b_linep) {
+ if (lp1 == curbp->b_headp) {
struct line *lp2, *lp3;
/* now should only happen in empty buffer */
@@ -248,7 +248,7 @@ linsert(int n, int c)
lp1 = curwp->w_dotp;
/* special case for the end */
- if (lp1 == curbp->b_linep) {
+ if (lp1 == curbp->b_headp) {
struct line *lp2, *lp3;
/* now should only happen in empty buffer */
@@ -417,7 +417,7 @@ ldelete(RSIZE n, int kflag)
dotp = curwp->w_dotp;
doto = curwp->w_doto;
/* Hit the end of the buffer */
- if (dotp == curbp->b_linep)
+ if (dotp == curbp->b_headp)
return (FALSE);
/* Size of the chunk */
chunk = dotp->l_used - doto;
@@ -426,7 +426,7 @@ ldelete(RSIZE n, int kflag)
chunk = n;
/* End of line, merge */
if (chunk == 0) {
- if (dotp == lback(curbp->b_linep))
+ if (dotp == lback(curbp->b_headp))
/* End of buffer */
return (FALSE);
lchange(WFFULL);
@@ -492,7 +492,7 @@ ldelnewline(void)
lp1 = curwp->w_dotp;
lp2 = lp1->l_fp;
/* at the end of the buffer */
- if (lp2 == curbp->b_linep)
+ if (lp2 == curbp->b_headp)
return (TRUE);
curwp->w_bufp->b_lines--;
if (lp2->l_used <= lp1->l_size - lp1->l_used) {
diff --git a/usr.bin/mg/main.c b/usr.bin/mg/main.c
index 80b3c0b7e05..6d743f1844a 100644
--- a/usr.bin/mg/main.c
+++ b/usr.bin/mg/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.53 2006/07/17 14:11:55 kjell Exp $ */
+/* $OpenBSD: main.c,v 1.54 2006/07/25 08:22:32 kjell Exp $ */
/* This file is in the public domain. */
@@ -196,7 +196,7 @@ edinit(PF init_fcn)
wheadp = wp;
curwp = wp;
wp->w_wndp = NULL; /* Initialize window. */
- wp->w_linep = wp->w_dotp = bp->b_linep;
+ wp->w_linep = wp->w_dotp = bp->b_headp;
wp->w_ntrows = nrow - 2; /* 2 = mode, echo. */
wp->w_flag = WFMODE | WFFULL; /* Full. */
diff --git a/usr.bin/mg/match.c b/usr.bin/mg/match.c
index 64fa3d8f46d..968ad04f001 100644
--- a/usr.bin/mg/match.c
+++ b/usr.bin/mg/match.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: match.c,v 1.12 2005/11/18 20:56:53 deraadt Exp $ */
+/* $OpenBSD: match.c,v 1.13 2006/07/25 08:22:32 kjell Exp $ */
/* This file is in the public domain. */
@@ -105,7 +105,7 @@ balance(void)
for (;;) {
if (cbo == 0) {
clp = lback(clp); /* beginning of line */
- if (clp == curbp->b_linep)
+ if (clp == curbp->b_headp)
return (FALSE);
cbo = llength(clp) + 1;
}
diff --git a/usr.bin/mg/paragraph.c b/usr.bin/mg/paragraph.c
index 8d3439d7a1e..22fbf60061b 100644
--- a/usr.bin/mg/paragraph.c
+++ b/usr.bin/mg/paragraph.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: paragraph.c,v 1.13 2005/11/18 20:56:53 deraadt Exp $ */
+/* $OpenBSD: paragraph.c,v 1.14 2006/07/25 08:22:32 kjell Exp $ */
/* This file is in the public domain. */
@@ -37,7 +37,7 @@ gotobop(int f, int n)
* and scan back until we hit a <NL><SP> <NL><TAB> or
* <NL><NL>
*/
- while (lback(curwp->w_dotp) != curbp->b_linep)
+ while (lback(curwp->w_dotp) != curbp->b_headp)
if (llength(lback(curwp->w_dotp)) &&
lgetc(curwp->w_dotp, 0) != ' ' &&
lgetc(curwp->w_dotp, 0) != '.' &&
@@ -47,7 +47,7 @@ gotobop(int f, int n)
if (llength(lback(curwp->w_dotp)) &&
lgetc(curwp->w_dotp, 0) == '.') {
curwp->w_dotp = lforw(curwp->w_dotp);
- if (curwp->w_dotp == curbp->b_linep) {
+ if (curwp->w_dotp == curbp->b_headp) {
/*
* beyond end of buffer,
* cleanup time
@@ -89,7 +89,7 @@ gotoeop(int f, int n)
curwp->w_dotp = lforw(curwp->w_dotp);
/* and scan forword until we hit a <NL><SP> or ... */
- while (curwp->w_dotp != curbp->b_linep) {
+ while (curwp->w_dotp != curbp->b_headp) {
if (llength(curwp->w_dotp) &&
lgetc(curwp->w_dotp, 0) != ' ' &&
lgetc(curwp->w_dotp, 0) != '.' &&
@@ -98,7 +98,7 @@ gotoeop(int f, int n)
else
break;
}
- if (curwp->w_dotp == curbp->b_linep) {
+ if (curwp->w_dotp == curbp->b_headp) {
/* beyond end of buffer, cleanup time */
curwp->w_dotp = lback(curwp->w_dotp);
curwp->w_doto = llength(curwp->w_dotp);
diff --git a/usr.bin/mg/random.c b/usr.bin/mg/random.c
index 776fecabc6f..f7bb587037b 100644
--- a/usr.bin/mg/random.c
+++ b/usr.bin/mg/random.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: random.c,v 1.20 2006/06/01 10:10:00 kjell Exp $ */
+/* $OpenBSD: random.c,v 1.21 2006/07/25 08:22:32 kjell Exp $ */
/* This file is in the public domain. */
@@ -31,7 +31,7 @@ showcpos(int f, int n)
int ratio;
/* collect the data */
- clp = lforw(curbp->b_linep);
+ clp = lforw(curbp->b_headp);
cchar = 0;
cline = 0;
cbyte = 0;
@@ -52,7 +52,7 @@ showcpos(int f, int n)
/* now count the chars */
nchar += llength(clp);
clp = lforw(clp);
- if (clp == curbp->b_linep)
+ if (clp == curbp->b_headp)
break;
/* count the newline */
nchar++;
@@ -60,7 +60,7 @@ showcpos(int f, int n)
/* determine row */
row = curwp->w_toprow + 1;
clp = curwp->w_linep;
- while (clp != curbp->b_linep && clp != curwp->w_dotp) {
+ while (clp != curbp->b_headp && clp != curwp->w_dotp) {
++row;
clp = lforw(clp);
}
@@ -206,11 +206,11 @@ deblank(int f, int n)
RSIZE nld;
lp1 = curwp->w_dotp;
- while (llength(lp1) == 0 && (lp2 = lback(lp1)) != curbp->b_linep)
+ while (llength(lp1) == 0 && (lp2 = lback(lp1)) != curbp->b_headp)
lp1 = lp2;
lp2 = lp1;
nld = (RSIZE)0;
- while ((lp2 = lforw(lp2)) != curbp->b_linep && llength(lp2) == 0)
+ while ((lp2 = lforw(lp2)) != curbp->b_headp && llength(lp2) == 0)
++nld;
if (nld == 0)
return (TRUE);
diff --git a/usr.bin/mg/re_search.c b/usr.bin/mg/re_search.c
index bdc57aa2d05..87233eb0727 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.23 2006/05/28 23:30:16 kjell Exp $ */
+/* $OpenBSD: re_search.c,v 1.24 2006/07/25 08:22:32 kjell Exp $ */
/* This file is in the public domain. */
@@ -310,7 +310,7 @@ re_forwsrch(void)
* Don't start matching past end of line -- must move to
* beginning of next line, unless at end of file.
*/
- if (clp != curbp->b_linep) {
+ if (clp != curbp->b_headp) {
clp = lforw(clp);
tbo = 0;
}
@@ -318,7 +318,7 @@ re_forwsrch(void)
* Note this loop does not process the last line, but this editor
* always makes the last line empty so this is good.
*/
- while (clp != (curbp->b_linep)) {
+ while (clp != (curbp->b_headp)) {
re_match[0].rm_so = tbo;
re_match[0].rm_eo = llength(clp);
error = regexec(&re_buff, ltext(clp), RE_NMATCH, re_match,
@@ -364,7 +364,7 @@ re_backsrch(void)
* Note this loop does not process the last line, but this editor
* always makes the last line empty so this is good.
*/
- while (clp != (curbp->b_linep)) {
+ while (clp != (curbp->b_headp)) {
re_match[0].rm_so = 0;
re_match[0].rm_eo = llength(clp);
lastmatch.rm_so = -1;
@@ -516,7 +516,7 @@ killmatches(int cond)
/* Consider dot on next line */
clp = lforw(clp);
- while (clp != (curbp->b_linep)) {
+ while (clp != (curbp->b_headp)) {
/* see if line matches */
re_match[0].rm_so = 0;
re_match[0].rm_eo = llength(clp);
@@ -591,7 +591,7 @@ countmatches(int cond)
/* Consider dot on next line */
clp = lforw(clp);
- while (clp != (curbp->b_linep)) {
+ while (clp != (curbp->b_headp)) {
/* see if line matches */
re_match[0].rm_so = 0;
re_match[0].rm_eo = llength(clp);
diff --git a/usr.bin/mg/region.c b/usr.bin/mg/region.c
index 769cad5c252..5996368fc4e 100644
--- a/usr.bin/mg/region.c
+++ b/usr.bin/mg/region.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: region.c,v 1.23 2006/07/08 17:50:30 kjell Exp $ */
+/* $OpenBSD: region.c,v 1.24 2006/07/25 08:22:32 kjell Exp $ */
/* This file is in the public domain. */
@@ -200,8 +200,8 @@ getregion(struct region *rp)
flp = blp = curwp->w_dotp;
bsize = curwp->w_doto;
fsize = llength(flp) - curwp->w_doto + 1;
- while (lforw(flp) != curbp->b_linep || lback(blp) != curbp->b_linep) {
- if (lforw(flp) != curbp->b_linep) {
+ while (lforw(flp) != curbp->b_headp || lback(blp) != curbp->b_headp) {
+ if (lforw(flp) != curbp->b_headp) {
flp = lforw(flp);
if (flp == curwp->w_markp) {
rp->r_linep = curwp->w_dotp;
@@ -211,7 +211,7 @@ getregion(struct region *rp)
}
fsize += llength(flp) + 1;
}
- if (lback(blp) != curbp->b_linep) {
+ if (lback(blp) != curbp->b_headp) {
blp = lback(blp);
bsize += llength(blp) + 1;
if (blp == curwp->w_markp) {
@@ -338,7 +338,7 @@ region_get_data(struct region *reg, char *buf, int len)
for (i = 0; i < len; i++) {
if (off == llength(lp)) {
lp = lforw(lp);
- if (lp == curbp->b_linep)
+ if (lp == curbp->b_headp)
break;
off = 0;
buf[i] = '\n';
diff --git a/usr.bin/mg/search.c b/usr.bin/mg/search.c
index 4a298f948a7..0e049b12d86 100644
--- a/usr.bin/mg/search.c
+++ b/usr.bin/mg/search.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: search.c,v 1.30 2006/06/01 09:00:50 kjell Exp $ */
+/* $OpenBSD: search.c,v 1.31 2006/07/25 08:22:32 kjell Exp $ */
/* This file is in the public domain. */
@@ -230,7 +230,7 @@ isearch(int dir)
}
if (success == FALSE && dir == SRCH_FORW) {
/* wrap the search to beginning */
- clp = lforw(curbp->b_linep);
+ clp = lforw(curbp->b_headp);
curwp->w_dotp = clp;
curwp->w_doto = 0;
curwp->w_dotline = 1;
@@ -262,7 +262,7 @@ isearch(int dir)
}
if (success == FALSE && dir == SRCH_BACK) {
/* wrap the search to end */
- clp = lback(curbp->b_linep);
+ clp = lback(curbp->b_headp);
curwp->w_dotp = clp;
curwp->w_doto =
llength(curwp->w_dotp);
@@ -666,7 +666,7 @@ forwsrch(void)
xcase = 1;
for (;;) {
if (cbo == llength(clp)) {
- if ((clp = lforw(clp)) == curbp->b_linep)
+ if ((clp = lforw(clp)) == curbp->b_headp)
break;
nline++;
cbo = 0;
@@ -680,7 +680,7 @@ forwsrch(void)
while (*pp != 0) {
if (tbo == llength(tlp)) {
tlp = lforw(tlp);
- if (tlp == curbp->b_linep)
+ if (tlp == curbp->b_headp)
goto fail;
tbo = 0;
c = CCHR('J');
@@ -728,7 +728,7 @@ backsrch(void)
for (;;) {
if (cbo == 0) {
clp = lback(clp);
- if (clp == curbp->b_linep)
+ if (clp == curbp->b_headp)
return (FALSE);
nline--;
cbo = llength(clp) + 1;
@@ -744,7 +744,7 @@ backsrch(void)
while (pp != &pat[0]) {
if (tbo == 0) {
tlp = lback(tlp);
- if (tlp == curbp->b_linep)
+ if (tlp == curbp->b_headp)
goto fail;
nline--;
tbo = llength(tlp) + 1;
diff --git a/usr.bin/mg/undo.c b/usr.bin/mg/undo.c
index a92b675dc38..0ddf81023e9 100644
--- a/usr.bin/mg/undo.c
+++ b/usr.bin/mg/undo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: undo.c,v 1.40 2006/07/08 17:56:10 kjell Exp $ */
+/* $OpenBSD: undo.c,v 1.41 2006/07/25 08:22:32 kjell Exp $ */
/*
* Copyright (c) 2002 Vincent Labrecque <vincent@openbsd.org>
* Copyright (c) 2005, 2006 Kjell Wooding <kjell@openbsd.org>
@@ -69,9 +69,9 @@ find_dot(struct line *lp, int off)
int count = 0;
struct line *p;
- for (p = curbp->b_linep; p != lp; p = lforw(p)) {
+ for (p = curbp->b_headp; p != lp; p = lforw(p)) {
if (count != 0) {
- if (p == curbp->b_linep) {
+ if (p == curbp->b_headp) {
ewprintf("Error: Undo stuff called with a"
"nonexistent line");
return (FALSE);
@@ -90,11 +90,11 @@ find_lo(int pos, struct line **olp, int *offset, int *lnum)
struct line *p;
int lineno;
- p = curbp->b_linep;
+ p = curbp->b_headp;
lineno = 0;
while (pos > llength(p)) {
pos -= llength(p) + 1;
- if ((p = lforw(p)) == curbp->b_linep) {
+ if ((p = lforw(p)) == curbp->b_headp) {
*olp = NULL;
*offset = 0;
return (FALSE);
@@ -384,7 +384,7 @@ undo_dump(int f, int n)
for (wp = wheadp; wp != NULL; wp = wp->w_wndp) {
if (wp->w_bufp == bp) {
- wp->w_dotp = bp->b_linep;
+ wp->w_dotp = bp->b_headp;
wp->w_doto = 0;
}
}
diff --git a/usr.bin/mg/window.c b/usr.bin/mg/window.c
index 6e3a8744b08..3f0bf956149 100644
--- a/usr.bin/mg/window.c
+++ b/usr.bin/mg/window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: window.c,v 1.24 2006/06/01 09:00:50 kjell Exp $ */
+/* $OpenBSD: window.c,v 1.25 2006/07/25 08:22:32 kjell Exp $ */
/* This file is in the public domain. */
@@ -183,7 +183,7 @@ onlywind(int f, int n)
}
lp = curwp->w_linep;
i = curwp->w_toprow;
- while (i != 0 && lback(lp) != curbp->b_linep) {
+ while (i != 0 && lback(lp) != curbp->b_headp) {
--i;
lp = lback(lp);
}
@@ -313,14 +313,14 @@ enlargewind(int f, int n)
/* shrink below */
if (curwp->w_wndp == adjwp) {
lp = adjwp->w_linep;
- for (i = 0; i < n && lp != adjwp->w_bufp->b_linep; ++i)
+ for (i = 0; i < n && lp != adjwp->w_bufp->b_headp; ++i)
lp = lforw(lp);
adjwp->w_linep = lp;
adjwp->w_toprow += n;
/* shrink above */
} else {
lp = curwp->w_linep;
- for (i = 0; i < n && lback(lp) != curbp->b_linep; ++i)
+ for (i = 0; i < n && lback(lp) != curbp->b_headp; ++i)
lp = lback(lp);
curwp->w_linep = lp;
curwp->w_toprow -= n;
@@ -366,14 +366,14 @@ shrinkwind(int f, int n)
/* grow below */
if (curwp->w_wndp == adjwp) {
lp = adjwp->w_linep;
- for (i = 0; i < n && lback(lp) != adjwp->w_bufp->b_linep; ++i)
+ for (i = 0; i < n && lback(lp) != adjwp->w_bufp->b_headp; ++i)
lp = lback(lp);
adjwp->w_linep = lp;
adjwp->w_toprow -= n;
/* grow above */
} else {
lp = curwp->w_linep;
- for (i = 0; i < n && lp != curbp->b_linep; ++i)
+ for (i = 0; i < n && lp != curbp->b_headp; ++i)
lp = lforw(lp);
curwp->w_linep = lp;
curwp->w_toprow += n;
diff --git a/usr.bin/mg/yank.c b/usr.bin/mg/yank.c
index aa6116bd4f2..d3668203256 100644
--- a/usr.bin/mg/yank.c
+++ b/usr.bin/mg/yank.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: yank.c,v 1.3 2006/05/28 23:30:16 kjell Exp $ */
+/* $OpenBSD: yank.c,v 1.4 2006/07/25 08:22:32 kjell Exp $ */
/* This file is in the public domain. */
@@ -174,7 +174,7 @@ killline(int f, int n)
nextp = lforw(curwp->w_dotp);
i = n;
while (--i) {
- if (nextp == curbp->b_linep)
+ if (nextp == curbp->b_headp)
break;
chunk += llength(nextp) + 1;
nextp = lforw(nextp);
@@ -185,7 +185,7 @@ killline(int f, int n)
curwp->w_doto = 0;
i = n;
while (i++) {
- if (lback(curwp->w_dotp) == curbp->b_linep)
+ if (lback(curwp->w_dotp) == curbp->b_headp)
break;
curwp->w_dotp = lback(curwp->w_dotp);
curwp->w_flag |= WFMOVE;
@@ -245,7 +245,7 @@ yank(int f, int n)
/* if offscreen insert */
if (curwp->w_dotp == lp) {
- while (nline-- && lback(lp) != curbp->b_linep)
+ while (nline-- && lback(lp) != curbp->b_headp)
lp = lback(lp);
/* adjust framing */
curwp->w_linep = lp;