1
0

Started implementing config, implemented uninstall flag

This commit is contained in:
Patrick Gaskin
2020-04-22 12:50:39 -04:00
parent b5b5093f9f
commit 61ed6820c7
8 changed files with 130 additions and 65 deletions

View File

@@ -7,23 +7,23 @@ extern "C" {
#include <stddef.h>
typedef enum {
NMI_MENU_LOCATION_MAIN_MENU = 1,
NMI_MENU_LOCATION_MAIN_MENU = 1,
NMI_MENU_LOCATION_READER_MENU = 2,
} nmi_menu_location_t;
typedef struct {
nmi_menu_location_t loc;
const char *lbl;
const char *arg;
char *lbl;
char *arg;
int (*execute)(const char *arg, char **out_err); // can block, must return 0 on success, nonzero with out_err set to the malloc'd error message on error
} nmi_menu_entry_t;
} nmi_menu_item_t;
// nmi_menu_hook hooks a dlopen'd libnickel handle to add the specified menus,
// and returns 0 on success, or 1 with err_out (if provided) set to the malloc'd
// error message on error. The provided configuration and all pointers it
// references must remain valid for the lifetime of the program (i.e. not stack
// allocated). It MUST NOT be called more than once.
int nmi_menu_hook(void *libnickel, nmi_menu_entry_t *entries, size_t entries_n, char **err_out);
int nmi_menu_hook(void *libnickel, nmi_menu_item_t **items, size_t items_n, char **err_out);
#ifdef __cplusplus
}