aboutsummaryrefslogtreecommitdiff
path: root/textproc/wordnet/files/patch-ah
blob: 2484129a1df567454cfb116c4ddc6e2c09940edd (plain) (blame)
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
--- src/lib/morph.c	Tue Jul 15 10:41:55 2003
+++ src/lib/morph.c	Tue Feb 17 15:50:51 2004
@@ -45,27 +45,28 @@
 static char msgbuf[256];
 
-#define NUMPREPS	15
 
 static struct {
     char *str;
     int strlen;
-} prepositions[NUMPREPS] = {
-    "to", 2,
-    "at", 2,
-    "of", 2,
-    "on", 2,
-    "off", 3,
-    "in", 2,
-    "out", 3,
-    "up", 2,
-    "down", 4,
-    "from", 4,
-    "with", 4,
-    "into", 4,
-    "for", 3,
-    "about", 5,
-    "between", 7,
+} prepositions[] = {
+    { "to", 2 },
+    { "at", 2 },
+    { "of", 2 },
+    { "on", 2 },
+    { "off", 3 },
+    { "in", 2 },
+    { "out", 3 },
+    { "up", 2 },
+    { "down", 4 },
+    { "from", 4 },
+    { "with", 4 },
+    { "into", 4 },
+    { "for", 3 },
+    { "about", 5 },
+    { "between", 7 }
 };
 
+#define NUMPREPS	sizeof(prepositions)/sizeof(prepositions[0])
+
 static FILE *exc_fps[NUMPARTS + 1];
 
@@ -207,5 +208,6 @@
 		strncpy(word, str + st_idx, end_idx - st_idx);
 		word[end_idx - st_idx] = '\0';
-		if(tmp = morphword(word, pos))
+		tmp = morphword(word, pos);
+		if(tmp)
 		    strcat(searchstr,tmp);
 		else
@@ -215,5 +217,6 @@
 	    }
 	    
-	    if(tmp = morphword(strcpy(word, str + st_idx), pos)) 
+	    tmp = morphword(strcpy(word, str + st_idx), pos);
+	    if(tmp)
 		strcat(searchstr,tmp);
 	    else
@@ -248,6 +251,5 @@
     char *tmp, tmpbuf[WORDBUF], *end;
     
-    sprintf(retval,"");
-    sprintf(tmpbuf, "");
+    retval[0] = tmpbuf[0] = '\0';
     end = "";
     
@@ -343,5 +345,4 @@
     static char line[WORDBUF], *beglp, *endlp;
     char *excline;
-    int found = 0;
 
     if (exc_fps[pos] == NULL)
@@ -385,5 +386,6 @@
     last = strrchr(s, '_');
     if (rest != last) {		/* more than 2 words */
-	if (lastwd = morphword(last + 1, NOUN)) {
+	lastwd = morphword(last + 1, NOUN);
+	if (lastwd) {
 	    strncpy(end, rest, last - rest + 1);
 	    end[last-rest+1] = '\0';