Mercurial > pidgin
annotate src/protocols/oscar/util.c @ 13366:0758db6d46ac
[gaim-migrate @ 15739]
I don't like this null. It may not matter.
committer: Tailor Script <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Wed, 01 Mar 2006 07:43:54 +0000 |
parents | f260d319bbbc |
children | 6519aeb66b31 |
rev | line source |
---|---|
13234 | 1 /* |
2 * Gaim's oscar protocol plugin | |
3 * This file is the legal property of its developers. | |
4 * Please see the AUTHORS file distributed alongside this file. | |
5 * | |
6 * This library is free software; you can redistribute it and/or | |
7 * modify it under the terms of the GNU Lesser General Public | |
8 * License as published by the Free Software Foundation; either | |
9 * version 2 of the License, or (at your option) any later version. | |
10 * | |
11 * This library is distributed in the hope that it will be useful, | |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 * Lesser General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU Lesser General Public | |
17 * License along with this library; if not, write to the Free Software | |
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
19 */ | |
20 | |
2086 | 21 /* |
4246 | 22 * A little bit of this |
23 * A little bit of that | |
24 * It started with a kiss | |
25 * Now we're up to bat | |
2086 | 26 */ |
27 | |
13234 | 28 #include "oscar.h" |
2086 | 29 #include <ctype.h> |
30 | |
4246 | 31 #ifdef _WIN32 |
32 #include "win32dep.h" | |
33 #endif | |
34 | |
2086 | 35 /* |
36 * Tokenizing functions. Used to portably replace strtok/sep. | |
37 * -- DMP. | |
38 * | |
39 */ | |
6323 | 40 faim_export int aimutil_tokslen(char *toSearch, int theindex, char dl) |
2086 | 41 { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
42 int curCount = 1; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
43 char *next; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
44 char *last; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
45 int toReturn; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
46 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
47 last = toSearch; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
48 next = strchr(toSearch, dl); |
2086 | 49 |
6323 | 50 while(curCount < theindex && next != NULL) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
51 curCount++; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
52 last = next + 1; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
53 next = strchr(last, dl); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
54 } |
2086 | 55 |
6323 | 56 if ((curCount < theindex) || (next == NULL)) |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
57 toReturn = strlen(toSearch) - (curCount - 1); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
58 else |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
59 toReturn = next - toSearch - (curCount - 1); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
60 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
61 return toReturn; |
2086 | 62 } |
63 | |
64 faim_export int aimutil_itemcnt(char *toSearch, char dl) | |
65 { | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
66 int curCount; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
67 char *next; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
68 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
69 curCount = 1; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
70 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
71 next = strchr(toSearch, dl); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
72 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
73 while(next != NULL) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
74 curCount++; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
75 next = strchr(next + 1, dl); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
76 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
77 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
78 return curCount; |
2086 | 79 } |
80 | |
6323 | 81 faim_export char *aimutil_itemindex(char *toSearch, int theindex, char dl) |
2086 | 82 { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
83 int curCount; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
84 char *next; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
85 char *last; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
86 char *toReturn; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
87 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
88 curCount = 0; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
89 |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
90 last = toSearch; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
91 next = strchr(toSearch, dl); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
92 |
6323 | 93 while (curCount < theindex && next != NULL) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
94 curCount++; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
95 last = next + 1; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
96 next = strchr(last, dl); |
2086 | 97 } |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
98 |
6323 | 99 if (curCount < theindex) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
100 toReturn = malloc(sizeof(char)); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
101 *toReturn = '\0'; |
2086 | 102 } |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
103 next = strchr(last, dl); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
104 |
6323 | 105 if (curCount < theindex) { |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
106 toReturn = malloc(sizeof(char)); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
107 *toReturn = '\0'; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
108 } else { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
109 if (next == NULL) { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
110 toReturn = malloc((strlen(last) + 1) * sizeof(char)); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
111 strcpy(toReturn, last); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
112 } else { |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
113 toReturn = malloc((next - last + 1) * sizeof(char)); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
114 memcpy(toReturn, last, (next - last)); |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
115 toReturn[next - last] = '\0'; |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
116 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
117 } |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
118 return toReturn; |
2086 | 119 } |
120 | |
4617 | 121 /** |
122 * Calculate the checksum of a given icon. | |
123 * | |
124 */ | |
13234 | 125 faim_export guint16 aimutil_iconsum(const guint8 *buf, int buflen) |
4617 | 126 { |
13234 | 127 guint32 sum; |
4617 | 128 int i; |
129 | |
130 for (i=0, sum=0; i+1<buflen; i+=2) | |
131 sum += (buf[i+1] << 8) + buf[i]; | |
132 if (i < buflen) | |
133 sum += buf[i]; | |
134 sum = ((sum & 0xffff0000) >> 16) + (sum & 0x0000ffff); | |
135 | |
136 return sum; | |
137 } | |
138 | |
8092 | 139 /** |
8972 | 140 * Check if the given screen name is a valid AIM screen name. |
141 * Example: BobDole | |
9681 | 142 * Example: Henry_Ford@mac.com |
8972 | 143 * |
144 * @return 1 if the screen name is valid, 0 if not. | |
145 */ | |
146 static int aim_snvalid_aim(const char *sn) | |
147 { | |
148 int i; | |
149 | |
150 for (i = 0; sn[i] != '\0'; i++) { | |
9681 | 151 if (!isalnum(sn[i]) && (sn[i] != ' ') && |
152 (sn[i] != '@') && (sn[i] != '.') && | |
153 (sn[i] != '_') && (sn[i] != '-')) | |
8972 | 154 return 0; |
155 } | |
156 | |
157 return 1; | |
158 } | |
159 | |
160 /** | |
161 * Check if the given screen name is a valid ICQ screen name. | |
162 * Example: 1234567 | |
163 * | |
164 * @return 1 if the screen name is valid, 0 if not. | |
165 */ | |
166 static int aim_snvalid_icq(const char *sn) | |
167 { | |
168 int i; | |
169 | |
170 for (i = 0; sn[i] != '\0'; i++) { | |
171 if (!isdigit(sn[i])) | |
172 return 0; | |
173 } | |
174 | |
175 return 1; | |
176 } | |
177 | |
178 /** | |
179 * Check if the given screen name is a valid SMS screen name. | |
180 * Example: +19195551234 | |
181 * | |
182 * @return 1 if the screen name is valid, 0 if not. | |
183 */ | |
184 static int aim_snvalid_sms(const char *sn) | |
185 { | |
186 int i; | |
187 | |
188 if (sn[0] != '+') | |
189 return 0; | |
190 | |
191 for (i = 1; sn[i] != '\0'; i++) { | |
192 if (!isdigit(sn[i])) | |
193 return 0; | |
194 } | |
195 | |
196 return 1; | |
197 } | |
198 | |
199 /** | |
200 * Check if the given screen name is a valid oscar screen name. | |
8092 | 201 * |
202 * @return 1 if the screen name is valid, 0 if not. | |
203 */ | |
204 faim_export int aim_snvalid(const char *sn) | |
205 { | |
8972 | 206 if ((sn == NULL) || (*sn == '\0')) |
8092 | 207 return 0; |
208 | |
8972 | 209 if (isalpha(sn[0])) |
210 return aim_snvalid_aim(sn); | |
211 else if (isdigit(sn[0])) | |
212 return aim_snvalid_icq(sn); | |
213 else if (sn[0] == '+') | |
214 return aim_snvalid_sms(sn); | |
8092 | 215 |
8972 | 216 return 0; |
8092 | 217 } |
218 | |
9975 | 219 /** |
220 * Determine if a given screen name is an ICQ screen name | |
221 * (i.e. it begins with a number). | |
222 * | |
223 * @sn A valid AIM or ICQ screen name. | |
224 * @return 1 if the screen name is an ICQ screen name. Otherwise 0 | |
225 * is returned. | |
226 */ | |
227 faim_export int aim_sn_is_icq(const char *sn) | |
228 { | |
229 if (isalpha(sn[0])) | |
230 return 0; | |
231 return 1; | |
232 } | |
233 | |
13168
bdb8d7beb5a7
[gaim-migrate @ 15531]
Evan Schoenberg <evan.s@dreskin.net>
parents:
11253
diff
changeset
|
234 /** |
bdb8d7beb5a7
[gaim-migrate @ 15531]
Evan Schoenberg <evan.s@dreskin.net>
parents:
11253
diff
changeset
|
235 * Determine if a given screen name is an SMS number |
bdb8d7beb5a7
[gaim-migrate @ 15531]
Evan Schoenberg <evan.s@dreskin.net>
parents:
11253
diff
changeset
|
236 * (i.e. it begins with a +). |
bdb8d7beb5a7
[gaim-migrate @ 15531]
Evan Schoenberg <evan.s@dreskin.net>
parents:
11253
diff
changeset
|
237 * |
bdb8d7beb5a7
[gaim-migrate @ 15531]
Evan Schoenberg <evan.s@dreskin.net>
parents:
11253
diff
changeset
|
238 * @sn A valid AIM or ICQ screen name. |
bdb8d7beb5a7
[gaim-migrate @ 15531]
Evan Schoenberg <evan.s@dreskin.net>
parents:
11253
diff
changeset
|
239 * @return 1 if the screen name is an SMS number. Otherwise 0 |
bdb8d7beb5a7
[gaim-migrate @ 15531]
Evan Schoenberg <evan.s@dreskin.net>
parents:
11253
diff
changeset
|
240 * is returned. |
bdb8d7beb5a7
[gaim-migrate @ 15531]
Evan Schoenberg <evan.s@dreskin.net>
parents:
11253
diff
changeset
|
241 */ |
bdb8d7beb5a7
[gaim-migrate @ 15531]
Evan Schoenberg <evan.s@dreskin.net>
parents:
11253
diff
changeset
|
242 faim_export int aim_sn_is_sms(const char *sn) |
bdb8d7beb5a7
[gaim-migrate @ 15531]
Evan Schoenberg <evan.s@dreskin.net>
parents:
11253
diff
changeset
|
243 { |
bdb8d7beb5a7
[gaim-migrate @ 15531]
Evan Schoenberg <evan.s@dreskin.net>
parents:
11253
diff
changeset
|
244 if (sn[0] != '+') |
bdb8d7beb5a7
[gaim-migrate @ 15531]
Evan Schoenberg <evan.s@dreskin.net>
parents:
11253
diff
changeset
|
245 return 0; |
bdb8d7beb5a7
[gaim-migrate @ 15531]
Evan Schoenberg <evan.s@dreskin.net>
parents:
11253
diff
changeset
|
246 return 1; |
bdb8d7beb5a7
[gaim-migrate @ 15531]
Evan Schoenberg <evan.s@dreskin.net>
parents:
11253
diff
changeset
|
247 } |
bdb8d7beb5a7
[gaim-migrate @ 15531]
Evan Schoenberg <evan.s@dreskin.net>
parents:
11253
diff
changeset
|
248 |
2086 | 249 /* |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
250 * int snlen(const char *) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
251 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
252 * This takes a screen name and returns its length without |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
253 * spaces. If there are no spaces in the SN, then the |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
254 * return is equal to that of strlen(). |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
255 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
256 */ |
2086 | 257 faim_export int aim_snlen(const char *sn) |
258 { | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
259 int i = 0; |
2086 | 260 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
261 if (!sn) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
262 return 0; |
2086 | 263 |
5556 | 264 while (*sn != '\0') { |
265 if (*sn != ' ') | |
266 i++; | |
267 sn++; | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
268 } |
2086 | 269 |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
270 return i; |
2086 | 271 } |
272 | |
273 /* | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
274 * int sncmp(const char *, const char *) |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
275 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
276 * This takes two screen names and compares them using the rules |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
277 * on screen names for AIM/AOL. Mainly, this means case and space |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
278 * insensitivity (all case differences and spacing differences are |
5628 | 279 * ignored, with the exception that screen names can not start with |
280 * a space). | |
2246
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
281 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
282 * Return: 0 if equal |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
283 * non-0 if different |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
284 * |
933346315b9b
[gaim-migrate @ 2256]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
285 */ |
2086 | 286 faim_export int aim_sncmp(const char *sn1, const char *sn2) |
287 { | |
288 | |
10116 | 289 if ((sn1 == NULL) || (sn2 == NULL)) |
290 return -1; | |
291 | |
5928 | 292 do { |
5556 | 293 while (*sn2 == ' ') |
5724 | 294 sn2++; |
5556 | 295 while (*sn1 == ' ') |
5724 | 296 sn1++; |
5928 | 297 if (toupper(*sn1) != toupper(*sn2)) |
298 return 1; | |
299 } while ((*sn1 != '\0') && sn1++ && sn2++); | |
2086 | 300 |
5928 | 301 return 0; |
2086 | 302 } |