| @@ -1,51 +1,56 @@ | | | @@ -1,51 +1,56 @@ |
1 | $NetBSD: patch-ab,v 1.2 2004/09/10 12:02:54 drochner Exp $ | | 1 | $NetBSD: patch-ab,v 1.3 2012/11/23 12:11:41 joerg Exp $ |
2 | | | 2 | |
3 | --- splotch.c.orig 2000-10-23 13:37:56.000000000 +0200 | | 3 | --- splotch.c.orig 2000-10-23 11:37:56.000000000 +0000 |
4 | +++ splotch.c | | 4 | +++ splotch.c |
5 | @@ -17,9 +17,12 @@ | | 5 | @@ -17,9 +17,12 @@ |
6 | #define NAME "Eliza" /* name of robot */ | | 6 | #define NAME "Eliza" /* name of robot */ |
7 | #define SP_HIST 4 /* number of slots in old key queue */ | | 7 | #define SP_HIST 4 /* number of slots in old key queue */ |
8 | #define TEMPLSIZ 2000 /* maximum number of templates */ | | 8 | #define TEMPLSIZ 2000 /* maximum number of templates */ |
9 | -#define DICTFILE "/usr/share/elizatalk/main.dict" /* name of dictionary file */ | | 9 | -#define DICTFILE "/usr/share/elizatalk/main.dict" /* name of dictionary file */ |
10 | -#define SYNFILE "/usr/share/elizatalk/syn.dict" /* name of dictionary file */ | | 10 | -#define SYNFILE "/usr/share/elizatalk/syn.dict" /* name of dictionary file */ |
11 | -#define WORDSDIR "/usr/share/elizatalk/words" /* name of words directory without '/' at the end*/ | | 11 | -#define WORDSDIR "/usr/share/elizatalk/words" /* name of words directory without '/' at the end*/ |
12 | +#ifndef ELIZADIR | | 12 | +#ifndef ELIZADIR |
13 | +#define ELIZADIR "/usr/share/elizatalk" | | 13 | +#define ELIZADIR "/usr/share/elizatalk" |
14 | +#endif | | 14 | +#endif |
15 | +#define DICTFILE ELIZADIR "/main.dict" /* name of dictionary file */ | | 15 | +#define DICTFILE ELIZADIR "/main.dict" /* name of dictionary file */ |
16 | +#define SYNFILE ELIZADIR "/syn.dict" /* name of dictionary file */ | | 16 | +#define SYNFILE ELIZADIR "/syn.dict" /* name of dictionary file */ |
17 | +#define WORDSDIR ELIZADIR "/words" /* name of words directory without '/' at the end*/ | | 17 | +#define WORDSDIR ELIZADIR "/words" /* name of words directory without '/' at the end*/ |
18 | #define DEBUG 0 /* debug flag */ | | 18 | #define DEBUG 0 /* debug flag */ |
19 | #define VERBOSE 0 /* verbose errors */ | | 19 | #define VERBOSE 0 /* verbose errors */ |
20 | #define DEB 0 | | 20 | #define DEB 0 |
21 | @@ -40,7 +43,6 @@ FILE *dfile; /* file poi | | 21 | @@ -40,10 +43,11 @@ FILE *dfile; /* file poi |
22 | int maxtempl; /* templ[maxtempl] is last entry */ | | 22 | int maxtempl; /* templ[maxtempl] is last entry */ |
23 | int oldkeywd[SP_HIST]; /* queue of indices of most recent keys */ | | 23 | int oldkeywd[SP_HIST]; /* queue of indices of most recent keys */ |
24 | | | 24 | |
25 | -char *strcasestr(); | | 25 | -char *strcasestr(); |
26 | char *phrasefind(); | | 26 | char *phrasefind(); |
27 | char *lower(); | | 27 | char *lower(); |
28 | | | 28 | |
29 | @@ -549,7 +551,7 @@ char *lower(s) | | 29 | +void shift(int base, int delta); |
| | | 30 | + |
| | | 31 | /*************************************************************************** |
| | | 32 | ask(person, question) takes two null terminated strings, one is the |
| | | 33 | question and the other is the person who asked the question. The function |
| | | 34 | @@ -549,7 +553,7 @@ char *lower(s) |
30 | char *s; | | 35 | char *s; |
31 | { | | 36 | { |
32 | int i; | | 37 | int i; |
33 | - char tmp[400]; | | 38 | - char tmp[400]; |
34 | + static char tmp[400]; | | 39 | + static char tmp[400]; |
35 | | | 40 | |
36 | for (i=0; s[i]; ++i) | | 41 | for (i=0; s[i]; ++i) |
37 | tmp[i] = tolower(s[i]); | | 42 | tmp[i] = tolower(s[i]); |
38 | @@ -642,30 +644,6 @@ char fname[50]; | | 43 | @@ -642,30 +646,6 @@ char fname[50]; |
39 | | | 44 | |
40 | | | 45 | |
41 | | | 46 | |
42 | -/********************************* | | 47 | -/********************************* |
43 | -strcasestr() | | 48 | -strcasestr() |
44 | -**********************************/ | | 49 | -**********************************/ |
45 | -char *strcasestr (s1, s2) | | 50 | -char *strcasestr (s1, s2) |
46 | -char *s1, *s2; | | 51 | -char *s1, *s2; |
47 | -{ | | 52 | -{ |
48 | - | | 53 | - |
49 | - char n1[256], n2[256]; | | 54 | - char n1[256], n2[256]; |
50 | - int j; | | 55 | - int j; |
51 | - | | 56 | - |
| @@ -56,22 +61,31 @@ $NetBSD: patch-ab,v 1.2 2004/09/10 12:02 | | | @@ -56,22 +61,31 @@ $NetBSD: patch-ab,v 1.2 2004/09/10 12:02 |
56 | - n2[j] = toupper (s2[j]); | | 61 | - n2[j] = toupper (s2[j]); |
57 | - n2[j] = '\0'; | | 62 | - n2[j] = '\0'; |
58 | - | | 63 | - |
59 | - return (strstr (n1, n2)); | | 64 | - return (strstr (n1, n2)); |
60 | -} | | 65 | -} |
61 | - | | 66 | - |
62 | - | | 67 | - |
63 | - | | 68 | - |
64 | - | | 69 | - |
65 | - | | 70 | - |
66 | | | 71 | |
67 | | | 72 | |
68 | | | 73 | |
69 | @@ -706,7 +684,7 @@ trytempl(question) | | 74 | @@ -706,7 +686,7 @@ trytempl(question) |
70 | firstime=0; | | 75 | firstime=0; |
71 | } | | 76 | } |
72 | else | | 77 | else |
73 | - key=strtok(key[strlen(key)], ":\n"); | | 78 | - key=strtok(key[strlen(key)], ":\n"); |
74 | + key=strtok(0, ":\n"); | | 79 | + key=strtok(0, ":\n"); |
75 | if (key == NULL) { | | 80 | if (key == NULL) { |
76 | done=1; | | 81 | done=1; |
77 | break; | | 82 | break; |
| | | 83 | @@ -893,7 +873,7 @@ gswap(old, new) |
| | | 84 | } |
| | | 85 | |
| | | 86 | |
| | | 87 | - |
| | | 88 | +void |
| | | 89 | shift(base, delta) |
| | | 90 | int base, delta; |
| | | 91 | { |