Index: ChangeLog
===================================================================
--- ChangeLog	(revision 5743)
+++ ChangeLog	(revision 5747)
@@ -8,4 +8,5 @@
 	  protocol-rplay and protocol-gopher (Closes: #311)
 	* Allow RAT builds on systems with full linkage.
+	* Provide a more common interface for path config.
 
 v. 1.0beta7 - Tue Oct 23 2012 23:28 CEST
Index: doc/man1/roar-config.1
===================================================================
--- doc/man1/roar-config.1	(revision 5672)
+++ doc/man1/roar-config.1	(revision 5747)
@@ -27,4 +27,16 @@
 
 .TP
+\fB--product PRODUCT\fR
+Product string for --path.
+
+.TP
+\fB--provider PROVIDER\fR
+Provider string for --path.
+
+.TP
+\fB--universal\fR
+Use universal path for --path.
+
+.TP
 \fB--libs\fR
 Show linker flags (\-lxxx) needed to link library
Index: include/libroar/config.h
===================================================================
--- include/libroar/config.h	(revision 5465)
+++ include/libroar/config.h	(revision 5747)
@@ -153,4 +153,14 @@
 #define roar_libroar_iswarn(cfg) (((cfg) == NULL ? roar_libroar_get_config_ptr() : (cfg))->nowarncounter ? 0 : 1)
 
+// get a buffer to a system local path (prefix).
+// name is the symbolic name of the path, e.g. "prefix-lib".
+// null_as_universal tells of NULL is considered as "universal".
+// if not set NULL is considered 'do not add product path, give root prefix'.
+// product is the name of the product in standard "product <id/vendor>" format.
+// provider is the "<id/vendor>" format. If NULL this is ignored.
+// Returns buffer which needs to be freed with roar_mm_free().
+// Not all paths support product/provider part. If not supported they are ignored.
+char * roar_libroar_get_path(const char * name, int null_as_universal, const char * product, const char * provider);
+
 #endif
 
Index: libroar/config.c
===================================================================
--- libroar/config.c	(revision 5466)
+++ libroar/config.c	(revision 5747)
@@ -432,3 +432,146 @@
 }
 
+static const struct {
+ const char * name;
+ const char * path;
+ const int    with_product;
+ const int    with_provider;
+} __paths[] = {
+ {"prefix",     ROAR_PREFIX, 0, 0},
+ {"prefix-bin", ROAR_PREFIX_BIN, 0, 0},
+ {"prefix-lib", ROAR_PREFIX_LIB, 0, 0},
+ {"prefix-inc", ROAR_PREFIX_INC, 0, 0},
+ {"prefix-man", ROAR_PREFIX_MAN, 0, 0},
+ {"prefix-pc",  ROAR_PREFIX_PC, 0, 0},
+ {"prefix-comp-libs", ROAR_PREFIX_COMP_LIBS, 0, 0},
+ {"prefix-comp-bins", ROAR_PREFIX_COMP_BINS, 0, 0},
+ {"prefix-plugins", ROAR_PREFIX_PLUGINS, 1, 1},
+ {"prefix-buildsystem", ROAR_PREFIX_BUILDSYSTEM, 0, 0}
+};
+
+static int __product2path(char * path, size_t pathlen, int null_as_universal, const char * product) {
+ const char * c;
+ const char * e;
+ const char * s;
+ const char * b;
+
+ if ( product == NULL ) {
+  if ( null_as_universal ) {
+   snprintf(path, pathlen, "/universal/universal");
+  } else {
+   path[0] = 0;
+  }
+  return 0;
+ }
+
+ b = strstr(product, " ");
+ c = strstr(product, "<");
+ e = strstr(product, ">");
+
+ if ( b == NULL || c == NULL || e == NULL || c < b || e < c ) {
+  roar_err_set(ROAR_ERROR_ILLSEQ);
+  return -1;
+ }
+
+ c++;
+
+ s = strstr(c, "/");
+
+ if ( s == NULL ) {
+  snprintf(path, pathlen, "/unreg-%.*s/%.*s", (int)(size_t)(e-c), c, (int)(size_t)(b-product), product);
+ } else {
+  snprintf(path, pathlen, "/%.*s-%.*s/%.*s", (int)(size_t)(s-c), c, (int)(size_t)(e-s-1), s+1, (int)(size_t)(b-product), product);
+ }
+
+ return 0;
+}
+
+static int __provider2path(char * path, size_t pathlen, const char * provider) {
+ const char * c;
+ const char * e;
+ const char * s;
+
+ if ( provider == NULL ) {
+  path[0] = 0;
+  return 0;
+ }
+
+ c = strstr(provider, "<");
+ e = strstr(provider, ">");
+
+ if ( c == NULL || e == NULL || e < c ) {
+  roar_err_set(ROAR_ERROR_ILLSEQ);
+  return -1;
+ }
+
+ c++;
+
+ s = strstr(c, "/");
+
+ if ( s == NULL ) {
+  snprintf(path, pathlen, "/unreg-%.*s", (int)(size_t)(e-c), c);
+ } else {
+  snprintf(path, pathlen, "/%.*s-%.*s", (int)(size_t)(s-c), c, (int)(size_t)(e-s-1), s+1);
+ }
+
+ return 0;
+
+ roar_err_set(ROAR_ERROR_NOTSUP);
+ return -1;
+}
+
+char * roar_libroar_get_path(const char * name, int null_as_universal, const char * product, const char * provider) {
+ char buf_product[1024];
+ char buf_provider[1024];
+ ssize_t len_prefix, len_product, len_provider;
+ size_t i;
+ char * ret, * p;
+
+ if ( name == NULL ) {
+  roar_err_set(ROAR_ERROR_NOENT);
+  return NULL;
+ }
+
+ for (i = 0; i < (sizeof(__paths)/sizeof(*__paths)); i++) {
+  if ( !!strcmp(__paths[i].name, name) )
+   continue;
+
+  if ( ((null_as_universal || product != NULL) && !__paths[i].with_product) ||
+       (provider != NULL && !__paths[i].with_provider) ) {
+   roar_err_set(ROAR_ERROR_INVAL);
+   return NULL;
+  }
+
+  if ( __product2path(buf_product, sizeof(buf_product), null_as_universal, product) == -1 )
+   return NULL;
+
+  if ( __provider2path(buf_provider, sizeof(buf_provider), provider) == -1 )
+   return NULL;
+
+  len_prefix = roar_mm_strlen(__paths[i].path);
+  len_product = roar_mm_strlen(buf_product);
+  len_provider = roar_mm_strlen(buf_provider);
+
+  p = ret = roar_mm_malloc(len_prefix+len_product+len_provider+1);
+  if ( ret == NULL )
+   return NULL;
+
+  memcpy(p, __paths[i].path, len_prefix);
+  p += len_prefix;
+  if ( p[-1] == '/' )
+   p--;
+  memcpy(p, buf_product, len_product);
+  p += len_product;
+  memcpy(p, buf_provider, len_provider);
+  p += len_provider;
+
+  *p = 0;
+
+  return ret;
+ }
+
+ roar_err_set(ROAR_ERROR_NOENT);
+ return NULL;
+}
+
 //ll
Index: roarclients/Makefile
===================================================================
--- roarclients/Makefile	(revision 5737)
+++ roarclients/Makefile	(revision 5747)
@@ -90,5 +90,5 @@
 	$L
 roar-config: roar-config.o
-	$(LNL)
+	$L
 roarvorbis: roarvorbis.o
 	${CC} ${LDFLAGS} -o roarvorbis roarvorbis.o $(VORBISLIBS) $(LIBS)
Index: roarclients/roar-config.c
===================================================================
--- roarclients/roar-config.c	(revision 5674)
+++ roarclients/roar-config.c	(revision 5747)
@@ -53,30 +53,10 @@
 }, * flags_ptr = NULL;
 
-const struct path {
- const char * name;
- const char * path;
-} paths[] = {
- {"prefix",     ROAR_PREFIX},
- {"prefix-bin", ROAR_PREFIX_BIN},
- {"prefix-lib", ROAR_PREFIX_LIB},
- {"prefix-inc", ROAR_PREFIX_INC},
- {"prefix-man", ROAR_PREFIX_MAN},
- {"prefix-pc",  ROAR_PREFIX_PC},
- {"prefix-comp-libs", ROAR_PREFIX_COMP_LIBS},
- {"prefix-comp-bins", ROAR_PREFIX_COMP_BINS},
- {"prefix-plugins", ROAR_PREFIX_PLUGINS},
- {"prefix-buildsystem", ROAR_PREFIX_BUILDSYSTEM},
- {"<<<END>>>", NULL}
-};
-
-void print_path(const char * name) {
- size_t i;
-
- for (i = 0; i < (sizeof(paths)/sizeof(*paths)); i++) {
-  if ( !strcasecmp(name, paths[i].name) ) {
-   printf("%s\n", paths[i].path);
-   return;
-  }
- }
+void print_path(const char * name, int null_as_universal, const char * product, const char * provider) {
+ char * path = roar_libroar_get_path(name, null_as_universal, product, provider);
+ if ( path == NULL )
+  return;
+ printf("%s\n", path);
+ roar_mm_free(path);
 }
 
@@ -87,10 +67,13 @@
 
  printf(
-        "  --version          - Show version of library\n"
-        "  --path NAME        - Print path NAME\n"
-        "  --libs             - Show linker flags (-lxxx) needed to link library\n"
-        "  --cflags           - Show compiler flags needed to link library\n"
-        "  --output-pc        - Output PC format\n"
-        "  --output-normal    - Output PC format\n"
+        "  --version           - Show version of library\n"
+        "  --path NAME         - Print path NAME\n"
+        "  --product PRODUCT   - Product string for --path\n"
+        "  --provider PROVIDER - Provider string for --path\n"
+        "  --universal         - Use universal path for --path\n"
+        "  --libs              - Show linker flags (-lxxx) needed to link library\n"
+        "  --cflags            - Show compiler flags needed to link library\n"
+        "  --output-pc         - Output PC format\n"
+        "  --output-normal     - Output PC format\n"
        );
 
@@ -101,4 +84,7 @@
 int main (int argc, char * argv[]) {
  enum { NORMAL, PC } mode = NORMAL;
+ int null_as_universal = 0;
+ const char * product = NULL;
+ const char * provider = NULL;
  int i, h;
  int cflags = 0;
@@ -117,6 +103,12 @@
    usage();
    return 0;
+  } else if ( !strcmp(argv[i], "--product") ) {
+   product = argv[++i];
+  } else if ( !strcmp(argv[i], "--provider") ) {
+   provider = argv[++i];
+  } else if ( !strcmp(argv[i], "--universal") ) {
+   null_as_universal = 1;
   } else if ( !strcmp(argv[i], "--path") ) {
-   print_path(argv[++i]);
+   print_path(argv[++i], null_as_universal, product, provider);
   } else if ( !strcmp(argv[i], "--libs") ) {
    libs   = 1;
