Sat Jan 21 19:29:41 2012 UTC ()
undo previous, it is wrong.


(christos)
diff -r1.2 -r1.3 src/dist/nvi/common/delete.c
diff -r1.4 -r1.5 src/dist/nvi/vi/getc.c

cvs diff -r1.2 -r1.3 src/dist/nvi/common/Attic/delete.c (expand / switch to unified diff)

--- src/dist/nvi/common/Attic/delete.c 2012/01/21 17:12:56 1.2
+++ src/dist/nvi/common/Attic/delete.c 2012/01/21 19:29:41 1.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: delete.c,v 1.2 2012/01/21 17:12:56 christos Exp $ */ 1/* $NetBSD: delete.c,v 1.3 2012/01/21 19:29:41 christos Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1992, 1993, 1994 4 * Copyright (c) 1992, 1993, 1994
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * Copyright (c) 1992, 1993, 1994, 1995, 1996 6 * Copyright (c) 1992, 1993, 1994, 1995, 1996
7 * Keith Bostic. All rights reserved. 7 * Keith Bostic. All rights reserved.
8 * 8 *
9 * See the LICENSE file for redistribution information. 9 * See the LICENSE file for redistribution information.
10 */ 10 */
11 11
12#include "config.h" 12#include "config.h"
13 13
14#ifndef lint 14#ifndef lint
@@ -79,31 +79,26 @@ del(SCR *sp, MARK *fm, MARK *tm, int lmo @@ -79,31 +79,26 @@ del(SCR *sp, MARK *fm, MARK *tm, int lmo
79 } 79 }
80 if (db_get(sp, fm->lno, DBG_FATAL, &p, &len)) 80 if (db_get(sp, fm->lno, DBG_FATAL, &p, &len))
81 return (1); 81 return (1);
82 GET_SPACE_RETW(sp, bp, blen, fm->cno); 82 GET_SPACE_RETW(sp, bp, blen, fm->cno);
83 MEMCPYW(bp, p, fm->cno); 83 MEMCPYW(bp, p, fm->cno);
84 if (db_set(sp, fm->lno, bp, fm->cno)) 84 if (db_set(sp, fm->lno, bp, fm->cno))
85 return (1); 85 return (1);
86 goto done; 86 goto done;
87 } 87 }
88 } 88 }
89 89
90 /* Case 3 -- delete within a single line. */ 90 /* Case 3 -- delete within a single line. */
91 if (tm->lno == fm->lno) { 91 if (tm->lno == fm->lno) {
92 if (tm->cno == fm->cno) { 
93 if (db_delete(sp, fm->lno)) 
94 return (1); 
95 goto done; 
96 } 
97 if (db_get(sp, fm->lno, DBG_FATAL, &p, &len)) 92 if (db_get(sp, fm->lno, DBG_FATAL, &p, &len))
98 return (1); 93 return (1);
99 GET_SPACE_RETW(sp, bp, blen, len); 94 GET_SPACE_RETW(sp, bp, blen, len);
100 if (fm->cno != 0) 95 if (fm->cno != 0)
101 MEMCPYW(bp, p, fm->cno); 96 MEMCPYW(bp, p, fm->cno);
102 MEMCPYW(bp + fm->cno, p + (tm->cno + 1),  97 MEMCPYW(bp + fm->cno, p + (tm->cno + 1),
103 len - (tm->cno + 1)); 98 len - (tm->cno + 1));
104 if (db_set(sp, fm->lno, 99 if (db_set(sp, fm->lno,
105 bp, len - ((tm->cno - fm->cno) + 1))) 100 bp, len - ((tm->cno - fm->cno) + 1)))
106 goto err; 101 goto err;
107 goto done; 102 goto done;
108 } 103 }
109 104

cvs diff -r1.4 -r1.5 src/dist/nvi/vi/Attic/getc.c (expand / switch to unified diff)

--- src/dist/nvi/vi/Attic/getc.c 2012/01/21 17:12:56 1.4
+++ src/dist/nvi/vi/Attic/getc.c 2012/01/21 19:29:41 1.5
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: getc.c,v 1.4 2012/01/21 17:12:56 christos Exp $ */ 1/* $NetBSD: getc.c,v 1.5 2012/01/21 19:29:41 christos Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1992, 1993, 1994 4 * Copyright (c) 1992, 1993, 1994
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * Copyright (c) 1992, 1993, 1994, 1995, 1996 6 * Copyright (c) 1992, 1993, 1994, 1995, 1996
7 * Keith Bostic. All rights reserved. 7 * Keith Bostic. All rights reserved.
8 * 8 *
9 * See the LICENSE file for redistribution information. 9 * See the LICENSE file for redistribution information.
10 */ 10 */
11 11
12#include "config.h" 12#include "config.h"
13 13
14#ifndef lint 14#ifndef lint
@@ -133,32 +133,30 @@ cs_fspace(SCR *sp, VCS *csp) @@ -133,32 +133,30 @@ cs_fspace(SCR *sp, VCS *csp)
133 } 133 }
134 return (0); 134 return (0);
135} 135}
136 136
137/* 137/*
138 * cs_fblank -- 138 * cs_fblank --
139 * Eat forward to the next non-whitespace character. 139 * Eat forward to the next non-whitespace character.
140 * 140 *
141 * PUBLIC: int cs_fblank __P((SCR *, VCS *)); 141 * PUBLIC: int cs_fblank __P((SCR *, VCS *));
142 */ 142 */
143int 143int
144cs_fblank(SCR *sp, VCS *csp) 144cs_fblank(SCR *sp, VCS *csp)
145{ 145{
146 if (csp->cs_flags == CS_EMP) 
147 return (0); 
148 for (;;) { 146 for (;;) {
149 if (cs_next(sp, csp)) 147 if (cs_next(sp, csp))
150 return (1); 148 return (1);
151 if (csp->cs_flags == CS_EOL || 149 if (csp->cs_flags == CS_EOL || csp->cs_flags == CS_EMP ||
152 (csp->cs_flags == 0 && ISBLANK2(csp->cs_ch))) 150 (csp->cs_flags == 0 && ISBLANK2(csp->cs_ch)))
153 continue; 151 continue;
154 break; 152 break;
155 } 153 }
156 return (0); 154 return (0);
157} 155}
158 156
159/* 157/*
160 * cs_prev -- 158 * cs_prev --
161 * Retrieve the previous character. 159 * Retrieve the previous character.
162 * 160 *
163 * PUBLIC: int cs_prev __P((SCR *, VCS *)); 161 * PUBLIC: int cs_prev __P((SCR *, VCS *));
164 */ 162 */
@@ -204,25 +202,23 @@ cs_prev(SCR *sp, VCS *csp) @@ -204,25 +202,23 @@ cs_prev(SCR *sp, VCS *csp)
204 } 202 }
205 return (0); 203 return (0);
206} 204}
207 205
208/* 206/*
209 * cs_bblank -- 207 * cs_bblank --
210 * Eat backward to the next non-whitespace character. 208 * Eat backward to the next non-whitespace character.
211 * 209 *
212 * PUBLIC: int cs_bblank __P((SCR *, VCS *)); 210 * PUBLIC: int cs_bblank __P((SCR *, VCS *));
213 */ 211 */
214int 212int
215cs_bblank(SCR *sp, VCS *csp) 213cs_bblank(SCR *sp, VCS *csp)
216{ 214{
217 if (csp->cs_flags == CS_EMP) 
218 return (0); 
219 for (;;) { 215 for (;;) {
220 if (cs_prev(sp, csp)) 216 if (cs_prev(sp, csp))
221 return (1); 217 return (1);
222 if (csp->cs_flags == CS_EOL || 218 if (csp->cs_flags == CS_EOL || csp->cs_flags == CS_EMP ||
223 (csp->cs_flags == 0 && ISBLANK2(csp->cs_ch))) 219 (csp->cs_flags == 0 && ISBLANK2(csp->cs_ch)))
224 continue; 220 continue;
225 break; 221 break;
226 } 222 }
227 return (0); 223 return (0);
228} 224}