The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
(FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
Switzerland, email:ftf@fsfeurope.org.
*/
(FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
Switzerland, email:ftf@fsfeurope.org.
*/
static int helpcmd(UAContext *ua, TREE_CTX *tree);
static int cdcmd(UAContext *ua, TREE_CTX *tree);
static int pwdcmd(UAContext *ua, TREE_CTX *tree);
static int helpcmd(UAContext *ua, TREE_CTX *tree);
static int cdcmd(UAContext *ua, TREE_CTX *tree);
static int pwdcmd(UAContext *ua, TREE_CTX *tree);
static int unmarkcmd(UAContext *ua, TREE_CTX *tree);
static int unmarkdircmd(UAContext *ua, TREE_CTX *tree);
static int quitcmd(UAContext *ua, TREE_CTX *tree);
static int unmarkcmd(UAContext *ua, TREE_CTX *tree);
static int unmarkdircmd(UAContext *ua, TREE_CTX *tree);
static int quitcmd(UAContext *ua, TREE_CTX *tree);
{ NT_("mark"), markcmd, _("mark dir/file to be restored recursively, wildcards allowed")},
{ NT_("markdir"), markdircmd, _("mark directory name to be restored (no files)")},
{ NT_("pwd"), pwdcmd, _("print current working directory")},
{ NT_("mark"), markcmd, _("mark dir/file to be restored recursively, wildcards allowed")},
{ NT_("markdir"), markdircmd, _("mark directory name to be restored (no files)")},
{ NT_("pwd"), pwdcmd, _("print current working directory")},
{ NT_("unmark"), unmarkcmd, _("unmark dir/file to be restored recursively in dir")},
{ NT_("unmarkdir"), unmarkdircmd, _("unmark directory name only no recursion")},
{ NT_("quit"), quitcmd, _("quit and do not do restore")},
{ NT_("?"), helpcmd, _("print help")},
};
{ NT_("unmark"), unmarkcmd, _("unmark dir/file to be restored recursively in dir")},
{ NT_("unmarkdir"), unmarkdircmd, _("unmark directory name only no recursion")},
{ NT_("quit"), quitcmd, _("quit and do not do restore")},
{ NT_("?"), helpcmd, _("print help")},
};
/* Get a new context so we don't destroy restore command args */
UAContext *ua = new_ua_context(tree->ua->jcr);
ua->UA_sock = tree->ua->UA_sock; /* patch in UA socket */
/* Get a new context so we don't destroy restore command args */
UAContext *ua = new_ua_context(tree->ua->jcr);
ua->UA_sock = tree->ua->UA_sock; /* patch in UA socket */
"\nYou are now entering file selection mode where you add (mark) and\n"
"remove (unmark) files to be restored. No files are initially added, unless\n"
"you used the \"all\" keyword on the command line.\n"
"\nYou are now entering file selection mode where you add (mark) and\n"
"remove (unmark) files to be restored. No files are initially added, unless\n"
"you used the \"all\" keyword on the command line.\n"
*/
tree->node = (TREE_NODE *)tree->root;
tree_getpath(tree->node, cwd, sizeof(cwd));
*/
tree->node = (TREE_NODE *)tree->root;
tree_getpath(tree->node, cwd, sizeof(cwd));
+ if (ua->api) user->signal(BNET_CMD_BEGIN);
+ parse_args_only(ua->cmd, &ua->args, &ua->argc, ua->argk, ua->argv, MAX_CMD_ARGS);
if (strncasecmp(ua->argk[0], _(commands[i].key), len) == 0) {
stat = (*commands[i].func)(ua, tree); /* go execute command */
found = 1;
break;
}
if (!found) {
if (strncasecmp(ua->argk[0], _(commands[i].key), len) == 0) {
stat = (*commands[i].func)(ua, tree); /* go execute command */
found = 1;
break;
}
if (!found) {
// Dmsg4(000, "Path=%s%s FI=%s JobId=%s\n", row[0], row[1],
// row[2], row[3]);
// Dmsg4(000, "Path=%s%s FI=%s JobId=%s\n", row[0], row[1],
// row[2], row[3]);
- if (*row[1] == 0) { /* no filename => directory */
- if (*row[0] != '/') { /* Must be Win32 directory */
+ if (*row[1] == 0) { /* no filename => directory */
+ if (!IsPathSeparator(*row[0])) { /* Must be Win32 directory */
/*
* Recursively mark the current directory to be restored as
* well as all directories and files below it.
/*
* Recursively mark the current directory to be restored as
* well as all directories and files below it.
foreach_child(node, tree->node) {
if (fnmatch(ua->argk[i], node->fname, 0) == 0) {
count += set_extract(ua, node, tree, true);
foreach_child(node, tree->node) {
if (fnmatch(ua->argk[i], node->fname, 0) == 0) {
count += set_extract(ua, node, tree, true);
foreach_child(node, tree->node) {
if (fnmatch(ua->argk[i], node->fname, 0) == 0) {
if (node->type == TN_DIR || node->type == TN_DIR_NLS) {
foreach_child(node, tree->node) {
if (fnmatch(ua->argk[i], node->fname, 0) == 0) {
if (node->type == TN_DIR || node->type == TN_DIR_NLS) {
edit_uint64_with_commas(total, ec1),
edit_uint64_with_commas(num_extract, ec2));
return 1;
edit_uint64_with_commas(total, ec1),
edit_uint64_with_commas(num_extract, ec2));
return 1;
- bsendmsg(ua, "%s%s%s\n", tag, node->fname, tree_node_has_child(node)?"/":"");
+ ua->send_msg("%s%s%s\n", tag, node->fname, tree_node_has_child(node)?"/":"");
- bsendmsg(ua, "%s%s%s\n", tag, node->fname, tree_node_has_child(node)?"/":"");
+ ua->send_msg("%s%s%s\n", tag, node->fname, tree_node_has_child(node)?"/":"");
memset(&statp, 0, sizeof(statp));
}
ls_output(buf, cwd, tag, &statp, dot_cmd);
memset(&statp, 0, sizeof(statp));
}
ls_output(buf, cwd, tag, &statp, dot_cmd);
total, num_extract, edit_uint64_with_commas(total_bytes, ec1));
return 1;
}
total, num_extract, edit_uint64_with_commas(total_bytes, ec1));
return 1;
}
for (i=0; i<comsize; i++) {
/* List only non-dot commands */
if (commands[i].key[0] != '.') {
for (i=0; i<comsize; i++) {
/* List only non-dot commands */
if (commands[i].key[0] != '.') {
- bsendmsg(ua, " %-10s %s\n", _(commands[i].key), _(commands[i].help));
+ ua->send_msg(" %-10s %s\n", _(commands[i].key), _(commands[i].help));
node = tree_cwd(ua->argk[1], tree->root, tree->node);
if (!node) {
/* Try once more if Win32 drive -- make absolute */
node = tree_cwd(ua->argk[1], tree->root, tree->node);
if (!node) {
/* Try once more if Win32 drive -- make absolute */
- tree_getpath(tree->node, cwd, sizeof(cwd));
- bsendmsg(ua, _("cwd is: %s\n"), cwd);
- return 1;
+ return pwdcmd(ua, tree);
}
static int pwdcmd(UAContext *ua, TREE_CTX *tree)
{
char cwd[2000];
tree_getpath(tree->node, cwd, sizeof(cwd));
}
static int pwdcmd(UAContext *ua, TREE_CTX *tree)
{
char cwd[2000];
tree_getpath(tree->node, cwd, sizeof(cwd));
- bsendmsg(ua, _("cwd is: %s\n"), cwd);
+ if (ua->api) {
+ ua->send_msg("%s", cwd);
+ } else {
+ ua->send_msg(_("cwd is: %s\n"), cwd);
+ }
+static int dot_pwdcmd(UAContext *ua, TREE_CTX *tree)
+{
+ char cwd[2000];
+ tree_getpath(tree->node, cwd, sizeof(cwd));
+ ua->send_msg("%s", cwd);
+ return 1;
+}
foreach_child(node, tree->node) {
if (fnmatch(ua->argk[i], node->fname, 0) == 0) {
count += set_extract(ua, node, tree, false);
foreach_child(node, tree->node) {
if (fnmatch(ua->argk[i], node->fname, 0) == 0) {
count += set_extract(ua, node, tree, false);
- bsendmsg(ua, _("%s files unmarked.\n"), edit_uint64_with_commas(count, ed1));
+ ua->send_msg(_("%s files unmarked.\n"), edit_uint64_with_commas(count, ed1));
foreach_child(node, tree->node) {
if (fnmatch(ua->argk[i], node->fname, 0) == 0) {
if (node->type == TN_DIR || node->type == TN_DIR_NLS) {
foreach_child(node, tree->node) {
if (fnmatch(ua->argk[i], node->fname, 0) == 0) {
if (node->type == TN_DIR || node->type == TN_DIR_NLS) {