Changeset 4712:f3f7ab98b6ac in roaraudio for plugins
- Timestamp:
- 01/09/11 13:40:29 (13 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/roard/protocol-gopher.c
r4711 r4712 34 34 #define _SOUND ROAR_GOPHER_TYPE_SOUND 35 35 36 static int scb_status_txt (int client, struct roar_vio_calls * vio, const char * selector, char ** text); 37 static int scb_clients (int client, struct roar_vio_calls * vio, const char * selector, char ** text); 38 static int scb_streams (int client, struct roar_vio_calls * vio, const char * selector, char ** text); 36 static struct item; 37 38 static int scb_status_txt (int client, struct roar_vio_calls * vio, const char * selector, char ** text, struct item * sitem); 39 static int scb_clients (int client, struct roar_vio_calls * vio, const char * selector, char ** text, struct item * sitem); 40 static int scb_streams (int client, struct roar_vio_calls * vio, const char * selector, char ** text, struct item * sitem); 39 41 40 42 static struct roar_gopher_menu_item g_gopher_root_menu[] = { … … 53 55 int dir; 54 56 const char * text; 55 int (*cb)(int client, struct roar_vio_calls * vio, const char * selector, char ** text );57 int (*cb)(int client, struct roar_vio_calls * vio, const char * selector, char ** text, struct item * sitem); 56 58 } g_gopher_items[] = { 57 59 {.selector = "", .type = _DIR, … … 71 73 72 74 static int strselcmp(const char *s1, const char *s2); 75 static ssize_t strseltok(const char *s1, char *s2, char ** tok, size_t toks); 73 76 74 77 static int send_menu (int client, struct roar_gopher_menu * menu, struct roar_vio_calls * vio); … … 77 80 78 81 // SCBs: 79 static int scb_status_txt (int client, struct roar_vio_calls * vio, const char * selector, char ** text ) {82 static int scb_status_txt (int client, struct roar_vio_calls * vio, const char * selector, char ** text, struct item * sitem) { 80 83 const size_t len = 1024; 81 84 const char * server_version = NULL; … … 110 113 } 111 114 112 static int scb_clients (int client, struct roar_vio_calls * vio, const char * selector, char ** text ) {115 static int scb_clients (int client, struct roar_vio_calls * vio, const char * selector, char ** text, struct item * sitem) { 113 116 struct roar_gopher_menu_item items[ROAR_CLIENTS_MAX]; 114 117 struct roar_gopher_menu menu = {.flags = 0, .items = items, .items_len = 0}; … … 164 167 } 165 168 166 static int scb_streams (int client, struct roar_vio_calls * vio, const char * selector, char ** text ) {169 static int scb_streams (int client, struct roar_vio_calls * vio, const char * selector, char ** text, struct item * sitem) { 167 170 struct roar_gopher_menu_item items[ROAR_STREAMS_MAX]; 168 171 struct roar_gopher_menu menu = {.flags = 0, .items = items, .items_len = 0}; … … 273 276 } 274 277 278 static ssize_t strseltok(const char *s1, char *s2, char ** tok, size_t toks) { 279 register char a, b; 280 size_t idx = 0; 281 282 if ( s1 == NULL || s2 == NULL ) 283 return -1; 284 285 for (; ; s1++, s2++) { 286 a = *s1; 287 b = *s2; 288 289 if ( a == 0 || b == 0 ) { 290 if ( a == b ) { 291 return idx; 292 } else { 293 return -1; 294 } 295 } else if ( a == '*' ) { 296 s1++; 297 a = *s1; 298 if ( idx == toks ) 299 return -1; 300 301 tok[idx] = s2; 302 idx++; 303 304 for (; *s2 != 0 && *s2 != a; s2++); 305 306 if ( a == 0 ) 307 return idx; 308 309 if ( *s1 == 0 ) 310 return -1; 311 312 *s2 = 0; 313 } 314 } 315 316 return -1; 317 } 318 275 319 static int send_menu (int client, struct roar_gopher_menu * menu, struct roar_vio_calls * vio) { 276 320 struct roar_buffer * buf; … … 414 458 if ( c->cb != NULL ) { 415 459 text = NULL; 416 funcret = c->cb(client, vio, inbuf, &text );460 funcret = c->cb(client, vio, inbuf, &text, c); 417 461 418 462 if ( funcret == 0 && text != NULL )
Note: See TracChangeset
for help on using the changeset viewer.