static void usage(FILE *fp)
{
fprintf(fp,
- "usage: %s [-c] [-B PARAM=VALUE,...] [-R MAP]\n"
+ "usage: %s [-ci] [-B PARAM=VALUE,...] [-R MAP]\n"
"\t[-b OUTMAP] [-r [START]-[END]] DEVICE OUTFILE\n",
prog);
}
struct timeval tv0, tv1;
double t, rate, tot;
const char *rateunit, *totunit;
- char timebuf[TIMESTRMAX];
+ char timebuf[TIMESTRMAX], id_in[MAXIDSZ], id_out[MAXIDSZ];
+ dvd_reader_t *dvd_out;
struct stat st;
#ifdef DEBUG
const struct file *file;
#define f_continue 2u
#define f_fixup 4u
#define f_stats 8u
+#define f_checkid 16u
#define f_write 256u
set_prog(argv[0]);
for (;;) {
- opt = getopt(argc, argv, "hB:E:FR:X:b:cr:s"); if (opt < 0) break;
+ opt = getopt(argc, argv, "hB:E:FR:X:b:cir:s"); if (opt < 0) break;
switch (opt) {
case 'h': usage(stderr); exit(0);
case 'B':
bail("device `%s' volume size %"PRIu64" not a multiple of %d",
device, volsz, SECTORSZ);
+ if (f&f_checkid) {
+ open_dvd(outfile, 0, &dvd_out);
+ if (dvd_id(id_in, dvd, DIF_MUSTIFOHASH, device) ||
+ dvd_id(id_out, dvd_out, DIF_MUSTIFOHASH, device))
+ exit(2);
+ if (STRCMP(id_in, !=, id_out))
+ bail("DVD id mismatch: input `%s' is `%s'; output `%s' is `%s'",
+ device, id_in, outfile, id_out);
+ }
+
outfd = open(outfile, O_WRONLY | O_CREAT, 0666);
if (outfd < 0)
bail_syserr(errno, "failed to create output file `%s'", outfile);