]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/console/console.c
Create patch that may fix bug #1298 and bug #1304, which causes
[bacula/bacula] / bacula / src / console / console.c
index c1f0d2c128602db4abd8dcc6a2706d1446732ff1..a99c028169fdc1f5c1b9a0a0c31d4f60b5da2a10 100644 (file)
@@ -1,7 +1,7 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2000-2008 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2009 Free Software Foundation Europe e.V.
 
    The main author of Bacula is Kern Sibbald, with contributions from
    many others, a complete list can be found in the file AUTHORS.
@@ -101,6 +101,7 @@ static int inputcmd(FILE *input, BSOCK *UA_sock);
 static int outputcmd(FILE *input, BSOCK *UA_sock);
 static int teecmd(FILE *input, BSOCK *UA_sock);
 static int quitcmd(FILE *input, BSOCK *UA_sock);
+static int helpcmd(FILE *input, BSOCK *UA_sock);
 static int echocmd(FILE *input, BSOCK *UA_sock);
 static int timecmd(FILE *input, BSOCK *UA_sock);
 static int sleepcmd(FILE *input, BSOCK *UA_sock);
@@ -176,11 +177,12 @@ static struct cmdstruct commands[] = {
  { N_("exec"),       execcmd,      _("execute an external command")},
  { N_("exit"),       quitcmd,      _("exit = quit")},
  { N_("zed_keys"),   zed_keyscmd,  _("zed_keys = use zed keys instead of bash keys")},
+ { N_("help"),       helpcmd,      _("help listing")},
 #ifdef HAVE_READLINE
  { N_("separator"),  eolcmd,       _("set command separator")},
 #endif
              };
-#define comsize (sizeof(commands)/sizeof(struct cmdstruct))
+#define comsize ((int)(sizeof(commands)/sizeof(struct cmdstruct)))
 
 static int do_a_command(FILE *input, BSOCK *UA_sock)
 {
@@ -1068,8 +1070,7 @@ static int execcmd(FILE *input, BSOCK *UA_sock)
 static int echocmd(FILE *input, BSOCK *UA_sock)
 {
    for (int i=1; i < argc; i++) {
-      senditf("%s", argk[i]);
-      sendit(" ");
+      senditf("%s ", argk[i]);
    }
    sendit("\n");
    return 1;
@@ -1080,6 +1081,16 @@ static int quitcmd(FILE *input, BSOCK *UA_sock)
    return 0;
 }
 
+static int helpcmd(FILE *input, BSOCK *UA_sock)
+{
+   int i;
+   for (i=0; i<comsize; i++) { 
+      senditf("  %-10s %s\n", commands[i].key, commands[i].help);
+   }
+   return 1;   
+}
+
+
 static int sleepcmd(FILE *input, BSOCK *UA_sock)
 {
    if (argc > 1) {