9,10d8
<  * 
<  * * * * * * * * * * * *
11a10,11
>  * * * * * * * * * * * *
>  *
19c19
<  * 
---
>  *
23a24,72
>  *
>  * * * * * * * * * * * *
>  *
>  * Article 2053 of comp.os.minix:
>  * From: dean@ndmath.UUCP (Dean Alvis)
>  * Subject: ed.c tuneup
>  * Keywords: minor adjustments
>  * Message-ID: <930@ndmath.UUCP>
>  * Date: 17 Feb 88 17:22:54 GMT
>  * Organization: Math. Dept., Univ. of Notre Dame
>  *
>  * 	I've enjoyed using the recently posted "ed", both on a UNIX
>  * system and at home under CP/M. One minor annoyance is the slowness
>  * of the write command for large (>>1000 lines) files. One solution
>  * is to replace the calls to gettxt() (which in turn call getptr())
>  * in dowrite(). I've lost the original, so can't provide diffs (sorry),
>  * but the idea is to just use a LINE * in the loop in dowrite(), as
>  * follows:
>  *
>  * 	LINE *lptr;
>  * 	...
>  * 	lptr = getptr(from);
>  * 	for(lin=from;lin<=to;lin++) {
>  * 		str = lptr->l_buff;
>  * 		++lines;
>  * 		bytes += strlen(str)+1;	/* str + '\n' */
>  * 		if(fputs(str,fp) == EOF) {
>  * 			...
>  * 		}
>  * 		fputc('\n',fp);
>  * 		lptr = lptr->l_next;
>  * 	}
>  *
>  * I've tested this version, and haven't run into trouble yet.
>  * Also, this method avoids the strcpy and strcat to the static buffer
>  * in gettxt(), which seem unnecessary (someone correct me if i'm
>  * missing something here).
>  *
>  * 	Another minor annoyance is the state of the current line
>  * number after global commands - my preference is for the last modified
>  * line to be the new current line. Replacing the return(0) by
>  * return(curln) at the end of doglob() will produce this behavior.
>  *
>  * 	dean
>  * --
>  * dean@ndmath.UUCP
>  * Dean Alvis, Math. Dept., Univ. of Notre Dame, Notre Dame IN, 46556
>  *
>  *
67,68c116
< static char	mods[] =	"$TurboC mod: 88/02/13 09:30 RAMontante $";
< 
---
> static char	mods[] =	"$Mods: 88/02/18 22:00 bobmon $";
120a169
> #define FATAL	(ERR-1)
187a237,245
> #ifdef max
> #  undef max
> #  endif
> #ifdef min
> #  undef min
> #  endif
> #ifdef toupper
> #  undef toupper
> #  endif
193d250
< #define FATAL	(ERR-1)
335,338c392,393
< 				while(bocl <= lin)
< 				{
< 					if(rval = match(lin, pat, boln))
< 					{
---
> 				while(bocl <= lin) {
> 					if(rval = match(lin, pat, boln)) {
1035c1090
< 	return(0);
---
> 	return(curln);
1175a1231
> 	LINE	*lptr;
1178d1233
< 
1179a1235
> 
1186,1188c1242,1245
< 	for(lin = from; lin <= to; lin++)
< 	{
< 		str = gettxt(lin);
---
> 
> 	lptr = getptr(from);
> 	for(lin = from; lin <= to; lin++) {
> 		str = lptr->l_buff;
1190,1192c1247,1248
< 		bytes += strlen(str);
< 		if(fputs(str, fp) == EOF)
< 		{
---
> 		bytes += strlen(str) + 1;	/* str + '\n' */
> 		if(fputs(str, fp) == EOF) {
1196a1253,1254
> 		fputc('\n', fp);
> 		lptr = lptr->l_next;
1363c1421
< 		} else 
---
> 		} else
