aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authortaiyu <taiyu.len@gmail.com>2015-09-14 19:59:25 -0700
committertaiyu <taiyu.len@gmail.com>2015-09-14 19:59:25 -0700
commit0bea2e2122bd573d1f9dc68b5a990c8f2ad3f3f0 (patch)
treeae6c559e756b68a6b6091914a7d33d212e374ef3 /include
parente505abfe75923d06098f6230e5a7ba39c091d3ce (diff)
multi command keybinds
Diffstat (limited to 'include')
-rw-r--r--include/commands.h16
-rw-r--r--include/stringop.h6
2 files changed, 15 insertions, 7 deletions
diff --git a/include/commands.h b/include/commands.h
index 5c87be51..1b4cd9ca 100644
--- a/include/commands.h
+++ b/include/commands.h
@@ -3,13 +3,15 @@
#include <stdbool.h>
#include "config.h"
-struct cmd_handler {
- char *command;
- enum cmd_status {
- CMD_SUCCESS,
- CMD_FAILURE,
- CMD_DEFER,
- } (*handle)(int argc, char **argv);
+
+enum cmd_status {
+ CMD_SUCCESS,
+ CMD_FAILURE,
+ CMD_INVALID,
+ CMD_DEFER,
+ // Config Blocks
+ CMD_BLOCK_END,
+ CMD_BLOCK_MODE,
};
enum cmd_status handle_command(char *command);
diff --git a/include/stringop.h b/include/stringop.h
index dde50f13..dc81cdae 100644
--- a/include/stringop.h
+++ b/include/stringop.h
@@ -7,6 +7,7 @@ extern const char *whitespace;
char *strip_whitespace(char *str);
char *strip_comments(char *str);
+void strip_quotes(char *str);
// Simply split a string with delims, free with `free_flat_list`
list_t *split_string(const char *str, const char *delims);
@@ -22,5 +23,10 @@ int unescape_string(char *string);
char *join_args(char **argv, int argc);
char *join_list(list_t *list, char *separator);
+// split string into 2 by delim.
+char *cmdsep(char **stringp, const char *delim);
+// Split string into 2 by delim, handle quotes
+char *argsep(char **stringp, const char *delim);
+
char *strdup(const char *);
#endif