}
x32 = 123456789;
bsnprintf(buf, sizeof(buf), "%u", x32);
- i = bsscanf(buf, "%u", &y32);
+ i = bsscanf(buf, "%lu", &y32);
if (i != 1 || x32 != y32) {
Pmsg3(-1, _("32 bit printf/scanf problem. i=%d x32=%u y32=%u\n"), i, x32, y32);
exit(1);
bsnprintf(buf, sizeof(buf), "%" llu, x64);
i = bsscanf(buf, "%llu", &y64);
if (i != 1 || x64 != y64) {
- Pmsg3(-1, _("64 bit printf/scanf problem. i=%d x64=%" llu " y64=%" llu "\n"), i, x64, y64);
+ Pmsg3(-1, _("64 bit printf/scanf problem. i=%d x64=%" llu " y64=%" llu "\n"),
+ i, x64, y64);
exit(1);
}
my_name_is(margc, margv, "btape");
init_msg(NULL, NULL);
+ OSDependentInit();
+
while ((ch = getopt(margc, margv, "b:c:d:psv?")) != -1) {
switch (ch) {
case 'b': /* bootstrap file */
dev->term();
}
+ free_volume_list();
+
if (debug_level > 10)
print_memory_pool_stats();
}
}
dev->rewind(dcr);
- write_new_volume_label_to_dev(dcr, cmd, "Default");
+ write_new_volume_label_to_dev(dcr, cmd, "Default", true /* label dvd now */);
Pmsg1(-1, _("Wrote Volume label for volume \"%s\".\n"), cmd);
}
file_index = 0;
if (last_block) {
free_block(last_block);
+ last_block = NULL;
}
last_block_num = last_block_num1;
last_file = last_file1;
Pmsg1(0, _("Begin writing raw blocks of %u bytes.\n"), block->buf_len);
for ( ;; ) {
*p = block_num;
- stat = write(dev->fd, block->buf, block->buf_len);
+ if (dev->is_tape()) {
+ stat = tape_write(dev->fd, block->buf, block->buf_len);
+ } else {
+ stat = write(dev->fd, block->buf, block->buf_len);
+ }
if (stat == (int)block->buf_len) {
if ((block_num++ % 100) == 0) {
printf("+");
unsigned int i;
bool found;
- while (get_cmd("*")) {
+ while (!quit && get_cmd("*")) {
sm_check(__FILE__, __LINE__, false);
found = false;
parse_args(cmd, &args, &argc, argk, argv, MAX_CMD_ARGS);
found = true;
break;
}
- if (!found)
- Pmsg1(0, _("%s is an illegal command\n"), cmd);
- if (quit)
- break;
+ if (!found) {
+ Pmsg1(0, _("\"%s\" is an illegal command\n"), cmd);
+ }
}
}
static void usage()
{
fprintf(stderr, _(
-"Copyright (C) 2000-2005 Kern Sibbald.\n"
+"Copyright (C) 2000-%s Kern Sibbald.\n"
"\nVersion: %s (%s)\n\n"
"Usage: btape <options> <device_name>\n"
" -b <file> specify bootstrap file\n"
" -s turn off signals\n"
" -v be verbose\n"
" -? print this message.\n"
-"\n"), VERSION, BDATE);
+"\n"), BYEAR, VERSION, BDATE);
}