commit d4e71cdd21347d1d64ef59de4c8bc0afaf775523
Author: shermp <14854761+shermp@users.noreply.github.com>
Date: Sat Apr 25 19:52:26 2020 +1200
Log when action is run
Co-authored-by: Patrick Gaskin <patrick@pgaskin.net>
commit 6533e8cc6a74a0b7246334b4712a96d678aefcd0
Author: shermp <14854761+shermp@users.noreply.github.com>
Date: Sat Apr 25 19:32:28 2020 +1200
Fixed field numbers in 'chain' error messages
Fixes the consequences of copy & paste
commit 9c4311ce5b1eb01b81a18cc19b39025514ba6be4
Author: shermp <14854761+shermp@users.noreply.github.com>
Date: Sat Apr 25 19:27:30 2020 +1200
Simplified nm_config_push_action()
The previous implementation was a bit... convoluted
Co-authored-by: Patrick Gaskin <patrick@pgaskin.net>
commit e17509a85f1f125e3be4386966d37452c970f8a5
Author: shermp <14854761+shermp@users.noreply.github.com>
Date: Sat Apr 25 16:29:46 2020 +1200
Config parser tweaks based on review
Co-authored-by: Patrick Gaskin <patrick@pgaskin.net>
commit fbea6709ffb3cc755d01bdb7ba3ed06fc901aca5
Author: shermp <14854761+shermp@users.noreply.github.com>
Date: Sat Apr 25 15:23:22 2020 +1200
Small documentation tweak
Co-authored-by: Patrick Gaskin <patrick@pgaskin.net>
commit adbfc4b8edd84ca8ce381b0d4a306678f7039be1
Author: shermp <14854761+shermp@users.noreply.github.com>
Date: Sat Apr 25 15:12:49 2020 +1200
Fix config error segfault
Allocating some memory helps...
commit a0eb89598a74df1e7937c8615c4a4d7d1d17101b
Merge: 17d6e90 7491a97
Author: shermp <14854761+shermp@users.noreply.github.com>
Date: Sat Apr 25 14:48:06 2020 +1200
Merge branch 'master' into pre-hook-exp2
commit 17d6e90d62df4b754967d2f2ea94f0d29aa8786d
Author: shermp <14854761+shermp@users.noreply.github.com>
Date: Sat Apr 25 11:52:41 2020 +1200
Change loop as suggested
commit fa16f123b6c08fce88227f74b75aa2b1983bef65
Author: shermp <14854761+shermp@users.noreply.github.com>
Date: Sat Apr 25 11:50:54 2020 +1200
Initial config parsing implementation for chain
commit d4648c424cd4c79aece73d10549c57a91a49366a
Author: shermp <14854761+shermp@users.noreply.github.com>
Date: Sat Apr 25 11:09:58 2020 +1200
Add initial chain documentation
commit fc85239500cb892ee9ecd20c370e664007446d8f
Author: shermp <14854761+shermp@users.noreply.github.com>
Date: Sat Apr 25 11:02:31 2020 +1200
Fix broken loop
commit ce71679a42f1fe7f82f9df68e862e6af2f57c18e
Author: shermp <14854761+shermp@users.noreply.github.com>
Date: Sat Apr 25 10:14:59 2020 +1200
(WIP) Added nm_menu_action_t for action chaining.
Note: this commit will NOT compile
38 lines
1.0 KiB
C
38 lines
1.0 KiB
C
#ifndef NM_MENU_H
|
|
#define NM_MENU_H
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include <stddef.h>
|
|
|
|
#include "action.h"
|
|
|
|
typedef enum {
|
|
NM_MENU_LOCATION_MAIN_MENU = 1,
|
|
NM_MENU_LOCATION_READER_MENU = 2,
|
|
} nm_menu_location_t;
|
|
|
|
typedef struct nm_menu_action_t {
|
|
char *arg;
|
|
nm_action_fn_t act; // can block, must return 0 on success, nonzero with out_err set to the malloc'd error message on error
|
|
struct nm_menu_action_t *next;
|
|
} nm_menu_action_t;
|
|
|
|
typedef struct {
|
|
nm_menu_location_t loc;
|
|
char *lbl;
|
|
nm_menu_action_t *action;
|
|
} nm_menu_item_t;
|
|
|
|
// nm_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 nm_menu_hook(void *libnickel, nm_menu_item_t **items, size_t items_n, char **err_out);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
#endif |