static int argc;
static int quickie_count = 0;
+static uint64_t write_count = 0;
static BSR *bsr = NULL;
static int signals = TRUE;
static bool ok;
}
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);
}
/* Get out after writing 10 blocks to the second tape */
if (BlockNumber > 10 && stop != 0) { /* get out */
- Pmsg0(-1, "Done writing ...\n");
+ char ed1[50];
+ Pmsg1(-1, "Done writing %s records ...\n",
+ edit_uint64_with_commas(write_count, ed1));
break;
}
}
file_index = 0;
if (last_block) {
free_block(last_block);
+ last_block = NULL;
}
last_block_num = last_block_num1;
last_file = last_file1;
dev->close();
get_cmd(_("Mount first tape. Press enter when ready: "));
}
- free_restore_volume_list(jcr);
- jcr->dcr = new_dcr(jcr, dev);
- set_volume_name("TestVolume1", 1);
- jcr->bsr = NULL;
- create_restore_volume_list(jcr);
- dev->close();
- dev->num_writers = 0;
- if (!acquire_device_for_read(dcr)) {
- Pmsg1(-1, "%s", dev->errmsg);
- goto bail_out;
- }
+ }
+
+ free_restore_volume_list(jcr);
+ jcr->dcr = new_dcr(jcr, dev);
+ set_volume_name("TestVolume1", 1);
+ jcr->bsr = NULL;
+ create_restore_volume_list(jcr);
+ dev->close();
+ dev->num_writers = 0;
+ if (!acquire_device_for_read(dcr)) {
+ Pmsg1(-1, "%s", dev->errmsg);
+ goto bail_out;
}
/*
* We now have the first tape mounted.
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);
}
DEV_BLOCK *block = dcr->block;
Dmsg0(20, "Enter my_mount_next_read_volume\n");
- Pmsg1(000, _("End of Volume \"%s\"\n"), dcr->VolumeName);
+ Pmsg2(000, _("End of Volume \"%s\" %d records.\n"), dcr->VolumeName,
+ quickie_count);
if (LastBlock != block->BlockNumber) {
VolBytes += block->block_len;