Here's a patch that adds a $getcommands() function to epic, which works
in the same way as $getsets(), but operates on the list of builtin
commands in epic..useful for tabkey scripts, perhaps?
diff -ru epic4/CVS/Entries epic4-me/CVS/Entries
--- epic4/CVS/Entries Sun Feb 17 12:45:24 2002
+++ epic4-me/CVS/Entries Sun Feb 17 12:41:27 2002
@@ -13,4 +13,9 @@
/mkinstalldirs/1.1.1.1/Tue Dec 5 00:11:56 2000//
/mkpatch/1.1.1.1/Tue Dec 5 00:11:56 2000//
/test.c/1.1.1.1/Tue Dec 5 00:11:56 2000//
-D
+D/contrib////
+D/doc////
+D/include////
+D/regress////
+D/script////
+D/source////
Only in epic4/CVS: Entries.Log
diff -ru epic4/include/commands.h epic4-me/include/commands.h
--- epic4/include/commands.h Tue Nov 13 13:37:19 2001
+++ epic4-me/include/commands.h Sun Feb 17 12:22:08 2002
@@ -41,5 +41,7 @@
int command_exist (char *);
BUILT_IN_COMMAND(e_channel);
void do_defered_commands (void);
+ char *get_all_commands (void);
+ char *get_command (const char *);
#endif /* __commands_h__ */
diff -ru epic4/include/config.h epic4-me/include/config.h
--- epic4/include/config.h Sun Feb 17 12:45:31 2002
+++ epic4-me/include/config.h Sun Feb 17 12:40:28 2002
@@ -42,7 +42,7 @@
* the client will NOT compile and work properly! Use the default here if
* you dont have other servers to use.
*/
-#define DEFAULT_SERVER "localhost irc.efnet.net irc.undernet.org irc.dal.net"
+#define DEFAULT_SERVER "localhost"
/*
* The left and right brace characters ('{', '}') are special characters in
diff -ru epic4/source/commands.c epic4-me/source/commands.c
--- epic4/source/commands.c Fri Feb 1 17:04:28 2002
+++ epic4-me/source/commands.c Sun Feb 17 12:37:40 2002
@@ -3023,6 +3023,35 @@
parse_line(NULL, args, line ? line : empty_string, 0, 0);
}
+/*
+ * hrmm, these are remarkable similar to get_all_sets() and get_set() :)
+ */
+char *get_all_commands(void)
+{
+ int i;
+ char *ret = NULL;
+ size_t rclue = 0;
+
+ for (i = 0; irc_command[i].name; ++i)
+ m_sc3cat(&ret, space, irc_command[i].name, &rclue);
+ return ret;
+}
+
+char *get_command(const char *str)
+{
+ int i;
+ char *ret = NULL;
+ size_t rclue = 0;
+
+ if (!str || !*str)
+ return get_all_commands();
+
+ for (i = 0; irc_command[i].name; ++i)
+ if (wild_match(str, irc_command[i].name))
+ m_sc3cat(&ret, space, irc_command[i].name, &rclue);
+
+ return ret ? ret : m_strdup(empty_string);
+}
/*
diff -ru epic4/source/functions.c epic4-me/source/functions.c
--- epic4/source/functions.c Wed Feb 13 18:46:17 2002
+++ epic4-me/source/functions.c Sun Feb 17 12:39:45 2002
@@ -204,6 +204,7 @@
*function_functioncall (char *),
*function_geom (char *),
*function_getcap (char *),
+ *function_getcommands (char *),
*function_getenv (char *),
*function_getgid (char *),
*function_getlogin (char *),
@@ -444,6 +445,7 @@
{ "GEOM", function_geom },
{ "GETARRAYS", function_getarrays },
{ "GETCAP", function_getcap },
+ { "GETCOMMANDS", function_getcommands },
{ "GETENV", function_getenv },
{ "GETGID", function_getgid },
{ "GETITEM", function_getitem },
@@ -5288,6 +5290,24 @@
while ((s = next_arg(input, &input)))
{
char *s2 = get_set(s);
+ malloc_strcat(&ret, s2);
+ new_free(&s2);
+ }
+
+ RETURN_MSTR(ret);
+}
+
+BUILT_IN_FUNCTION(function_getcommands, input)
+{
+ char *s = NULL;
+ char *ret = NULL;
+
+ if (!input || !*input)
+ return get_command(NULL);
+
+ while ((s = next_arg(input, &input)))
+ {
+ char *s2 = get_command(s);
malloc_strcat(&ret, s2);
new_free(&s2);
}