-
Notifications
You must be signed in to change notification settings - Fork 1
/
fcheck.c
66 lines (57 loc) · 1.54 KB
/
fcheck.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
/* Copyright (C) 1988-2018 Sean MacLennan */
#define FCHECK
#include "z.h"
#include <stdio.h>
#include "varray.c"
#include "funcs.c"
#include "cnames.c"
#include "bind.c"
int main(int argc, char *argv[])
{
int err = 0;
/* Spot check keys array */
Byte array[97];
memset(array, ZINSERT, sizeof(array));
array[0] = ZUNDO;
array[96] = ZDELETE_PREVIOUS_CHAR;
if (memcmp(array, Keys + 31, sizeof(array))) {
printf("Problems with Keys array 1\n");
err = 1;
}
if (Keys[CX('1')] != ZONE_WINDOW ||
Keys[CX('=')] != ZPOSITION ||
Keys[CX('O')] != ZNEXT_WINDOW ||
Keys[CX('Z')] != ZZAP_TO_CHAR ||
Keys[CX(127)] != ZDELETE_PREVIOUS_WORD) {
printf("Problems with Keys array 2\n");
err = 1;
}
if (Keys[M('A')] != ZAGAIN ||
Keys[M('Z')] != ZSAVE_AND_EXIT ||
Keys[TC_UP] != ZPREVIOUS_LINE ||
Keys[TC_F12] != ZREVERT_FILE ||
Keys[M(127)] != ZDELETE_PREVIOUS_WORD) {
printf("Problems with Keys array 3\n");
err = 1;
}
/* validate the Cnames array the best we can */
for (int s1 = 1; s1 < NUMFUNCS; ++s1) {
if (strcasecmp(Cnames[s1].name, Cnames[s1 - 1].name) <= 0) {
printf("Problem: (%d) %s and %s\n",
s1, Cnames[s1 - 1].name, Cnames[s1].name);
err = 1;
}
if (strlen(Cnames[s1].name) > (size_t)30) {
printf("%s too long\n", Cnames[s1].name);
err = 1;
}
}
/* validate the Vars array */
for (int s1 = 1; s1 < NUMVARS; ++s1)
if (strcasecmp(Vars[s1].vname, Vars[s1 - 1].vname) <= 0) {
printf("Problem: (%d) %s and %s\n",
s1, Vars[s1 - 1].vname, Vars[s1].vname);
err = 1;
}
return err;
}