diff --git a/src/lsi.c b/src/lsi.c index 591b9a0..e8f1896 100644 --- a/src/lsi.c +++ b/src/lsi.c @@ -9,22 +9,33 @@ * of the License, or (at your option) any later version. */ +#include #include #include "lsi.h" bool lsi_config_load(__lsi_unused__ LsiConfig *config) { - fputs("lsi_config_load(): Not yet implemented", stderr); + fputs("lsi_config_load(): Not yet implemented\n", stderr); return false; } bool lsi_config_store(__lsi_unused__ LsiConfig *config) { - fputs("lsi_config_store(): Not yet implemented", stderr); + fputs("lsi_config_store(): Not yet implemented\n", stderr); return false; } +void lsi_config_load_defaults(LsiConfig *config) +{ + assert(config != NULL); + + /* Very simple right now, but in future we'll expand the options and + * things that LSI knows about */ + config->force_32 = false; + config->use_native_runtime = true; +} + /* * Editor modelines - https://www.wireshark.org/tools/modelines.html * diff --git a/src/lsi.h b/src/lsi.h index 371a668..863e5d5 100644 --- a/src/lsi.h +++ b/src/lsi.h @@ -41,6 +41,11 @@ bool lsi_config_load(LsiConfig *config); */ bool lsi_config_store(LsiConfig *config); +/** + * Set the defaults for the LsiConfiguration + */ +void lsi_config_load_defaults(LsiConfig *config); + /** * Determine if the host system is 64-bit. * diff --git a/src/shim.c b/src/shim.c index 02f44bf..1a605c6 100644 --- a/src/shim.c +++ b/src/shim.c @@ -9,12 +9,27 @@ * of the License, or (at your option) any later version. */ +#include #include #include "lsi.h" int main(__lsi_unused__ int argc, __lsi_unused__ char **argv) { + LsiConfig config = { 0 }; + bool is_x86_64; + + if (!lsi_config_load(&config)) { + lsi_config_load_defaults(&config); + } + + is_x86_64 = lsi_system_is_64bit(); + + /* Debug printers */ + fprintf(stderr, "emul32? %s\n", config.force_32 ? "yes" : "no"); + fprintf(stderr, "native-runtime? %s\n", config.use_native_runtime ? "yes" : "no"); + fprintf(stderr, "x86-64? %s\n", is_x86_64 ? "yes" : "no"); + return EXIT_FAILURE; }