-
Notifications
You must be signed in to change notification settings - Fork 3
/
ex_vset.c
102 lines (84 loc) · 1.03 KB
/
ex_vset.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#include "ex.h"
#ifdef VISUAL
#include "ex_vis.h"
/*
* Ex - a text editor
* Bill Joy UCB
* Version 1.1 November, 1977
*/
static void addto(char *, char *);
void
setLAST(void)
{
if (vglobp)
return;
lasthad = Xhadcnt;
lastcnt = Xcnt;
*lastcp = 0;
strcpy(lastcmd, workcmd);
}
char xtree, hadx;
void
setwork(char c)
{
if (vglobp) {
if (hadx)
hadx--;
return;
}
lastcp = workcmd;
if (hadx && --hadx == 0)
c = xtree;
*lastcp++ = c;
}
void
xtrey(char c)
{
hadx = 2;
xtree = c;
}
void
killglob(void)
{
if (hadx)
return;
vglobp = 0;
}
void
addtext(char *cp)
{
if (vglobp)
return;
addto(INS, cp);
if (INS[0] == OVERBUF)
lastcmd[0] = 0;
}
void
setDEL(void)
{
setBUF(DEL);
}
void
setBUF(char *BUF)
{
char c;
c = *wcursor;
*wcursor = 0;
BUF[0] = 0;
addto(BUF, cursor);
*wcursor = c;
if (BUF == DEL)
vyancnt = 0;
}
static void
addto(char *buf, char *str)
{
if (buf[0] == OVERBUF)
return;
if (strlen(buf) + strlen(str) + 1 >= BUFSIZE) {
buf[0] = OVERBUF;
return;
}
strcat(buf, str);
}
#endif