Create open_input() for common input open routines.
Input error messages have been gone over. cd-read is a little more like the rest. Regression output now has NO-WARRANTY.
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
$Id: cd-drive.c,v 1.12 2005/01/02 22:49:31 rocky Exp $
|
$Id: cd-drive.c,v 1.13 2005/01/09 00:10:48 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -86,14 +86,14 @@ parse_options (int argc, const char *argv[])
|
|||||||
switch (opt) {
|
switch (opt) {
|
||||||
|
|
||||||
case OP_SOURCE_DEVICE:
|
case OP_SOURCE_DEVICE:
|
||||||
if (opts.source_image != IMAGE_UNKNOWN) {
|
if (opts.source_image != DRIVER_UNKNOWN) {
|
||||||
report( stderr, "%s: another source type option given before.\n",
|
report( stderr, "%s: another source type option given before.\n",
|
||||||
program_name );
|
program_name );
|
||||||
report( stderr, "%s: give only one source type option.\n",
|
report( stderr, "%s: give only one source type option.\n",
|
||||||
program_name );
|
program_name );
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
opts.source_image = IMAGE_DEVICE;
|
opts.source_image = DRIVER_DEVICE;
|
||||||
source_name = fillout_device_name(source_name);
|
source_name = fillout_device_name(source_name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -107,7 +107,7 @@ parse_options (int argc, const char *argv[])
|
|||||||
{
|
{
|
||||||
const char *remaining_arg = poptGetArg(optCon);
|
const char *remaining_arg = poptGetArg(optCon);
|
||||||
if ( remaining_arg != NULL) {
|
if ( remaining_arg != NULL) {
|
||||||
if (opts.source_image != IMAGE_UNKNOWN) {
|
if (opts.source_image != DRIVER_UNKNOWN) {
|
||||||
report( stderr, "%s: Source specified in option %s and as %s\n",
|
report( stderr, "%s: Source specified in option %s and as %s\n",
|
||||||
program_name, source_name, remaining_arg);
|
program_name, source_name, remaining_arg);
|
||||||
poptFreeContext(optCon);
|
poptFreeContext(optCon);
|
||||||
@@ -115,7 +115,7 @@ parse_options (int argc, const char *argv[])
|
|||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opts.source_image == IMAGE_DEVICE)
|
if (opts.source_image == DRIVER_DEVICE)
|
||||||
source_name = fillout_device_name(remaining_arg);
|
source_name = fillout_device_name(remaining_arg);
|
||||||
else
|
else
|
||||||
source_name = strdup(remaining_arg);
|
source_name = strdup(remaining_arg);
|
||||||
@@ -163,7 +163,7 @@ init(void)
|
|||||||
/* Default option values. */
|
/* Default option values. */
|
||||||
opts.silent = false;
|
opts.silent = false;
|
||||||
opts.debug_level = 0;
|
opts.debug_level = 0;
|
||||||
opts.source_image = IMAGE_UNKNOWN;
|
opts.source_image = DRIVER_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -188,9 +188,11 @@ main(int argc, const char *argv[])
|
|||||||
if (NULL == source_name) {
|
if (NULL == source_name) {
|
||||||
char *default_device;
|
char *default_device;
|
||||||
|
|
||||||
p_cdio = cdio_open (NULL, DRIVER_UNKNOWN);
|
p_cdio = cdio_open (NULL, DRIVER_DEVICE);
|
||||||
|
|
||||||
if (NULL != p_cdio) {
|
if (NULL == p_cdio) {
|
||||||
|
printf("No *loaded* CD-ROM device found.\n");
|
||||||
|
} else {
|
||||||
default_device = cdio_get_default_device(p_cdio);
|
default_device = cdio_get_default_device(p_cdio);
|
||||||
|
|
||||||
printf("The driver selected is %s\n", cdio_get_driver_name(p_cdio));
|
printf("The driver selected is %s\n", cdio_get_driver_name(p_cdio));
|
||||||
|
|||||||
101
src/cd-info.c
101
src/cd-info.c
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
$Id: cd-info.c,v 1.107 2005/01/02 22:49:31 rocky Exp $
|
$Id: cd-info.c,v 1.108 2005/01/09 00:10:49 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
||||||
Copyright (C) 1996, 1997, 1998 Gerd Knorr <kraxel@bytesex.org>
|
Copyright (C) 1996, 1997, 1998 Gerd Knorr <kraxel@bytesex.org>
|
||||||
and Heiko Ei<45>feldt <heiko@hexco.de>
|
and Heiko Ei<45>feldt <heiko@hexco.de>
|
||||||
|
|
||||||
@@ -238,7 +238,7 @@ parse_options (int argc, const char *argv[])
|
|||||||
case OP_SOURCE_CDRDAO:
|
case OP_SOURCE_CDRDAO:
|
||||||
case OP_SOURCE_NRG:
|
case OP_SOURCE_NRG:
|
||||||
case OP_SOURCE_DEVICE:
|
case OP_SOURCE_DEVICE:
|
||||||
if (opts.source_image != IMAGE_UNKNOWN) {
|
if (opts.source_image != INPUT_UNKNOWN) {
|
||||||
report(stderr, "%s: another source type option given before.\n",
|
report(stderr, "%s: another source type option given before.\n",
|
||||||
program_name);
|
program_name);
|
||||||
report(stderr, "%s: give only one source type option.\n",
|
report(stderr, "%s: give only one source type option.\n",
|
||||||
@@ -255,22 +255,22 @@ parse_options (int argc, const char *argv[])
|
|||||||
|
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case OP_SOURCE_BIN:
|
case OP_SOURCE_BIN:
|
||||||
opts.source_image = IMAGE_BIN;
|
opts.source_image = INPUT_BIN;
|
||||||
break;
|
break;
|
||||||
case OP_SOURCE_CUE:
|
case OP_SOURCE_CUE:
|
||||||
opts.source_image = IMAGE_CUE;
|
opts.source_image = INPUT_CUE;
|
||||||
break;
|
break;
|
||||||
case OP_SOURCE_CDRDAO:
|
case OP_SOURCE_CDRDAO:
|
||||||
opts.source_image = IMAGE_CDRDAO;
|
opts.source_image = INPUT_CDRDAO;
|
||||||
break;
|
break;
|
||||||
case OP_SOURCE_NRG:
|
case OP_SOURCE_NRG:
|
||||||
opts.source_image = IMAGE_NRG;
|
opts.source_image = INPUT_NRG;
|
||||||
break;
|
break;
|
||||||
case OP_SOURCE_AUTO:
|
case OP_SOURCE_AUTO:
|
||||||
opts.source_image = IMAGE_AUTO;
|
opts.source_image = INPUT_AUTO;
|
||||||
break;
|
break;
|
||||||
case OP_SOURCE_DEVICE:
|
case OP_SOURCE_DEVICE:
|
||||||
opts.source_image = IMAGE_DEVICE;
|
opts.source_image = INPUT_DEVICE;
|
||||||
source_name = fillout_device_name(source_name);
|
source_name = fillout_device_name(source_name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -284,7 +284,7 @@ parse_options (int argc, const char *argv[])
|
|||||||
{
|
{
|
||||||
const char *remaining_arg = poptGetArg(optCon);
|
const char *remaining_arg = poptGetArg(optCon);
|
||||||
if ( remaining_arg != NULL) {
|
if ( remaining_arg != NULL) {
|
||||||
if (opts.source_image != IMAGE_UNKNOWN) {
|
if (opts.source_image != INPUT_UNKNOWN) {
|
||||||
report(stderr, "%s: Source '%s' given as an argument of an option and as "
|
report(stderr, "%s: Source '%s' given as an argument of an option and as "
|
||||||
"unnamed option '%s'\n",
|
"unnamed option '%s'\n",
|
||||||
program_name, psz_my_source, remaining_arg);
|
program_name, psz_my_source, remaining_arg);
|
||||||
@@ -293,7 +293,7 @@ parse_options (int argc, const char *argv[])
|
|||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opts.source_image == IMAGE_DEVICE)
|
if (opts.source_image == INPUT_DEVICE)
|
||||||
source_name = fillout_device_name(remaining_arg);
|
source_name = fillout_device_name(remaining_arg);
|
||||||
else
|
else
|
||||||
source_name = strdup(remaining_arg);
|
source_name = strdup(remaining_arg);
|
||||||
@@ -827,7 +827,7 @@ init(void)
|
|||||||
#endif
|
#endif
|
||||||
opts.no_ioctl = 0;
|
opts.no_ioctl = 0;
|
||||||
opts.no_analysis = 0;
|
opts.no_analysis = 0;
|
||||||
opts.source_image = IMAGE_UNKNOWN;
|
opts.source_image = INPUT_UNKNOWN;
|
||||||
opts.access_mode = NULL;
|
opts.access_mode = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -874,82 +874,7 @@ main(int argc, const char *argv[])
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (opts.source_image) {
|
p_cdio = open_input(source_name, opts.source_image, opts.access_mode);
|
||||||
case IMAGE_UNKNOWN:
|
|
||||||
case IMAGE_AUTO:
|
|
||||||
p_cdio = cdio_open_am (source_name, DRIVER_UNKNOWN, opts.access_mode);
|
|
||||||
if (p_cdio==NULL) {
|
|
||||||
if (source_name) {
|
|
||||||
err_exit("%s: Error in automatically selecting driver for input %s.\n",
|
|
||||||
program_name, source_name);
|
|
||||||
} else {
|
|
||||||
err_exit("%s: Error in automatically selecting driver.\n",
|
|
||||||
program_name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case IMAGE_DEVICE:
|
|
||||||
p_cdio = cdio_open_am (source_name, DRIVER_DEVICE, opts.access_mode);
|
|
||||||
if (p_cdio==NULL) {
|
|
||||||
if (source_name) {
|
|
||||||
err_exit("%s: Error in automatically selecting CD-image driver for input %s\n",
|
|
||||||
program_name, source_name);
|
|
||||||
} else {
|
|
||||||
err_exit("%s: Error in automatically selecting CD-image driver.\n",
|
|
||||||
program_name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case IMAGE_BIN:
|
|
||||||
p_cdio = cdio_open_am (source_name, DRIVER_BINCUE, opts.access_mode);
|
|
||||||
if (p_cdio==NULL) {
|
|
||||||
if (source_name) {
|
|
||||||
err_exit("%s: Error in opening bin/cue for input %s\n",
|
|
||||||
program_name, source_name);
|
|
||||||
} else {
|
|
||||||
err_exit("%s: Error in opening bin/cue for unspecified input.\n",
|
|
||||||
program_name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case IMAGE_CUE:
|
|
||||||
p_cdio = cdio_open_cue(source_name);
|
|
||||||
if (p_cdio==NULL) {
|
|
||||||
if (source_name) {
|
|
||||||
err_exit("%s: Error in opening cue/bin with input %s\n",
|
|
||||||
program_name, source_name);
|
|
||||||
} else {
|
|
||||||
err_exit("%s: Error in opening cue/bin for unspeicified input.\n",
|
|
||||||
program_name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case IMAGE_NRG:
|
|
||||||
p_cdio = cdio_open_am (source_name, DRIVER_NRG, opts.access_mode);
|
|
||||||
if (p_cdio==NULL) {
|
|
||||||
if (source_name) {
|
|
||||||
err_exit("%s: Error in opening NRG with input %s\n",
|
|
||||||
program_name, source_name);
|
|
||||||
} else {
|
|
||||||
err_exit("%s: Error in opening NRG for unspecified input.\n",
|
|
||||||
program_name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case IMAGE_CDRDAO:
|
|
||||||
p_cdio = cdio_open_am (source_name, DRIVER_CDRDAO, opts.access_mode);
|
|
||||||
if (p_cdio==NULL) {
|
|
||||||
if (source_name) {
|
|
||||||
err_exit("%s: Error in opening TOC with input %s.\n",
|
|
||||||
program_name, source_name);
|
|
||||||
} else {
|
|
||||||
err_exit("%s: Error in opening TOC for unspecified input.\n",
|
|
||||||
program_name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (p_cdio==NULL) {
|
if (p_cdio==NULL) {
|
||||||
if (source_name) {
|
if (source_name) {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
$Id: cd-read.c,v 1.22 2004/11/04 10:08:23 rocky Exp $
|
$Id: cd-read.c,v 1.23 2005/01/09 00:10:49 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -202,6 +202,9 @@ parse_options (int argc, const char *argv[])
|
|||||||
"Show output as a hex dump. The default is a hex dump when "
|
"Show output as a hex dump. The default is a hex dump when "
|
||||||
"output goes to stdout and no hex dump when output is to a file."},
|
"output goes to stdout and no hex dump when output is to a file."},
|
||||||
|
|
||||||
|
{"no-header", '\0', POPT_ARG_NONE, &opts.no_header,
|
||||||
|
0, "Don't display header and copyright (for regression testing)"},
|
||||||
|
|
||||||
{"no-hexdump", '\0', POPT_ARG_NONE, &opts.nohexdump, 0,
|
{"no-hexdump", '\0', POPT_ARG_NONE, &opts.nohexdump, 0,
|
||||||
"Don't show output as a hex dump."},
|
"Don't show output as a hex dump."},
|
||||||
|
|
||||||
@@ -257,7 +260,7 @@ parse_options (int argc, const char *argv[])
|
|||||||
case OP_SOURCE_CUE:
|
case OP_SOURCE_CUE:
|
||||||
case OP_SOURCE_NRG:
|
case OP_SOURCE_NRG:
|
||||||
case OP_SOURCE_DEVICE:
|
case OP_SOURCE_DEVICE:
|
||||||
if (opts.source_image != IMAGE_UNKNOWN) {
|
if (opts.source_image != INPUT_UNKNOWN) {
|
||||||
report( stderr, "%s: another source type option given before.\n",
|
report( stderr, "%s: another source type option given before.\n",
|
||||||
program_name );
|
program_name );
|
||||||
report( stderr, "%s: give only one source type option.\n",
|
report( stderr, "%s: give only one source type option.\n",
|
||||||
@@ -274,19 +277,19 @@ parse_options (int argc, const char *argv[])
|
|||||||
|
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case OP_SOURCE_BIN:
|
case OP_SOURCE_BIN:
|
||||||
opts.source_image = IMAGE_BIN;
|
opts.source_image = INPUT_BIN;
|
||||||
break;
|
break;
|
||||||
case OP_SOURCE_CUE:
|
case OP_SOURCE_CUE:
|
||||||
opts.source_image = IMAGE_CUE;
|
opts.source_image = INPUT_CUE;
|
||||||
break;
|
break;
|
||||||
case OP_SOURCE_NRG:
|
case OP_SOURCE_NRG:
|
||||||
opts.source_image = IMAGE_NRG;
|
opts.source_image = INPUT_NRG;
|
||||||
break;
|
break;
|
||||||
case OP_SOURCE_AUTO:
|
case OP_SOURCE_AUTO:
|
||||||
opts.source_image = IMAGE_AUTO;
|
opts.source_image = INPUT_AUTO;
|
||||||
break;
|
break;
|
||||||
case OP_SOURCE_DEVICE:
|
case OP_SOURCE_DEVICE:
|
||||||
opts.source_image = IMAGE_DEVICE;
|
opts.source_image = INPUT_DEVICE;
|
||||||
source_name = fillout_device_name(source_name);
|
source_name = fillout_device_name(source_name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -317,7 +320,7 @@ parse_options (int argc, const char *argv[])
|
|||||||
{
|
{
|
||||||
const char *remaining_arg = poptGetArg(optCon);
|
const char *remaining_arg = poptGetArg(optCon);
|
||||||
if ( remaining_arg != NULL) {
|
if ( remaining_arg != NULL) {
|
||||||
if (opts.source_image != IMAGE_UNKNOWN) {
|
if (opts.source_image != INPUT_UNKNOWN) {
|
||||||
report( stderr, "%s: Source specified in option %s and as %s\n",
|
report( stderr, "%s: Source specified in option %s and as %s\n",
|
||||||
program_name, source_name, remaining_arg );
|
program_name, source_name, remaining_arg );
|
||||||
poptFreeContext(optCon);
|
poptFreeContext(optCon);
|
||||||
@@ -445,7 +448,7 @@ init(void)
|
|||||||
opts.end_lsn = CDIO_INVALID_LSN;
|
opts.end_lsn = CDIO_INVALID_LSN;
|
||||||
opts.num_sectors = 0;
|
opts.num_sectors = 0;
|
||||||
opts.read_mode = READ_MODE_UNINIT;
|
opts.read_mode = READ_MODE_UNINIT;
|
||||||
opts.source_image = IMAGE_UNKNOWN;
|
opts.source_image = INPUT_UNKNOWN;
|
||||||
opts.hexdump = 2; /* Not set. */
|
opts.hexdump = 2; /* Not set. */
|
||||||
|
|
||||||
gl_default_cdio_log_handler = cdio_log_set_handler (log_handler);
|
gl_default_cdio_log_handler = cdio_log_set_handler (log_handler);
|
||||||
@@ -466,59 +469,9 @@ main(int argc, const char *argv[])
|
|||||||
be reflected in `arguments'. */
|
be reflected in `arguments'. */
|
||||||
parse_options(argc, argv);
|
parse_options(argc, argv);
|
||||||
|
|
||||||
/* end of local declarations */
|
print_version(program_name, VERSION, opts.no_header, opts.version_only);
|
||||||
|
|
||||||
switch (opts.source_image) {
|
p_cdio = open_input(source_name, opts.source_image, opts.access_mode);
|
||||||
case IMAGE_UNKNOWN:
|
|
||||||
case IMAGE_AUTO:
|
|
||||||
p_cdio = cdio_open (source_name, DRIVER_UNKNOWN);
|
|
||||||
if (p_cdio==NULL) {
|
|
||||||
err_exit("Error in automatically selecting driver with input %s\n",
|
|
||||||
source_name);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case IMAGE_DEVICE:
|
|
||||||
p_cdio = cdio_open (source_name, DRIVER_DEVICE);
|
|
||||||
if (p_cdio==NULL) {
|
|
||||||
err_exit("Error in automatically selecting device with input %s\n",
|
|
||||||
source_name ? source_name : "(null)");
|
|
||||||
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case IMAGE_BIN:
|
|
||||||
p_cdio = cdio_open (source_name, DRIVER_BINCUE);
|
|
||||||
if (p_cdio==NULL) {
|
|
||||||
err_exit("Error in opening bin/cue file %s\n",
|
|
||||||
source_name ? source_name : "(null)");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case IMAGE_CUE:
|
|
||||||
p_cdio = cdio_open_cue(source_name);
|
|
||||||
if (p_cdio==NULL) {
|
|
||||||
err_exit("Error in opening cue/bin file %s with input\n",
|
|
||||||
source_name ? source_name : "(null)");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case IMAGE_NRG:
|
|
||||||
p_cdio = cdio_open (source_name, DRIVER_NRG);
|
|
||||||
if (p_cdio==NULL) {
|
|
||||||
err_exit("Error in opening NRG file %s for input\n",
|
|
||||||
source_name ? source_name : "(null)");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case IMAGE_CDRDAO:
|
|
||||||
p_cdio = cdio_open (source_name, DRIVER_CDRDAO);
|
|
||||||
if (p_cdio==NULL) {
|
|
||||||
err_exit("Error in opening TOC file %s for input\n",
|
|
||||||
source_name ? source_name : "(null)");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (opts.access_mode!=NULL) {
|
|
||||||
cdio_set_arg(p_cdio, "access-mode", opts.access_mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (opts.output_file!=NULL) {
|
if (opts.output_file!=NULL) {
|
||||||
|
|
||||||
|
|||||||
87
src/util.c
87
src/util.c
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: util.c,v 1.29 2005/01/04 04:42:17 rocky Exp $
|
$Id: util.c,v 1.30 2005/01/09 00:10:49 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
@@ -44,7 +44,8 @@ print_version (char *program_name, const char *version,
|
|||||||
driver_id_t driver_id;
|
driver_id_t driver_id;
|
||||||
|
|
||||||
if (no_header == 0)
|
if (no_header == 0)
|
||||||
report( stdout, "%s version %s\nCopyright (c) 2003, 2004 R. Bernstein\n",
|
report( stdout,
|
||||||
|
"%s version %s\nCopyright (c) 2003, 2004, 2005 R. Bernstein\n",
|
||||||
program_name, version);
|
program_name, version);
|
||||||
report( stdout,
|
report( stdout,
|
||||||
_("This is free software; see the source for copying conditions.\n\
|
_("This is free software; see the source for copying conditions.\n\
|
||||||
@@ -70,6 +71,87 @@ PARTICULAR PURPOSE.\n\
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! Device input routine. If successful we return an open CdIo_t
|
||||||
|
pointer. On error the program exits.
|
||||||
|
*/
|
||||||
|
CdIo_t *
|
||||||
|
open_input(const char *psz_source, source_image_t source_image,
|
||||||
|
const char *psz_access_mode)
|
||||||
|
{
|
||||||
|
CdIo_t *p_cdio = NULL;
|
||||||
|
switch (source_image) {
|
||||||
|
case INPUT_UNKNOWN:
|
||||||
|
case INPUT_AUTO:
|
||||||
|
p_cdio = cdio_open_am (psz_source, DRIVER_UNKNOWN, psz_access_mode);
|
||||||
|
if (!p_cdio) {
|
||||||
|
if (psz_source) {
|
||||||
|
err_exit("Error in automatically selecting driver for input %s.\n",
|
||||||
|
psz_source);
|
||||||
|
} else {
|
||||||
|
err_exit("Error in automatically selecting driver.\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case INPUT_DEVICE:
|
||||||
|
p_cdio = cdio_open_am (psz_source, DRIVER_DEVICE, psz_access_mode);
|
||||||
|
if (!p_cdio) {
|
||||||
|
if (psz_source) {
|
||||||
|
err_exit("Cannot use CD-ROM device %s. Is a CD loaded?\n",
|
||||||
|
psz_source);
|
||||||
|
} else {
|
||||||
|
err_exit("Cannot find a CD-ROM with a CD loaded.\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case INPUT_BIN:
|
||||||
|
p_cdio = cdio_open_am (psz_source, DRIVER_BINCUE, psz_access_mode);
|
||||||
|
if (!p_cdio) {
|
||||||
|
if (psz_source) {
|
||||||
|
err_exit("%s: Error in opening CDRWin BIN/CUE image for BIN"
|
||||||
|
" input %s\n", psz_source);
|
||||||
|
} else {
|
||||||
|
err_exit("Cannot find CDRWin BIN/CUE image.\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case INPUT_CUE:
|
||||||
|
p_cdio = cdio_open_cue(psz_source);
|
||||||
|
if (p_cdio==NULL) {
|
||||||
|
if (psz_source) {
|
||||||
|
err_exit("%s: Error in opening CDRWin BIN/CUE image for CUE"
|
||||||
|
" input %s\n", psz_source);
|
||||||
|
} else {
|
||||||
|
err_exit("Cannot find CDRWin BIN/CUE image.\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case INPUT_NRG:
|
||||||
|
p_cdio = cdio_open_am (psz_source, DRIVER_NRG, psz_access_mode);
|
||||||
|
if (p_cdio==NULL) {
|
||||||
|
if (psz_source) {
|
||||||
|
err_exit("Error in opening Nero NRG image for input %s\n",
|
||||||
|
psz_source);
|
||||||
|
} else {
|
||||||
|
err_exit("Cannot find Nero NRG image.\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case INPUT_CDRDAO:
|
||||||
|
p_cdio = cdio_open_am (psz_source, DRIVER_CDRDAO, psz_access_mode);
|
||||||
|
if (p_cdio==NULL) {
|
||||||
|
if (psz_source) {
|
||||||
|
err_exit("Error in opening cdrdao TOC with input %s.\n", psz_source);
|
||||||
|
} else {
|
||||||
|
err_exit("Cannot find cdrdao TOC image.\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return p_cdio;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#define DEV_PREFIX "/dev/"
|
#define DEV_PREFIX "/dev/"
|
||||||
char *
|
char *
|
||||||
fillout_device_name(const char *device_name)
|
fillout_device_name(const char *device_name)
|
||||||
@@ -78,6 +160,7 @@ fillout_device_name(const char *device_name)
|
|||||||
return strdup(device_name);
|
return strdup(device_name);
|
||||||
#else
|
#else
|
||||||
unsigned int prefix_len = strlen(DEV_PREFIX);
|
unsigned int prefix_len = strlen(DEV_PREFIX);
|
||||||
|
if (!device_name) return NULL;
|
||||||
if (0 == strncmp(device_name, DEV_PREFIX, prefix_len))
|
if (0 == strncmp(device_name, DEV_PREFIX, prefix_len))
|
||||||
return strdup(device_name);
|
return strdup(device_name);
|
||||||
else {
|
else {
|
||||||
|
|||||||
34
src/util.h
34
src/util.h
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: util.h,v 1.9 2004/11/06 09:16:04 rocky Exp $
|
$Id: util.h,v 1.10 2005/01/09 00:10:49 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
@@ -85,24 +85,38 @@
|
|||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
IMAGE_AUTO,
|
INPUT_AUTO,
|
||||||
IMAGE_DEVICE,
|
INPUT_DEVICE,
|
||||||
IMAGE_BIN,
|
INPUT_BIN,
|
||||||
IMAGE_CUE,
|
INPUT_CUE,
|
||||||
IMAGE_NRG,
|
INPUT_NRG,
|
||||||
IMAGE_CDRDAO,
|
INPUT_CDRDAO,
|
||||||
IMAGE_UNKNOWN
|
INPUT_UNKNOWN
|
||||||
} source_image_t;
|
} source_image_t;
|
||||||
|
|
||||||
extern char *source_name;
|
extern char *source_name;
|
||||||
extern char *program_name;
|
extern char *program_name;
|
||||||
extern cdio_log_handler_t gl_default_cdio_log_handler;
|
extern cdio_log_handler_t gl_default_cdio_log_handler;
|
||||||
|
|
||||||
void myexit(CdIo *cdio, int rc);
|
/*! Common error exit routine which frees p_cdio. rc is the
|
||||||
|
return code to pass to exit.
|
||||||
|
*/
|
||||||
|
void myexit(CdIo_t *p_cdio, int rc);
|
||||||
|
|
||||||
void print_version (char *program_name, const char *version,
|
/*! Print our version string */
|
||||||
|
void print_version (char *psz_program, const char *psz_version,
|
||||||
int no_header, bool version_only);
|
int no_header, bool version_only);
|
||||||
|
|
||||||
|
/*! Device input routine. If successful we return an open CdIo_t
|
||||||
|
pointer. On error the program exits.
|
||||||
|
*/
|
||||||
|
CdIo_t *
|
||||||
|
open_input(const char *psz_source, source_image_t source_image,
|
||||||
|
const char *psz_access_mode);
|
||||||
|
|
||||||
|
/*! On Unixish OS's we fill out the device name, from a short name.
|
||||||
|
For example cdrom might become /dev/cdrom.
|
||||||
|
*/
|
||||||
char *fillout_device_name(const char *device_name);
|
char *fillout_device_name(const char *device_name);
|
||||||
|
|
||||||
/*! Prints out SCSI-MMC drive features */
|
/*! Prints out SCSI-MMC drive features */
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
This is free software; see the source for copying conditions.
|
||||||
|
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE.
|
||||||
0x0000: 0000 0000 0000 0000 0000 0000 0000 0000 ................
|
0x0000: 0000 0000 0000 0000 0000 0000 0000 0000 ................
|
||||||
0x0010: 0000 0000 0000 0000 0000 0000 0000 0000 ................
|
0x0010: 0000 0000 0000 0000 0000 0000 0000 0000 ................
|
||||||
0x0020: 0000 0000 0000 0000 0000 0000 0000 0000 ................
|
0x0020: 0000 0000 0000 0000 0000 0000 0000 0000 ................
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# $Id: check_common_fn.in,v 1.9 2004/10/28 11:13:40 rocky Exp $
|
# $Id: check_common_fn.in,v 1.10 2005/01/09 00:10:48 rocky Exp $
|
||||||
#
|
#
|
||||||
# Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
# Copyright (C) 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com>
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -161,7 +161,7 @@ test_cd_read() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ${CD_READ} ${opts} >${outfile} 2>&1 ; then
|
if ${CD_READ} --no-header ${opts} >${outfile} 2>&1 ; then
|
||||||
if test "@DIFF@" != no; then
|
if test "@DIFF@" != no; then
|
||||||
if @DIFF@ @DIFF_OPTS@ ${outfile} ${rightfile} ; then
|
if @DIFF@ @DIFF_OPTS@ ${outfile} ${rightfile} ; then
|
||||||
rm -f $outfile
|
rm -f $outfile
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
This is free software; see the source for copying conditions.
|
||||||
|
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE.
|
||||||
0x0000: 0909 2020 2020 474e 5520 4745 4e45 5241 .. GNU GENERA
|
0x0000: 0909 2020 2020 474e 5520 4745 4e45 5241 .. GNU GENERA
|
||||||
0x0010: 4c20 5055 424c 4943 204c 4943 454e 5345 L PUBLIC LICENSE
|
0x0010: 4c20 5055 424c 4943 204c 4943 454e 5345 L PUBLIC LICENSE
|
||||||
0x0020: 0a09 0920 2020 2020 2020 5665 7273 696f ... Versio
|
0x0020: 0a09 0920 2020 2020 2020 5665 7273 696f ... Versio
|
||||||
|
|||||||
Reference in New Issue
Block a user