Changeset 5828:d981716ace28 in roaraudio
- Timestamp:
- 01/06/13 14:53:12 (11 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/man1/roar-config.1
r5811 r5828 15 15 roar-config [{\-\-output-pc|\-\-output-normal}] [\-\-libs] [\-\-cflags] [LIB] 16 16 17 roar-config [\-\-product PRODUCT] [\-\-provider PROVIDER] [\-\-universal] \-\-path PATH17 roar-config [\-\-product PRODUCT] [\-\-provider PROVIDER] [\-\-universal] {\-\-path PATH|\-\-list\-path} 18 18 19 19 roar-config \-\-render\-path PATH … … 51 51 52 52 .TP 53 \fB--list-path\fR 54 List all known paths with corresponding values. 55 56 .TP 53 57 \fB--product PRODUCT\fR 54 Product string for \-\-path .58 Product string for \-\-path and \-\-list\-path. 55 59 56 60 .TP 57 61 \fB--provider PROVIDER\fR 58 Provider string for \-\-path .62 Provider string for \-\-path and \-\-list\-path. 59 63 60 64 .TP 61 65 \fB--universal\fR 62 Use universal path for \-\-path .66 Use universal path for \-\-path and \-\-list\-path. 63 67 64 68 .TP -
include/libroar/config.h
r5823 r5828 181 181 char * roar_libroar_get_path(const char * name, int null_as_universal, const char * product, const char * provider) _LIBROAR_ATTR_USE_RESULT; 182 182 183 // list all known paths: 184 ssize_t roar_libroar_list_path(const char ** list, size_t len, size_t offset) _LIBROAR_ATTR_USE_RESULT _LIBROAR_ATTR_NONNULL_ALL; 185 183 186 #endif 184 187 -
libroar/config.c
r5823 r5828 608 608 } 609 609 610 ssize_t roar_libroar_list_path(const char ** list, size_t len, size_t offset) { 611 size_t i; 612 ssize_t idx = 0; 613 614 if ( list == NULL ) { 615 roar_err_set(ROAR_ERROR_FAULT); 616 return -1; 617 } 618 619 if ( len == 0 ) 620 return 0; 621 622 if ( offset >= (sizeof(__paths)/sizeof(*__paths)) ) 623 return 0; 624 625 for (i = offset; i < (sizeof(__paths)/sizeof(*__paths)); i++) { 626 list[idx++] = __paths[i].name; 627 } 628 629 return idx; 630 } 631 610 632 //ll -
roarclients/roar-config.c
r5824 r5828 142 142 } 143 143 144 void list_path(int null_as_universal, const char * product, const char * provider) { 145 const char * names[32]; 146 char * path; 147 size_t offset = 0; 148 ssize_t ret; 149 ssize_t i; 150 const char * err; 151 size_t errlen; 152 153 while (1) { 154 ret = roar_libroar_list_path(names, sizeof(names)/sizeof(*names), offset); 155 if ( ret < 1 ) 156 break; 157 offset += (size_t)ret; 158 159 for (i = 0; i < ret; i++) { 160 path = roar_libroar_get_path(names[i], null_as_universal, product, provider); 161 if ( path == NULL && roar_error == ROAR_ERROR_INVAL ) 162 path = roar_libroar_get_path(names[i], 0, product, NULL); 163 if ( path == NULL && roar_error == ROAR_ERROR_INVAL ) 164 path = roar_libroar_get_path(names[i], 0, NULL, NULL); 165 if ( path == NULL ) { 166 err = roar_errorstring; 167 errlen = roar_mm_strlen(err) + roar_mm_strlen("<Error: >") + 1; 168 path = roar_mm_malloc(errlen); 169 if ( path == NULL ) 170 continue; 171 snprintf(path, errlen, "<Error: %s>", err); 172 } 173 174 printf("%-24s: %s\n", names[i], path); 175 roar_mm_free(path); 176 } 177 } 178 } 179 144 180 void print_renderpath(const char * path) { 145 181 char buf[1024]; … … 156 192 " roar-config --compare-versions VERSIONA OPERATOR VERSIONB\n" 157 193 " roar-config [{--output-pc|--output-normal}] [--libs] [--cflags] [LIB]\n" 158 " roar-config [--product PRODUCT] [--provider PROVIDER] [--universal] --path PATH\n"194 " roar-config [--product PRODUCT] [--provider PROVIDER] [--universal] {--path PATH|--list-path}\n" 159 195 " roar-config --render-path PATH\n"); 160 196 … … 166 202 " - Compare version A against B with operator OP.\n" 167 203 " --path NAME - Print path NAME\n" 168 " --product PRODUCT - Product string for --path\n" 169 " --provider PROVIDER - Provider string for --path\n" 170 " --universal - Use universal path for --path\n" 204 " --list-path - Print all known paths\n" 205 " --product PRODUCT - Product string for --path/--list-path\n" 206 " --provider PROVIDER - Provider string for --path/--list-path\n" 207 " --universal - Use universal path for --path/--list-path\n" 171 208 " --render-path PATH - Print a rendered path\n" 172 209 " --libs - Show linker flags (-lxxx) needed to link library\n" … … 211 248 } else if ( !strcmp(argv[i], "--path") ) { 212 249 print_path(argv[++i], null_as_universal, product, provider); 250 } else if ( !strcmp(argv[i], "--list-path") ) { 251 list_path(null_as_universal, product, provider); 213 252 } else if ( !strcmp(argv[i], "--render-path") ) { 214 253 print_renderpath(argv[++i]);
Note: See TracChangeset
for help on using the changeset viewer.