Changeset 5486:3f3a5a9eca72 in roaraudio for plugins


Ignore:
Timestamp:
04/29/12 09:16:50 (12 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

allow application mode (--text $bla)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • plugins/universal/helloworld.c

    r5483 r5486  
    2929static int hw_init (struct roar_dl_librarypara * para) { 
    3030 const char * text = "Hello world!"; 
    31  struct roar_keyval * arg; 
    32  
    33  (void)para; // We ignore all parameters passed to us. 
     31 struct roar_keyval * cur; 
     32 size_t i; 
    3433 
    3534 if ( para != NULL && para->argv != NULL ) { 
    36   arg = roar_keyval_lookup(para->argv, "text", para->argc, 0); 
    37   if ( arg != NULL && arg->value != NULL ) 
    38    text = arg->value; 
     35  for (i = 0; i < para->argc; i++) { 
     36   cur = &(para->argv[i]); 
     37   if ( cur->key != NULL && !strcmp(cur->key, "text") ) { 
     38    if ( cur->value != NULL ) { 
     39     text = cur->value; 
     40    } else if ( (i+1) < para->argc && para->argv[i+1].key == NULL ) { 
     41     text = para->argv[i+1].value; 
     42     i++; 
     43    } 
     44   } 
     45  } 
    3946 } 
    4047 
Note: See TracChangeset for help on using the changeset viewer.