소스 검색

* Added cmd_nohelp for showing cmds with no help info.
* Added int nohelp to cmd_t struct, last element.


svn: 362

Bryan Drewery 22 년 전
부모
커밋
e8c0289870
3개의 변경된 파일31개의 추가작업 그리고 5개의 파일을 삭제
  1. 25 0
      src/cmds.c
  2. 5 4
      src/cmdt.h
  3. 1 1
      src/tclhash.c

+ 25 - 0
src/cmds.c

@@ -742,6 +742,30 @@ int my_cmp (const mycmds *c1, const mycmds *c2)
   return strcmp (c1->name, c2->name);
 }
 
+static void cmd_nohelp(struct userrec *u, int idx, char *par)
+{
+  int i;
+  char *buf = nmalloc(1);
+  buf[0] = 0;
+
+  qsort(cmds, cmdi - 1, sizeof(mycmds), (int (*)()) &my_cmp);
+  
+  for (i = 0; i < (cmdi - 1); i++) {
+    int o, found = 0;
+    for (o = 0; (help[o].cmd) && (help[o].desc); o++)
+      if (!egg_strcasecmp(help[o].cmd, cmds[i].name)) found++;
+    if (!found) {
+      buf = nrealloc(buf, strlen(buf) + 2 + strlen(cmds[i].name) + 1);
+      strcat(buf, cmds[i].name);
+      strcat(buf, ", ");
+    }
+  }
+  buf[strlen(buf) - 1] = 0;
+
+  dumplots(idx, "", buf);
+
+}
+
 static void cmd_help(struct userrec *u, int idx, char *par)
 {
   char flg[100];
@@ -3997,6 +4021,7 @@ cmd_t C_dcc[] =
   {"echo",		"",	(Function) cmd_echo,		NULL},
   {"fixcodes",		"",	(Function) cmd_fixcodes,	NULL},
   {"handle",		"",	(Function) cmd_handle,		NULL},
+  {"nohelp",		"-|-",	(Function) cmd_nohelp,		NULL, 		1},
   {"help",		"-|-",	(Function) cmd_help,		NULL},
   {"ignores",		"m",	(Function) cmd_ignores,		NULL},
 #ifdef HUB

+ 5 - 4
src/cmdt.h

@@ -8,10 +8,11 @@
 #define _EGG_CMDT_H
 
 typedef struct {
-  char *name;
-  char *flags;
-  Function func;
-  char *funcname;
+  char 		*name;
+  char 		*flags;
+  Function 	func;
+  char 		*funcname;
+  int		nohelp;
 } cmd_t;
 
 typedef struct {

+ 1 - 1
src/tclhash.c

@@ -1167,7 +1167,7 @@ void add_builtins(tcl_bind_list_t *tl, cmd_t *cc)
   table[1].name = NULL;
   for (i = 0; cc[i].name; i++) {
     /* add H_dcc cmds to cmds[] :: add to the help system.. */
-    if (tl == H_dcc) {
+    if (tl == H_dcc && !(cc[i].nohelp)) {
       cmds[cmdi].name = cc[i].name;
       cmds[cmdi].flags.match = FR_GLOBAL | FR_CHAN;
       break_down_flags(cc[i].flags, &(cmds[cmdi].flags), NULL);