summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2021-05-03 02:34:19 +0000
committermidipix <writeonce@midipix.org>2021-05-03 02:34:19 +0000
commit1f2c01c19d001c0e9b8cabc2522ae91e79f70944 (patch)
treebb2f621d1586d332da0436975bf60de10b51683a
parenta94325a743ce01f4f27aeea75ee413504e1b4c32 (diff)
downloadslibtool-1f2c01c19d001c0e9b8cabc2522ae91e79f70944.tar.bz2
slibtool-1f2c01c19d001c0e9b8cabc2522ae91e79f70944.tar.xz
driver api: slbt_get_flavor_settings(): initial implementation.
-rw-r--r--include/slibtool/slibtool.h2
-rw-r--r--src/driver/slbt_driver_ctx.c20
2 files changed, 22 insertions, 0 deletions
diff --git a/include/slibtool/slibtool.h b/include/slibtool/slibtool.h
index 31252d6..b10698a 100644
--- a/include/slibtool/slibtool.h
+++ b/include/slibtool/slibtool.h
@@ -294,6 +294,8 @@ slbt_api int slbt_exec_uninstall (const struct slbt_driver_ctx *, struct
slbt_api int slbt_set_alternate_host (const struct slbt_driver_ctx *, const char * host, const char * flavor);
slbt_api void slbt_reset_alternate_host (const struct slbt_driver_ctx *);
+slbt_api int slbt_get_flavor_settings (const char *, const struct slbt_flavor_settings **);
+
/* helper api */
slbt_api int slbt_archive_import (const struct slbt_driver_ctx *, struct slbt_exec_ctx *,
char * dstarchive, char * srcarchive);
diff --git a/src/driver/slbt_driver_ctx.c b/src/driver/slbt_driver_ctx.c
index fecf27d..37d5660 100644
--- a/src/driver/slbt_driver_ctx.c
+++ b/src/driver/slbt_driver_ctx.c
@@ -1882,6 +1882,26 @@ int slbt_set_alternate_host(
return 0;
}
+int slbt_get_flavor_settings(
+ const char * flavor,
+ const struct slbt_flavor_settings ** settings)
+{
+ if (!strcmp(flavor,"midipix"))
+ *settings = &host_flavor_midipix;
+ else if (!strcmp(flavor,"mingw"))
+ *settings = &host_flavor_mingw;
+ else if (!strcmp(flavor,"cygwin"))
+ *settings = &host_flavor_cygwin;
+ else if (!strcmp(flavor,"darwin"))
+ *settings = &host_flavor_darwin;
+ else if (!strcmp(flavor,"default"))
+ *settings = &host_flavor_default;
+ else
+ *settings = 0;
+
+ return *settings ? 0 : -1;
+}
+
const struct slbt_source_version * slbt_source_version(void)
{
return &slbt_src_version;