From b182442f7a929138176282fd6f561e0ef63a4a40 Mon Sep 17 00:00:00 2001 From: Scoopta Date: Fri, 13 Mar 2020 12:30:00 -0700 Subject: [PATCH] The full DSO name no longer needs to be specified to load an external mode --- src/wofi.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/wofi.c b/src/wofi.c index b193cb0..d095c2d 100644 --- a/src/wofi.c +++ b/src/wofi.c @@ -1245,13 +1245,26 @@ static struct mode* add_mode(char* _mode) { mode_ptr = calloc(1, sizeof(struct mode)); props = map_init(); - init = load_mode("external", mode_ptr, props); - - map_put(props, "exec", _mode); + char* name = utils_concat(3, "lib", _mode, ".so"); + init = load_mode(name, mode_ptr, props); + free(name); if(init == NULL) { - fprintf(stderr, "I would love to show %s but Idk what it is\n", _mode); - exit(1); + free(mode_ptr->name); + free(mode_ptr); + map_free(props); + + mode_ptr = calloc(1, sizeof(struct mode)); + props = map_init(); + + init = load_mode("external", mode_ptr, props); + + map_put(props, "exec", _mode); + + if(init == NULL) { + fprintf(stderr, "I would love to show %s but Idk what it is\n", _mode); + exit(1); + } } } map_put_void(modes, _mode, mode_ptr);