Changeset 2884:ef7b43db1134 in roaraudio for libroar
- Timestamp:
- 10/10/09 01:34:11 (15 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libroar/config.c
r2653 r2884 53 53 struct roar_libroar_config * config = roar_libroar_get_config_ptr(); 54 54 static int inited = 0; 55 char * k, * v, *next;55 char * next; 56 56 57 57 if ( !inited ) { 58 58 next = getenv("ROAR_OPTIONS"); 59 59 60 while (next != NULL) { 61 k = next; 62 next = strstr(next, " "); 63 if ( next != NULL ) { 64 *next = 0; 65 next++; 66 } 67 68 if ( (v = strstr(k, ":")) != NULL ) { 69 *v = 0; 70 v++; 71 } 72 73 if ( !strcmp(k, "workaround") ) { 74 if ( !strcmp(v, "use-execed") ) { 75 config->workaround.workarounds |= ROAR_LIBROAR_CONFIG_WAS_USE_EXECED; 76 } else { 77 ROAR_WARN("roar_libroar_get_config(void): Unknown workaround option: %s", v); 78 } 79 } else if ( !strcmp(k, "warning") || !strcmp(k, "warn") ) { 80 if ( !strcmp(v, "sysio") ) { 81 config->warnings.sysio = ROAR_WARNING_ALWAYS; 82 } else { 83 ROAR_WARN("roar_libroar_get_config(void): Unknown warning option: %s", v); 84 } 85 } else { 86 ROAR_WARN("roar_libroar_get_config(void): Unknown option: %s", k); 87 } 60 if ( next != NULL ) { 61 roar_libroar_config_parse(next, " "); 88 62 } 89 63 … … 92 66 93 67 return config; 68 } 69 70 int roar_libroar_config_parse(char * txt, char * delm) { 71 struct roar_libroar_config * config = roar_libroar_get_config_ptr(); 72 char * k, * v, * next = txt; 73 74 while (next != NULL) { 75 k = next; 76 next = strstr(next, delm); 77 if ( next != NULL ) { 78 *next = 0; 79 next++; 80 } 81 82 if ( (v = strstr(k, ":")) != NULL ) { 83 *v = 0; 84 v++; 85 } 86 87 if ( !strcmp(k, "workaround") ) { 88 if ( !strcmp(v, "use-execed") ) { 89 config->workaround.workarounds |= ROAR_LIBROAR_CONFIG_WAS_USE_EXECED; 90 } else { 91 ROAR_WARN("roar_libroar_get_config(void): Unknown workaround option: %s", v); 92 } 93 } else if ( !strcmp(k, "warning") || !strcmp(k, "warn") ) { 94 if ( !strcmp(v, "sysio") ) { 95 config->warnings.sysio = ROAR_WARNING_ALWAYS; 96 } else { 97 ROAR_WARN("roar_libroar_get_config(void): Unknown warning option: %s", v); 98 } 99 } else { 100 ROAR_WARN("roar_libroar_get_config(void): Unknown option: %s", k); 101 } 102 } 103 104 return 0; 94 105 } 95 106
Note: See TracChangeset
for help on using the changeset viewer.