3 static void usage(FILE *fp) { fprintf(fp, "usage: %s DEVICE\n", prog); }
5 static void puthex(const unsigned char *p, size_t sz, FILE *fp)
6 { while (sz) { fprintf(fp, "%02x", *p++); sz--; } }
8 int main(int argc, char *argv[])
11 unsigned char volsetid[16], discid[16];
14 static dvd_reader_t *dvd;
19 opt = getopt(argc, argv, "h"); if (opt < 0) break;
21 case 'h': usage(stderr); exit(0);
22 default: f |= f_bogus; break;
25 if (argc - optind != 1) f |= f_bogus;
26 if (f&f_bogus) { usage(stderr); exit(2); }
27 setlocale(LC_ALL, "");
28 progress_init(&progress);
30 open_dvd(argv[optind], 0, &dvd);
32 rc = DVDUDFVolumeInfo(dvd,
34 volsetid, sizeof(volsetid));
36 moan("failed to read volume info");
37 strcpy(volid, "<error reading volume info>");
38 memset(volsetid, 0xff, sizeof(volsetid));
41 rc = DVDDiscID(dvd, discid);
43 moan("failed to determine disc id");
44 memset(discid, 0xff, sizeof(discid));
47 fputs(volid, stdout); fputc('-', stdout);
48 puthex(volsetid, sizeof(volsetid), stdout); fputc(':', stdout);
49 puthex(discid, sizeof(discid), stdout); fputc('\n', stdout);
51 if (dvd) DVDClose(dvd);
52 progress_free(&progress);