summaryrefslogtreecommitdiff
path: root/src/core/commands.h
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2000-06-28 15:36:57 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2000-06-28 15:36:57 +0000
commitc248de0ecad658520c84c348d50e88e9fede1280 (patch)
tree05b0b38e794c2909b535e6b8ca7cb2f2da674f61 /src/core/commands.h
parent6757207328c64d5cc2f8f13f4ede583b9b56b815 (diff)
downloadirssi-c248de0ecad658520c84c348d50e88e9fede1280.zip
-options can now be completed with tabulator. There's also automatic
completion for them, like instead of /join -invite you can use just /join -i. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@385 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/core/commands.h')
-rw-r--r--src/core/commands.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/core/commands.h b/src/core/commands.h
index 1f1dc8dd..fa553518 100644
--- a/src/core/commands.h
+++ b/src/core/commands.h
@@ -10,7 +10,8 @@ typedef struct {
} COMMAND_REC;
enum {
- CMDERR_OPTION_UNKNOWN = -2, /* unknown -option */
+ CMDERR_OPTION_UNKNOWN = -3, /* unknown -option */
+ CMDERR_OPTION_AMBIGUOUS = -2, /* ambiguous -option */
CMDERR_OPTION_ARG_MISSING = -1, /* argument missing for -option */
CMDERR_ERRNO, /* get the error from errno */
@@ -22,15 +23,20 @@ enum {
CMDERR_NOT_GOOD_IDEA /* not good idea to do, -yes overrides this */
};
+/* Return the full command for `alias' */
#define alias_find(alias) \
iconfig_get_str("aliases", alias, NULL)
-#define cmd_return_error(a) { signal_emit("error command", 1, GINT_TO_POINTER(a)); signal_stop(); return; }
-#define cmd_param_error(a) { cmd_params_free(free_arg); cmd_return_error(a); }
+/* Returning from command function with error */
+#define cmd_return_error(a) \
+ { signal_emit("error command", 1, GINT_TO_POINTER(a)); signal_stop(); return; }
+#define cmd_param_error(a) \
+ { cmd_params_free(free_arg); cmd_return_error(a); }
extern GSList *commands;
-extern char *current_command;
+extern char *current_command; /* the command we're right now. */
+/* Bind command to specified function. */
void command_bind_to(int pos, const char *cmd, const char *category, SIGNAL_FUNC func);
#define command_bind(a, b, c) command_bind_to(1, a, b, c)
#define command_bind_first(a, b, c) command_bind_to(0, a, b, c)
@@ -57,6 +63,8 @@ COMMAND_REC *command_find(const char *cmd);
You can call this command multiple times for same command, options
will be merged. If there's any conflicts with option types, the last
call will override the previous */
+#define iscmdtype(c) \
+ ((c) == '-' || (c) == '+' || (c) == '@')
void command_set_options(const char *cmd, const char *options);
/* count can have these flags: */