/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2010 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2011 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.
typedef enum
{
- ITEM_ARG, /* item with simple list like .job */
+ ITEM_ARG, /* item with simple list like .jobs */
ITEM_HELP /* use help item=xxx and detect all arguments */
} cpl_item_t;
{"pool=", ".pool" },
{"fileset=", ".fileset" },
{"client=", ".client" },
- {"job=", ".job" },
+ {"job=", ".jobs" },
+ {"restore_job=",".jobs type=R" },
{"level=", ".level" },
{"storage=", ".storage" },
{"schedule=", ".schedule" },
{"mark", ".ls" },
{"m", ".ls" },
{"unmark", ".lsmark" },
+ {"catalog=", ".catalogs" },
{"actiononpurge=", ".actiononpurge" }
};
#define key_size ((int)(sizeof(cpl_keywords)/sizeof(struct cpl_keywords_t)))
return 1;
}
+/*
+ * Return 1 if OK
+ * 0 if no input
+ * -1 error (must stop)
+ */
int
get_cmd(FILE *input, const char *prompt, BSOCK *sock, int sec)
{
*/
line = readline((char *)prompt); /* cast needed for old readlines */
if (!line) {
- exit(1);
+ return -1; /* error return and exit */
}
strip_trailing_junk(line);
command = line;
sendit(_("Command logic problem\n"));
sock->msglen = 0;
sock->msg[0] = 0;
- return 0;
+ return 0; /* No input */
}
/*
actuallyfree(line); /* allocated by readline() malloc */
line = NULL;
}
- return 1;
+ return 1; /* OK */
}
#else /* no readline, do it ourselves */
int ret=0;
#ifdef HAVE_READLINE
-/* first, try to truncate the history file, and if it
- * fail, the file is probably not present, and we
+/*
+ * first, try to truncate the history file, and if it
+ * fails, the file is probably not present, and we
* can use write_history to create it
*/
} else {
ret = write_history(histfile);
}
-
#endif
return ret;
int ret=0;
#ifdef HAVE_READLINE
-
using_history();
ret = read_history(histfile);
/* Tell the completer that we want a complete . */
return OK;
}
+/* @version */
static int versioncmd(FILE *input, BSOCK *UA_sock)
{
senditf("Version: " VERSION " (" BDATE ") %s %s %s\n",
return 1;
}
+/* @input <input-filename> */
static int inputcmd(FILE *input, BSOCK *UA_sock)
{
FILE *fd;
return 1;
}
-/* Send output to both termina and specified file */
+/* @tee <output-filename> */
+/* Send output to both terminal and specified file */
static int teecmd(FILE *input, BSOCK *UA_sock)
{
teeout = true;
return do_outputcmd(input, UA_sock);
}
+/* @output <output-filename> */
/* Send output to specified "file" */
static int outputcmd(FILE *input, BSOCK *UA_sock)
{
}
/*
- * exec "some-command" [wait-seconds]
+ * @exec "some-command" [wait-seconds]
*/
static int execcmd(FILE *input, BSOCK *UA_sock)
{
}
+/* @echo xxx yyy */
static int echocmd(FILE *input, BSOCK *UA_sock)
{
for (int i=1; i < argc; i++) {
return 1;
}
+/* @quit */
static int quitcmd(FILE *input, BSOCK *UA_sock)
{
return 0;
}
+/* @help */
static int helpcmd(FILE *input, BSOCK *UA_sock)
{
int i;
}
+/* @sleep secs */
static int sleepcmd(FILE *input, BSOCK *UA_sock)
{
if (argc > 1) {
return 1;
}
-
+/* @time */
static int timecmd(FILE *input, BSOCK *UA_sock)
{
char sdt[50];