-
Notifications
You must be signed in to change notification settings - Fork 3
/
exj.c
46 lines (41 loc) · 764 Bytes
/
exj.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "ex.h"
/*
* Ex - a text editor
* Bill Joy UCB June/August 1977
*/
STATIC int jnoop(void);
STATIC int jcount;
void
join(char c)
{
int *a1;
register char *cp, *cp1;
cp = genbuf;
*cp = 0;
for (a1 = addr1; a1 <= addr2; a1++) {
ex_getline(*a1);
cp1 = linebuf;
if (a1 != addr1 && c == 0) {
while (*cp1 == ' ' || *cp1 == '\t')
cp1++;
if (*cp1 && cp > genbuf && cp[-1] != ' ' && cp[-1] != '\t')
*cp++ = ' ';
}
while ((*cp++ = *cp1++))
if (cp > &genbuf[LBSIZE-2])
error("Line overflow|Result line of join would be longer than 510 characters");
cp--;
}
cp = genbuf;
cp1 = linebuf;
while ((*cp1++ = *cp++))
continue;
delete();
jcount = 1;
append(jnoop, --addr1);
}
STATIC int
jnoop(void)
{
return(--jcount);
}