Added "vbtest" for simple library testing, command mode is implemented.
[vblib.git] / vblib.c
diff --git a/vblib.c b/vblib.c
index 9bf8ea1..8850dc1 100644 (file)
--- a/vblib.c
+++ b/vblib.c
@@ -801,14 +801,21 @@ char *chat_cmdpars[CHAT_CMD_MAXPARS];
 
 static void chatfn_help(void);
 
+void chatfn_quit(void) __WEAK;
+void chatfn_quit(void)
+{
+       VB_LOG(CRIT,"chatfn_quit() not initialized");
+}
+
 static const struct chat_cmdtab  chat_cmdint[]={
        {"help"    ,0,chatfn_help    ,"This help"},
-#if 0
        {"quit"    ,0,chatfn_quit    ,"Close connection"},
        {"exit"    ,0,chatfn_quit    ,"Close connection"},
-#endif
 };
 
+const struct chat_cmdtab chat_cmdtable[] __WEAK =
+       {{NULL,0,NULL,NULL}};
+
 static void chatfn_help(void)
 {
 int i;
@@ -858,6 +865,10 @@ const struct chat_cmdtab *cmd,*cmdt;
                }
        chat_parsepars(s);
        cmdt=chat_cmdtable;
+       if (!cmdt || !cmdt->name) {
+               VB_LOG(CRIT,"chat_cmdtable not initialized, \"%s\" tried to execute \"%s\"",who,cmds);
+               return;
+               }
        for (i=0;i<NELEM(chat_cmdint);) {
                if (cmdt->name) cmd=cmdt++;
                else cmd=&chat_cmdint[i++];