forked from gozfree/gear-lib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlibcmd.h
34 lines (28 loc) · 792 Bytes
/
libcmd.h
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
33
34
/******************************************************************************
* Copyright (C) 2014-2016
* file: libcmd.h
* author: gozfree <[email protected]>
* created: 2016-09-16 18:00
* updated: 2016-09-16 18:00
******************************************************************************/
#ifndef LIBCMD_H
#define LIBCMD_H
#include <libdict.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct cmd {
int cnt;
dict *dict;
} cmd_t;
typedef int (*cmd_cb)(int, char **);
struct cmd *cmd_init(int num);
void cmd_deinit(struct cmd *cmd);
int cmd_register(struct cmd *cmd, const char *name, cmd_cb func);
int cmd_execute(struct cmd *cmd, const char *name);
int cmd_get_registered(struct cmd *cmd);
void cmd_loop(struct cmd *cmd);
#ifdef __cplusplus
}
#endif
#endif