~exec64/imv

ref: 4c0123bb3b449a2ea45b3e831db725d853bb03a1 imv/src/commands.h -rw-r--r-- 1023 bytes
4c0123bb — Harry Jeffery Release v4.0.1 3 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef COMMANDS_H
#define COMMANDS_H

struct list;
struct imv_commands;

/* Create an imv_commands instance */
struct imv_commands *imv_commands_create(void);

/* Cleans up an imv_commands instance */
void imv_commands_free(struct imv_commands *cmds);

/* Register a new command. When a command is executed, the appropriate handler
 * is called, with a void* for passing context.
 */
void imv_command_register(struct imv_commands *cmds, const char *command,
    void (*handler)(struct list*, const char*, void*));

/* Add a command alias. Any arguments provided when invoking an alias are
 * appended to the arguments being passed to the command.
 */
void imv_command_alias(struct imv_commands *cmds, const char *command, const char *alias);

/* Execute a single command */
int imv_command_exec(struct imv_commands *cmds, const char *command, void *data);

/* Execute a list of commands */
int imv_command_exec_list(struct imv_commands *cmds, struct list *commands, void *data);

#endif

/* vim:set ts=2 sts=2 sw=2 et: */