Changeset 4711:5ae94193666e in roaraudio
- Timestamp:
- 01/09/11 12:54:22 (13 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/roard/protocol-gopher.c
r4708 r4711 70 70 }; 71 71 72 static int strselcmp(const char *s1, const char *s2); 73 72 74 static int send_menu (int client, struct roar_gopher_menu * menu, struct roar_vio_calls * vio); 73 75 static int send_text (int client, const char * text, struct roar_vio_calls * vio); … … 230 232 } 231 233 234 static int strselcmp(const char *s1, const char *s2) { 235 register char a, b; 236 237 if ( s1 == s2 ) 238 return 0; 239 240 if ( s1 == NULL || s2 == NULL ) 241 return -1; 242 243 for (; ; s1++, s2++) { 244 a = *s1; 245 b = *s2; 246 247 if ( a == '*' ) { 248 s1++; 249 a = *s1; 250 if ( a == 0 ) { 251 if ( b == 0 ) { 252 return 1; // no match! ('*' does not mach no-chars) 253 } else { 254 return 0; // match! (string ends with '*' and something not EOS is in b) 255 } 256 } else { 257 for (; *s2 != 0 && *s2 != a; s2++); 258 if ( a != *s2 ) 259 return 1; // no match! (did not find correct char) 260 } 261 } else if ( a == 0 || b == 0 ) { 262 if ( a == b ) { 263 return 0; // match! 264 } else { 265 return 1; // no match! (dffrent length) 266 } 267 } else if ( a != b ) { 268 return 1; // no match! (diffrent chars) 269 } 270 } 271 272 return -1; 273 } 274 232 275 static int send_menu (int client, struct roar_gopher_menu * menu, struct roar_vio_calls * vio) { 233 276 struct roar_buffer * buf; … … 358 401 359 402 for (i = 0; i < sizeof(g_gopher_items)/sizeof(*g_gopher_items); i++) { 360 if ( !str cmp(g_gopher_items[i].selector, inbuf) ) {403 if ( !strselcmp(g_gopher_items[i].selector, inbuf) ) { 361 404 c = &(g_gopher_items[i]); 362 405 break;
Note: See TracChangeset
for help on using the changeset viewer.