Everyone wants read-only for now.
progress_init(&progress);
for (i = optind; i < argc; i++) {
- open_dvd(argv[i], 0, &dvd);
+ open_dvd(argv[i], O_RDONLY, 0, &dvd);
for (j = 0; j < 100; j++) {
kick_vob(j, 0);
setlocale(LC_ALL, "");
progress_init(&progress);
- open_dvd(argv[optind], 0, &dvd);
+ open_dvd(argv[optind], O_RDONLY, 0, &dvd);
css = dvdcss_open(argv[optind]);
if (!css)
bail_syserr(errno, "failed to attach CSS machinery to `%s'",
progress_init(&progress);
for (i = optind; i < argc; i++) {
- open_dvd(argv[i], 0, &dvd);
+ open_dvd(argv[i], O_RDONLY, 0, &dvd);
if (dvd_id(id, dvd, dif, argv[i]))
st = 2;
else {
if (f&f_bogus) { usage(stderr); exit(2); }
setlocale(LC_ALL, "");
progress_init(&progress);
- dvdfn = argv[optind]; open_dvd(dvdfn, 0, &dvd);
+ dvdfn = argv[optind]; open_dvd(dvdfn, O_RDONLY, 0, &dvd);
vmgi = ifoOpenVMGI(dvd);
if (!vmgi) bail("failed to open vmgi for `%s'", dvdfn);
#endif
}
- open_dvd(device, &dvdfd, &dvd);
+ open_dvd(device, O_RDONLY, &dvdfd, &dvd);
blksz = SECTORSZ; volsz = device_size(dvdfd, device, &blksz);
if (blksz != SECTORSZ)
device, volsz, SECTORSZ);
if (f&f_checkid) {
- open_dvd(outfile, 0, &dvd_out);
+ open_dvd(outfile, O_RDONLY, 0, &dvd_out);
if (dvd_id(id_in, dvd, DIF_MUSTIFOHASH, device) ||
dvd_id(id_out, dvd_out, DIF_MUSTIFOHASH, device))
exit(2);
static const dvd_logger_cb logger = { logfn };
#endif
-void open_dvd(const char *device, int *fd_out, dvd_reader_t **dvd_out)
+void open_dvd(const char *device, int mode,
+ int *fd_out, dvd_reader_t **dvd_out)
{
int fd;
dvd_reader_t *dvd;
int bannerp = 0;
for (;;) {
- fd = open(device, O_RDONLY);
+ fd = open(device, mode);
if (fd >= 0 || errno != ENOMEDIUM) break;
if (!bannerp) {
show_banner("Waiting for disc to be inserted...");
extern void show_banner(const char *msg);
extern void hide_banner(void);
-extern void open_dvd(const char *device,
+extern void open_dvd(const char *device, int mode,
int *fd_out, dvd_reader_t **dvd_out);
#endif