vi: move xoff before EOL after motions
[neatvi.git] / reg.c
blob59b27c172371e21fb8efc36c322d994f38e15734
1 #include <ctype.h>
2 #include <stdlib.h>
3 #include <string.h>
4 #include "vi.h"
6 static char *bufs[256];
7 static int lnmode[256];
9 char *reg_get(int c, int *ln)
11 *ln = lnmode[c];
12 return bufs[c];
15 void reg_put(int c, char *s, int ln)
17 char *pre = isupper(c) ? bufs[tolower(c)] : "";
18 char *buf = malloc(strlen(pre) + strlen(s) + 1);
19 strcpy(buf, pre);
20 strcat(buf, s);
21 free(bufs[tolower(c)]);
22 bufs[tolower(c)] = buf;
23 lnmode[tolower(c)] = ln;
26 void reg_done(void)
28 int i;
29 for (i = 0; i < LEN(bufs); i++)
30 free(bufs[i]);