Common output routine in utility programs as a concession to
environments which may no have or prefer stdout/stderr such as XBOX.
This commit is contained in:
184
MSVC/stdint.h
184
MSVC/stdint.h
@@ -1,184 +0,0 @@
|
|||||||
/* ISO C9x 7.18 Integer types <stdint.h>
|
|
||||||
* Based on ISO/IEC SC22/WG14 9899 Committee draft (SC22 N2794)
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS NOT COPYRIGHTED
|
|
||||||
*
|
|
||||||
* Contributor: Danny Smith <danny_r_smith_2001@yahoo.co.nz>
|
|
||||||
*
|
|
||||||
* This source code is offered for use in the public domain. You may
|
|
||||||
* use, modify or distribute it freely.
|
|
||||||
*
|
|
||||||
* This code is distributed in the hope that it will be useful but
|
|
||||||
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
|
||||||
* DISCLAIMED. This includes but is not limited to warranties of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
*
|
|
||||||
* Date: 2000-12-02
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef _STDINT_H
|
|
||||||
#define _STDINT_H
|
|
||||||
#define __need_wint_t
|
|
||||||
#define __need_wchar_t
|
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
/* 7.18.1.1 Exact-width integer types */
|
|
||||||
typedef signed char int8_t;
|
|
||||||
typedef unsigned char uint8_t;
|
|
||||||
typedef short int16_t;
|
|
||||||
typedef unsigned short uint16_t;
|
|
||||||
typedef int int32_t;
|
|
||||||
typedef unsigned uint32_t;
|
|
||||||
typedef long long int64_t;
|
|
||||||
typedef unsigned long long uint64_t;
|
|
||||||
|
|
||||||
/* 7.18.1.2 Minimum-width integer types */
|
|
||||||
typedef signed char int_least8_t;
|
|
||||||
typedef unsigned char uint_least8_t;
|
|
||||||
typedef short int_least16_t;
|
|
||||||
typedef unsigned short uint_least16_t;
|
|
||||||
typedef int int_least32_t;
|
|
||||||
typedef unsigned uint_least32_t;
|
|
||||||
typedef long long int_least64_t;
|
|
||||||
typedef unsigned long long uint_least64_t;
|
|
||||||
|
|
||||||
/* 7.18.1.3 Fastest minimum-width integer types
|
|
||||||
* Not actually guaranteed to be fastest for all purposes
|
|
||||||
* Here we use the exact-width types for 8 and 16-bit ints.
|
|
||||||
*/
|
|
||||||
typedef char int_fast8_t;
|
|
||||||
typedef unsigned char uint_fast8_t;
|
|
||||||
typedef short int_fast16_t;
|
|
||||||
typedef unsigned short uint_fast16_t;
|
|
||||||
typedef int int_fast32_t;
|
|
||||||
typedef unsigned int uint_fast32_t;
|
|
||||||
typedef long long int_fast64_t;
|
|
||||||
typedef unsigned long long uint_fast64_t;
|
|
||||||
|
|
||||||
/* 7.18.1.4 Integer types capable of holding object pointers */
|
|
||||||
typedef int intptr_t;
|
|
||||||
typedef unsigned uintptr_t;
|
|
||||||
|
|
||||||
/* 7.18.1.5 Greatest-width integer types */
|
|
||||||
typedef long long intmax_t;
|
|
||||||
typedef unsigned long long uintmax_t;
|
|
||||||
|
|
||||||
/* 7.18.2 Limits of specified-width integer types */
|
|
||||||
#if !defined ( __cplusplus) || defined (__STDC_LIMIT_MACROS)
|
|
||||||
|
|
||||||
/* 7.18.2.1 Limits of exact-width integer types */
|
|
||||||
#define INT8_MIN (-128)
|
|
||||||
#define INT16_MIN (-32768)
|
|
||||||
#define INT32_MIN (-2147483647 - 1)
|
|
||||||
#define INT64_MIN (-9223372036854775807LL - 1)
|
|
||||||
|
|
||||||
#define INT8_MAX 127
|
|
||||||
#define INT16_MAX 32767
|
|
||||||
#define INT32_MAX 2147483647
|
|
||||||
#define INT64_MAX 9223372036854775807LL
|
|
||||||
|
|
||||||
#define UINT8_MAX 0xff /* 255U */
|
|
||||||
#define UINT16_MAX 0xffff /* 65535U */
|
|
||||||
#define UINT32_MAX 0xffffffff /* 4294967295U */
|
|
||||||
#define UINT64_MAX 0xffffffffffffffffULL /* 18446744073709551615ULL */
|
|
||||||
|
|
||||||
/* 7.18.2.2 Limits of minimum-width integer types */
|
|
||||||
#define INT_LEAST8_MIN INT8_MIN
|
|
||||||
#define INT_LEAST16_MIN INT16_MIN
|
|
||||||
#define INT_LEAST32_MIN INT32_MIN
|
|
||||||
#define INT_LEAST64_MIN INT64_MIN
|
|
||||||
|
|
||||||
#define INT_LEAST8_MAX INT8_MAX
|
|
||||||
#define INT_LEAST16_MAX INT16_MAX
|
|
||||||
#define INT_LEAST32_MAX INT32_MAX
|
|
||||||
#define INT_LEAST64_MAX INT64_MAX
|
|
||||||
|
|
||||||
#define UINT_LEAST8_MAX UINT8_MAX
|
|
||||||
#define UINT_LEAST16_MAX UINT16_MAX
|
|
||||||
#define UINT_LEAST32_MAX UINT32_MAX
|
|
||||||
#define UINT_LEAST64_MAX UINT64_MAX
|
|
||||||
|
|
||||||
/* 7.18.2.3 Limits of fastest minimum-width integer types */
|
|
||||||
#define INT_FAST8_MIN INT8_MIN
|
|
||||||
#define INT_FAST16_MIN INT16_MIN
|
|
||||||
#define INT_FAST32_MIN INT32_MIN
|
|
||||||
#define INT_FAST64_MIN INT64_MIN
|
|
||||||
|
|
||||||
#define INT_FAST8_MAX INT8_MAX
|
|
||||||
#define INT_FAST16_MAX INT16_MAX
|
|
||||||
#define INT_FAST32_MAX INT32_MAX
|
|
||||||
#define INT_FAST64_MAX INT64_MAX
|
|
||||||
|
|
||||||
#define UINT_FAST8_MAX UINT8_MAX
|
|
||||||
#define UINT_FAST16_MAX UINT16_MAX
|
|
||||||
#define UINT_FAST32_MAX UINT32_MAX
|
|
||||||
#define UINT_FAST64_MAX UINT64_MAX
|
|
||||||
|
|
||||||
/* 7.18.2.4 Limits of integer types capable of holding
|
|
||||||
object pointers */
|
|
||||||
#define INTPTR_MIN INT32_MIN
|
|
||||||
#define INTPTR_MAX INT32_MAX
|
|
||||||
#define UINTPTR_MAX UINT32_MAX
|
|
||||||
|
|
||||||
/* 7.18.2.5 Limits of greatest-width integer types */
|
|
||||||
#define INTMAX_MIN INT64_MIN
|
|
||||||
#define INTMAX_MAX INT64_MAX
|
|
||||||
#define UINTMAX_MAX UINT64_MAX
|
|
||||||
|
|
||||||
/* 7.18.3 Limits of other integer types */
|
|
||||||
#define PTRDIFF_MIN INT32_MIN
|
|
||||||
#define PTRDIFF_MAX INT32_MAX
|
|
||||||
|
|
||||||
#define SIG_ATOMIC_MIN INT32_MIN
|
|
||||||
#define SIG_ATOMIC_MAX INT32_MAX
|
|
||||||
|
|
||||||
#define SIZE_MAX UINT32_MAX
|
|
||||||
|
|
||||||
#ifndef WCHAR_MIN /* also in wchar.h */
|
|
||||||
#define WCHAR_MIN 0
|
|
||||||
#define WCHAR_MAX ((wchar_t)-1) /* UINT16_MAX */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* wint_t is unsigned short for compatibility with MS runtime
|
|
||||||
*/
|
|
||||||
#define WINT_MIN 0
|
|
||||||
#define WINT_MAX ((wint_t)-1) /* UINT16_MAX */
|
|
||||||
|
|
||||||
#endif /* !defined ( __cplusplus) || defined __STDC_LIMIT_MACROS */
|
|
||||||
|
|
||||||
|
|
||||||
/* 7.18.4 Macros for integer constants */
|
|
||||||
#if !defined ( __cplusplus) || defined (__STDC_CONSTANT_MACROS)
|
|
||||||
|
|
||||||
/* 7.18.4.1 Macros for minimum-width integer constants
|
|
||||||
|
|
||||||
Accoding to Douglas Gwyn <gwyn@arl.mil>:
|
|
||||||
"This spec was changed in ISO/IEC 9899:1999 TC1; in ISO/IEC
|
|
||||||
9899:1999 as initially published, the expansion was required
|
|
||||||
to be an integer constant of precisely matching type, which
|
|
||||||
is impossible to accomplish for the shorter types on most
|
|
||||||
platforms, because C99 provides no standard way to designate
|
|
||||||
an integer constant with width less than that of type int.
|
|
||||||
TC1 changed this to require just an integer constant
|
|
||||||
*expression* with *promoted* type."
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define INT8_C(val) ((int8_t) + (val))
|
|
||||||
#define UINT8_C(val) ((uint8_t) + (val##U))
|
|
||||||
#define INT16_C(val) ((int16_t) + (val))
|
|
||||||
#define UINT16_C(val) ((uint16_t) + (val##U))
|
|
||||||
|
|
||||||
#define INT32_C(val) val##L
|
|
||||||
#define UINT32_C(val) val##UL
|
|
||||||
#define INT64_C(val) val##LL
|
|
||||||
#define UINT64_C(val) val##ULL
|
|
||||||
|
|
||||||
/* 7.18.4.2 Macros for greatest-width integer constants */
|
|
||||||
#define INTMAX_C(val) INT64_C(val)
|
|
||||||
#define UINTMAX_C(val) UINT64_C(val)
|
|
||||||
|
|
||||||
#endif /* !defined ( __cplusplus) || defined __STDC_CONSTANT_MACROS */
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -21,7 +21,7 @@ define(CDIO_VERSION_STR, 0.$1cvs)
|
|||||||
PACKAGE=libcdio
|
PACKAGE=libcdio
|
||||||
|
|
||||||
AC_PREREQ(2.52)
|
AC_PREREQ(2.52)
|
||||||
AC_REVISION([$Id: configure.ac,v 1.108 2004/11/01 08:53:47 rocky Exp $])dnl
|
AC_REVISION([$Id: configure.ac,v 1.109 2004/11/04 10:08:23 rocky Exp $])dnl
|
||||||
AC_INIT(libcdio, CDIO_VERSION_STR(RELEASE_NUM))
|
AC_INIT(libcdio, CDIO_VERSION_STR(RELEASE_NUM))
|
||||||
AC_CONFIG_SRCDIR(src/cd-info.c)
|
AC_CONFIG_SRCDIR(src/cd-info.c)
|
||||||
AM_INIT_AUTOMAKE($PACKAGE, $CDIO_VERSION_STR)
|
AM_INIT_AUTOMAKE($PACKAGE, $CDIO_VERSION_STR)
|
||||||
@@ -116,7 +116,7 @@ AM_PATH_LIBPOPT(,
|
|||||||
dnl headers
|
dnl headers
|
||||||
|
|
||||||
AC_HEADER_STDC
|
AC_HEADER_STDC
|
||||||
AC_CHECK_HEADERS(glob.h stdbool.h)
|
AC_CHECK_HEADERS(glob.h stdbool.h stdarg.h)
|
||||||
|
|
||||||
dnl compiler
|
dnl compiler
|
||||||
AC_C_BIGENDIAN
|
AC_C_BIGENDIAN
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: cd-drive.c,v 1.9 2004/08/27 11:53:38 rocky Exp $
|
$Id: cd-drive.c,v 1.10 2004/11/04 10:08:23 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
@@ -87,11 +87,10 @@ parse_options (int argc, const char *argv[])
|
|||||||
|
|
||||||
case OP_SOURCE_DEVICE:
|
case OP_SOURCE_DEVICE:
|
||||||
if (opts.source_image != IMAGE_UNKNOWN) {
|
if (opts.source_image != IMAGE_UNKNOWN) {
|
||||||
fprintf(stderr,
|
report( stderr, "%s: another source type option given before.\n",
|
||||||
"%s: another source type option given before.\n",
|
program_name );
|
||||||
program_name);
|
report( stderr, "%s: give only one source type option.\n",
|
||||||
fprintf(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 = IMAGE_DEVICE;
|
||||||
@@ -109,8 +108,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 != IMAGE_UNKNOWN) {
|
||||||
fprintf (stderr,
|
report( stderr, "%s: Source specified in option %s and as %s\n",
|
||||||
"%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);
|
||||||
free(program_name);
|
free(program_name);
|
||||||
@@ -123,8 +121,7 @@ parse_options (int argc, const char *argv[])
|
|||||||
source_name = strdup(remaining_arg);
|
source_name = strdup(remaining_arg);
|
||||||
|
|
||||||
if ( (poptGetArgs(optCon)) != NULL) {
|
if ( (poptGetArgs(optCon)) != NULL) {
|
||||||
fprintf (stderr,
|
report( stderr, "%s: Source specified in previously %s and %s\n",
|
||||||
"%s: Source specified in previously %s and %s\n",
|
|
||||||
program_name, source_name, remaining_arg);
|
program_name, source_name, remaining_arg);
|
||||||
poptFreeContext(optCon);
|
poptFreeContext(optCon);
|
||||||
free(program_name);
|
free(program_name);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: cd-info.c,v 1.96 2004/10/29 02:11:48 rocky Exp $
|
$Id: cd-info.c,v 1.97 2004/11/04 10:08:23 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2003, 2004 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>
|
||||||
@@ -26,6 +26,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
#ifdef HAVE_CDDB
|
#ifdef HAVE_CDDB
|
||||||
#include <cddb/cddb.h>
|
#include <cddb/cddb.h>
|
||||||
@@ -59,13 +60,8 @@
|
|||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#if 0
|
|
||||||
#define STRONG "\033[1m"
|
|
||||||
#define NORMAL "\033[0m"
|
|
||||||
#else
|
|
||||||
#define STRONG "__________________________________\n"
|
#define STRONG "__________________________________\n"
|
||||||
#define NORMAL ""
|
#define NORMAL ""
|
||||||
#endif
|
|
||||||
|
|
||||||
#if CDIO_IOCTL_FINISHED
|
#if CDIO_IOCTL_FINISHED
|
||||||
struct cdrom_multisession ms;
|
struct cdrom_multisession ms;
|
||||||
@@ -244,10 +240,9 @@ parse_options (int argc, const char *argv[])
|
|||||||
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 != IMAGE_UNKNOWN) {
|
||||||
fprintf(stderr,
|
report(stderr, "%s: another source type option given before.\n",
|
||||||
"%s: another source type option given before.\n",
|
|
||||||
program_name);
|
program_name);
|
||||||
fprintf(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;
|
||||||
}
|
}
|
||||||
@@ -291,8 +286,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 != IMAGE_UNKNOWN) {
|
||||||
fprintf (stderr,
|
report(stderr, "%s: Source '%s' given as an argument of an option and as "
|
||||||
"%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);
|
||||||
poptFreeContext(optCon);
|
poptFreeContext(optCon);
|
||||||
@@ -306,8 +300,7 @@ parse_options (int argc, const char *argv[])
|
|||||||
source_name = strdup(remaining_arg);
|
source_name = strdup(remaining_arg);
|
||||||
|
|
||||||
if ( (poptGetArgs(optCon)) != NULL) {
|
if ( (poptGetArgs(optCon)) != NULL) {
|
||||||
fprintf (stderr,
|
report(stderr, "%s: Source specified in previously %s and %s\n",
|
||||||
"%s: Source specified in previously %s and %s\n",
|
|
||||||
program_name, psz_my_source, remaining_arg);
|
program_name, psz_my_source, remaining_arg);
|
||||||
poptFreeContext(optCon);
|
poptFreeContext(optCon);
|
||||||
free(program_name);
|
free(program_name);
|
||||||
@@ -344,7 +337,7 @@ cddb_dec_digit_sum(int n)
|
|||||||
static inline unsigned int
|
static inline unsigned int
|
||||||
msf_seconds(msf_t *msf)
|
msf_seconds(msf_t *msf)
|
||||||
{
|
{
|
||||||
return from_bcd8(msf->m)*60 + from_bcd8(msf->s);
|
return from_bcd8(msf->m)*CDIO_CD_SECS_PER_MIN + from_bcd8(msf->s);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -438,7 +431,7 @@ print_cddb_info(CdIo *p_cdio, track_t i_tracks, track_t i_first_track) {
|
|||||||
cddb_disc_t *disc = NULL;
|
cddb_disc_t *disc = NULL;
|
||||||
|
|
||||||
if (!conn) {
|
if (!conn) {
|
||||||
fprintf(stderr, "%s: unable to initialize libcddb\n", program_name);
|
report(stderr, "%s: unable to initialize libcddb\n", program_name);
|
||||||
goto cddb_destroy;
|
goto cddb_destroy;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -470,7 +463,7 @@ print_cddb_info(CdIo *p_cdio, track_t i_tracks, track_t i_first_track) {
|
|||||||
|
|
||||||
disc = cddb_disc_new();
|
disc = cddb_disc_new();
|
||||||
if (!disc) {
|
if (!disc) {
|
||||||
fprintf(stderr, "%s: unable to create CDDB disc structure", program_name);
|
report(stderr, "%s: unable to create CDDB disc structure", program_name);
|
||||||
goto cddb_destroy;
|
goto cddb_destroy;
|
||||||
}
|
}
|
||||||
for(i = 0; i < i_tracks; i++) {
|
for(i = 0; i < i_tracks; i++) {
|
||||||
@@ -484,7 +477,7 @@ print_cddb_info(CdIo *p_cdio, track_t i_tracks, track_t i_first_track) {
|
|||||||
/ CDIO_CD_FRAMES_PER_SEC;
|
/ CDIO_CD_FRAMES_PER_SEC;
|
||||||
|
|
||||||
if (!cddb_disc_calc_discid(disc)) {
|
if (!cddb_disc_calc_discid(disc)) {
|
||||||
fprintf(stderr, "%s: libcddb calc discid failed.\n",
|
report(stderr, "%s: libcddb calc discid failed.\n",
|
||||||
program_name);
|
program_name);
|
||||||
goto cddb_destroy;
|
goto cddb_destroy;
|
||||||
}
|
}
|
||||||
@@ -517,23 +510,23 @@ print_vcd_info(driver_id_t driver) {
|
|||||||
switch (open_rc) {
|
switch (open_rc) {
|
||||||
case VCDINFO_OPEN_VCD:
|
case VCDINFO_OPEN_VCD:
|
||||||
if (vcdinfo_get_format_version (p_vcd) == VCD_TYPE_INVALID) {
|
if (vcdinfo_get_format_version (p_vcd) == VCD_TYPE_INVALID) {
|
||||||
fprintf(stderr, "VCD format detection failed");
|
report(stderr, "VCD format detection failed");
|
||||||
vcdinfo_close(p_vcd);
|
vcdinfo_close(p_vcd);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fprintf (stdout, "Format : %s\n",
|
report (stdout, "Format : %s\n",
|
||||||
vcdinfo_get_format_version_str(p_vcd));
|
vcdinfo_get_format_version_str(p_vcd));
|
||||||
fprintf (stdout, "Album : `%.16s'\n", vcdinfo_get_album_id(p_vcd));
|
report (stdout, "Album : `%.16s'\n", vcdinfo_get_album_id(p_vcd));
|
||||||
fprintf (stdout, "Volume count: %d\n", vcdinfo_get_volume_count(p_vcd));
|
report (stdout, "Volume count: %d\n", vcdinfo_get_volume_count(p_vcd));
|
||||||
fprintf (stdout, "volume number: %d\n", vcdinfo_get_volume_num(p_vcd));
|
report (stdout, "volume number: %d\n", vcdinfo_get_volume_num(p_vcd));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case VCDINFO_OPEN_ERROR:
|
case VCDINFO_OPEN_ERROR:
|
||||||
fprintf (stderr, "Error in Video CD opening of %s\n", source_name);
|
report( stderr, "Error in Video CD opening of %s\n", source_name );
|
||||||
break;
|
break;
|
||||||
case VCDINFO_OPEN_OTHER:
|
case VCDINFO_OPEN_OTHER:
|
||||||
fprintf (stderr, "Even though we thought this was a Video CD, "
|
report( stderr, "Even though we thought this was a Video CD, "
|
||||||
" further inspection says it is not.\n");
|
" further inspection says it is not.\n" );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (p_vcd) vcdinfo_close(p_vcd);
|
if (p_vcd) vcdinfo_close(p_vcd);
|
||||||
@@ -560,7 +553,7 @@ print_iso9660_recurse (CdIo *p_cdio, const char pathname[],
|
|||||||
printf ("%s:\n", pathname);
|
printf ("%s:\n", pathname);
|
||||||
|
|
||||||
if (NULL == entlist) {
|
if (NULL == entlist) {
|
||||||
fprintf (stderr, "Error getting above directory information\n");
|
report( stderr, "Error getting above directory information\n" );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -652,7 +645,7 @@ print_iso9660_fs (CdIo *p_cdio, cdio_fs_anal_t fs,
|
|||||||
#define print_vd_info(title, fn) \
|
#define print_vd_info(title, fn) \
|
||||||
psz_str = fn(&pvd); \
|
psz_str = fn(&pvd); \
|
||||||
if (psz_str) { \
|
if (psz_str) { \
|
||||||
fprintf(stdout, title ": %s\n", psz_str); \
|
report(stdout, title ": %s\n", psz_str); \
|
||||||
free(psz_str); \
|
free(psz_str); \
|
||||||
psz_str = NULL; \
|
psz_str = NULL; \
|
||||||
}
|
}
|
||||||
@@ -750,7 +743,7 @@ print_analysis(int ms_offset, cdio_iso_analysis_t cdio_iso_analysis,
|
|||||||
switch(CDIO_FSTYPE(fs)) {
|
switch(CDIO_FSTYPE(fs)) {
|
||||||
case CDIO_FS_UDF:
|
case CDIO_FS_UDF:
|
||||||
case CDIO_FS_ISO_UDF:
|
case CDIO_FS_ISO_UDF:
|
||||||
fprintf(stdout, "UDF: version %x.%2.2x\n",
|
report(stdout, "UDF: version %x.%2.2x\n",
|
||||||
cdio_iso_analysis.UDFVerMajor, cdio_iso_analysis.UDFVerMinor);
|
cdio_iso_analysis.UDFVerMajor, cdio_iso_analysis.UDFVerMinor);
|
||||||
break;
|
break;
|
||||||
default: ;
|
default: ;
|
||||||
@@ -1018,7 +1011,7 @@ main(int argc, const char *argv[])
|
|||||||
if (device_list) free(device_list);
|
if (device_list) free(device_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf(STRONG "\n");
|
report(stdout, STRONG "\n");
|
||||||
|
|
||||||
|
|
||||||
discmode = cdio_get_discmode(p_cdio);
|
discmode = cdio_get_discmode(p_cdio);
|
||||||
@@ -1104,7 +1097,7 @@ main(int argc, const char *argv[])
|
|||||||
|
|
||||||
#if CDIO_IOCTL_FINISHED
|
#if CDIO_IOCTL_FINISHED
|
||||||
if (!opts.no_ioctl) {
|
if (!opts.no_ioctl) {
|
||||||
printf(STRONG "What ioctl's report...\n" NORMAL);
|
report(stdout, "What ioctl's report...\n");
|
||||||
|
|
||||||
#ifdef CDROMMULTISESSION
|
#ifdef CDROMMULTISESSION
|
||||||
/* get multisession */
|
/* get multisession */
|
||||||
@@ -1147,7 +1140,7 @@ main(int argc, const char *argv[])
|
|||||||
#endif /*CDIO_IOCTL_FINISHED*/
|
#endif /*CDIO_IOCTL_FINISHED*/
|
||||||
|
|
||||||
if (!opts.no_analysis) {
|
if (!opts.no_analysis) {
|
||||||
printf(STRONG "CD Analysis Report\n" NORMAL);
|
report(stdout, STRONG "CD Analysis Report\n" NORMAL);
|
||||||
|
|
||||||
/* try to find out what sort of CD we have */
|
/* try to find out what sort of CD we have */
|
||||||
if (0 == num_data) {
|
if (0 == num_data) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: cd-read.c,v 1.21 2004/07/31 07:43:26 rocky Exp $
|
$Id: cd-read.c,v 1.22 2004/11/04 10:08:23 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
@@ -158,17 +158,17 @@ process_suboption(const char *subopt, subopt_entry_t *sublist, const int num,
|
|||||||
unsigned int i;
|
unsigned int i;
|
||||||
bool is_help=strcmp(subopt, "help")==0;
|
bool is_help=strcmp(subopt, "help")==0;
|
||||||
if (is_help) {
|
if (is_help) {
|
||||||
fprintf (stderr, "The list of sub options for \"%s\" are:\n",
|
report( stderr, "The list of sub options for \"%s\" are:\n",
|
||||||
subopt_name);
|
subopt_name );
|
||||||
} else {
|
} else {
|
||||||
fprintf (stderr, "Invalid option following \"%s\": %s.\n",
|
report( stderr, "Invalid option following \"%s\": %s.\n",
|
||||||
subopt_name, subopt);
|
subopt_name, subopt );
|
||||||
fprintf (stderr, "Should be one of: ");
|
report( stderr, "Should be one of: " );
|
||||||
}
|
}
|
||||||
for (i=0; i<num-1; i++) {
|
for (i=0; i<num-1; i++) {
|
||||||
fprintf(stderr, "%s, ", sublist[i].name);
|
report( stderr, "%s, ", sublist[i].name );
|
||||||
}
|
}
|
||||||
fprintf(stderr, "or %s.\n", sublist[num-1].name);
|
report( stderr, "or %s.\n", sublist[num-1].name );
|
||||||
exit (is_help ? EXIT_SUCCESS : EXIT_FAILURE);
|
exit (is_help ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -258,11 +258,10 @@ parse_options (int argc, const char *argv[])
|
|||||||
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 != IMAGE_UNKNOWN) {
|
||||||
fprintf(stderr,
|
report( stderr, "%s: another source type option given before.\n",
|
||||||
"%s: another source type option given before.\n",
|
program_name );
|
||||||
program_name);
|
report( stderr, "%s: give only one source type option.\n",
|
||||||
fprintf(stderr, "%s: give only one source type option.\n",
|
program_name );
|
||||||
program_name);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -306,10 +305,10 @@ parse_options (int argc, const char *argv[])
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
fprintf (stderr, "%s: %s\n",
|
report( stderr, "%s: %s\n",
|
||||||
poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
|
poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
|
||||||
poptStrerror(opt));
|
poptStrerror(opt) );
|
||||||
fprintf (stderr, "error while parsing command line - try --help\n");
|
report( stderr, "error while parsing command line - try --help\n" );
|
||||||
poptFreeContext(optCon);
|
poptFreeContext(optCon);
|
||||||
free(program_name);
|
free(program_name);
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
@@ -319,9 +318,8 @@ 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 != IMAGE_UNKNOWN) {
|
||||||
fprintf (stderr,
|
report( stderr, "%s: Source specified in option %s and as %s\n",
|
||||||
"%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);
|
||||||
free(program_name);
|
free(program_name);
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
@@ -333,9 +331,8 @@ parse_options (int argc, const char *argv[])
|
|||||||
source_name = strdup(remaining_arg);
|
source_name = strdup(remaining_arg);
|
||||||
|
|
||||||
if ( (poptGetArgs(optCon)) != NULL) {
|
if ( (poptGetArgs(optCon)) != NULL) {
|
||||||
fprintf (stderr,
|
report( stderr, "%s: Source specified in previously %s and %s\n",
|
||||||
"%s: Source specified in previously %s and %s\n",
|
program_name, source_name, remaining_arg );
|
||||||
program_name, source_name, remaining_arg);
|
|
||||||
poptFreeContext(optCon);
|
poptFreeContext(optCon);
|
||||||
free(program_name);
|
free(program_name);
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
@@ -351,9 +348,10 @@ parse_options (int argc, const char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (opts.read_mode == READ_MODE_UNINIT) {
|
if (opts.read_mode == READ_MODE_UNINIT) {
|
||||||
fprintf(stderr,
|
report( stderr,
|
||||||
"%s: Need to give a read mode (audio, m1f1, m1f2, m2f1 or m2f2)\n",
|
"%s: Need to give a read mode "
|
||||||
program_name);
|
"(audio, m1f1, m1f2, m2f1 or m2f2)\n",
|
||||||
|
program_name );
|
||||||
poptFreeContext(optCon);
|
poptFreeContext(optCon);
|
||||||
free(program_name);
|
free(program_name);
|
||||||
exit(10);
|
exit(10);
|
||||||
@@ -362,9 +360,9 @@ parse_options (int argc, const char *argv[])
|
|||||||
/* Check consistency between start_lsn, end_lsn and num_sectors. */
|
/* Check consistency between start_lsn, end_lsn and num_sectors. */
|
||||||
|
|
||||||
if (opts.nohexdump && opts.hexdump != 2) {
|
if (opts.nohexdump && opts.hexdump != 2) {
|
||||||
fprintf(stderr,
|
report( stderr,
|
||||||
"%s: don't give both --hexdump and --no-hexdump together\n",
|
"%s: don't give both --hexdump and --no-hexdump together\n",
|
||||||
program_name);
|
program_name );
|
||||||
exit(13);
|
exit(13);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -378,11 +376,10 @@ parse_options (int argc, const char *argv[])
|
|||||||
if (opts.num_sectors == 0) opts.num_sectors = 1;
|
if (opts.num_sectors == 0) opts.num_sectors = 1;
|
||||||
} else if (opts.num_sectors != 0) {
|
} else if (opts.num_sectors != 0) {
|
||||||
if (opts.end_lsn <= opts.num_sectors) {
|
if (opts.end_lsn <= opts.num_sectors) {
|
||||||
fprintf(stderr,
|
report( stderr, "%s: end LSN (%lu) needs to be greater than "
|
||||||
"%s: end LSN (%lu) needs to be greater than "
|
|
||||||
" the sector to read (%lu)\n",
|
" the sector to read (%lu)\n",
|
||||||
program_name, (unsigned long) opts.end_lsn,
|
program_name, (unsigned long) opts.end_lsn,
|
||||||
(unsigned long) opts.num_sectors);
|
(unsigned long) opts.num_sectors );
|
||||||
poptFreeContext(optCon);
|
poptFreeContext(optCon);
|
||||||
exit(12);
|
exit(12);
|
||||||
}
|
}
|
||||||
@@ -398,21 +395,21 @@ parse_options (int argc, const char *argv[])
|
|||||||
} else {
|
} else {
|
||||||
/* We were given an end lsn. */
|
/* We were given an end lsn. */
|
||||||
if (opts.end_lsn < opts.start_lsn) {
|
if (opts.end_lsn < opts.start_lsn) {
|
||||||
fprintf(stderr,
|
report( stderr,
|
||||||
"%s: end LSN (%lu) needs to be less than start LSN (%lu)\n",
|
"%s: end LSN (%lu) needs to be less than start LSN (%lu)\n",
|
||||||
program_name, (unsigned long) opts.start_lsn,
|
program_name, (unsigned long) opts.start_lsn,
|
||||||
(unsigned long) opts.end_lsn);
|
(unsigned long) opts.end_lsn );
|
||||||
poptFreeContext(optCon);
|
poptFreeContext(optCon);
|
||||||
free(program_name);
|
free(program_name);
|
||||||
exit(13);
|
exit(13);
|
||||||
}
|
}
|
||||||
if (opts.num_sectors != opts.end_lsn - opts.start_lsn + 1)
|
if (opts.num_sectors != opts.end_lsn - opts.start_lsn + 1)
|
||||||
if (opts.num_sectors != 0) {
|
if (opts.num_sectors != 0) {
|
||||||
fprintf(stderr,
|
report( stderr,
|
||||||
"%s: inconsistency between start LSN (%lu), end (%lu), "
|
"%s: inconsistency between start LSN (%lu), end (%lu), "
|
||||||
"and count (%d)\n",
|
"and count (%d)\n",
|
||||||
program_name, (unsigned long) opts.start_lsn,
|
program_name, (unsigned long) opts.start_lsn,
|
||||||
(unsigned long) opts.end_lsn, opts.num_sectors);
|
(unsigned long) opts.end_lsn, opts.num_sectors );
|
||||||
poptFreeContext(optCon);
|
poptFreeContext(optCon);
|
||||||
free(program_name);
|
free(program_name);
|
||||||
exit(14);
|
exit(14);
|
||||||
@@ -547,14 +544,14 @@ main(int argc, const char *argv[])
|
|||||||
switch (opts.read_mode) {
|
switch (opts.read_mode) {
|
||||||
case READ_AUDIO:
|
case READ_AUDIO:
|
||||||
if (cdio_read_audio_sector(p_cdio, &buffer, opts.start_lsn)) {
|
if (cdio_read_audio_sector(p_cdio, &buffer, opts.start_lsn)) {
|
||||||
fprintf (stderr, "error reading block %u\n",
|
report( stderr, "error reading block %u\n",
|
||||||
(unsigned int) opts.start_lsn);
|
(unsigned int) opts.start_lsn );
|
||||||
blocklen = 0;
|
blocklen = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case READ_M1F1:
|
case READ_M1F1:
|
||||||
if (cdio_read_mode1_sector(p_cdio, &buffer, opts.start_lsn, false)) {
|
if (cdio_read_mode1_sector(p_cdio, &buffer, opts.start_lsn, false)) {
|
||||||
fprintf (stderr, "error reading block %u\n",
|
report( stderr, "error reading block %u\n",
|
||||||
(unsigned int) opts.start_lsn);
|
(unsigned int) opts.start_lsn);
|
||||||
blocklen = 0;
|
blocklen = 0;
|
||||||
} else
|
} else
|
||||||
@@ -562,7 +559,7 @@ main(int argc, const char *argv[])
|
|||||||
break;
|
break;
|
||||||
case READ_M1F2:
|
case READ_M1F2:
|
||||||
if (cdio_read_mode1_sector(p_cdio, &buffer, opts.start_lsn, true)) {
|
if (cdio_read_mode1_sector(p_cdio, &buffer, opts.start_lsn, true)) {
|
||||||
fprintf (stderr, "error reading block %u\n",
|
report( stderr, "error reading block %u\n",
|
||||||
(unsigned int) opts.start_lsn);
|
(unsigned int) opts.start_lsn);
|
||||||
blocklen = 0;
|
blocklen = 0;
|
||||||
} else
|
} else
|
||||||
@@ -570,7 +567,7 @@ main(int argc, const char *argv[])
|
|||||||
break;
|
break;
|
||||||
case READ_M2F1:
|
case READ_M2F1:
|
||||||
if (cdio_read_mode2_sector(p_cdio, &buffer, opts.start_lsn, false)) {
|
if (cdio_read_mode2_sector(p_cdio, &buffer, opts.start_lsn, false)) {
|
||||||
fprintf (stderr, "error reading block %u\n",
|
report( stderr, "error reading block %u\n",
|
||||||
(unsigned int) opts.start_lsn);
|
(unsigned int) opts.start_lsn);
|
||||||
blocklen=0;
|
blocklen=0;
|
||||||
} else
|
} else
|
||||||
@@ -578,7 +575,7 @@ main(int argc, const char *argv[])
|
|||||||
break;
|
break;
|
||||||
case READ_M2F2:
|
case READ_M2F2:
|
||||||
if (cdio_read_mode2_sector(p_cdio, &buffer, opts.start_lsn, true)) {
|
if (cdio_read_mode2_sector(p_cdio, &buffer, opts.start_lsn, true)) {
|
||||||
fprintf (stderr, "error reading block %u\n",
|
report( stderr, "error reading block %u\n",
|
||||||
(unsigned int) opts.start_lsn);
|
(unsigned int) opts.start_lsn);
|
||||||
blocklen=0;
|
blocklen=0;
|
||||||
} else
|
} else
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: iso-info.c,v 1.16 2004/10/30 02:55:17 rocky Exp $
|
$Id: iso-info.c,v 1.17 2004/11/04 10:08:23 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
#undef err_exit
|
#undef err_exit
|
||||||
|
|
||||||
#define err_exit(fmt, args...) \
|
#define err_exit(fmt, args...) \
|
||||||
fprintf(stderr, "%s: "fmt, program_name, ##args); \
|
report (stderr, "%s: "fmt, program_name, ##args); \
|
||||||
iso9660_close(p_iso); \
|
iso9660_close(p_iso); \
|
||||||
return(EXIT_FAILURE);
|
return(EXIT_FAILURE);
|
||||||
|
|
||||||
@@ -124,9 +124,8 @@ 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 ( (poptGetArgs(optCon)) != NULL) {
|
if ( (poptGetArgs(optCon)) != NULL) {
|
||||||
fprintf (stderr,
|
report( stderr, "%s: Source specified in previously %s and %s\n",
|
||||||
"%s: Source specified in previously %s and %s\n",
|
program_name, source_name, remaining_arg );
|
||||||
program_name, source_name, remaining_arg);
|
|
||||||
poptFreeContext(optCon);
|
poptFreeContext(optCon);
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
@@ -170,7 +169,7 @@ print_iso9660_recurse (iso9660_t *p_iso, const char pathname[])
|
|||||||
printf ("%s:\n", pathname);
|
printf ("%s:\n", pathname);
|
||||||
|
|
||||||
if (NULL == entlist) {
|
if (NULL == entlist) {
|
||||||
fprintf (stderr, "Error getting above directory information\n");
|
report( stderr, "Error getting above directory information\n" );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: iso-read.c,v 1.6 2004/10/31 13:58:44 rocky Exp $
|
$Id: iso-read.c,v 1.7 2004/11/04 10:08:23 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
@@ -106,10 +106,10 @@ parse_options (int argc, const char *argv[])
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
fprintf (stderr, "%s: %s\n",
|
report( stderr, "%s: %s\n",
|
||||||
poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
|
poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
|
||||||
poptStrerror(opt));
|
poptStrerror(opt) );
|
||||||
fprintf (stderr, "Error while parsing command line - try --help.\n");
|
report( stderr, "Error while parsing command line - try --help.\n" );
|
||||||
poptFreeContext(optCon);
|
poptFreeContext(optCon);
|
||||||
free(program_name);
|
free(program_name);
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
@@ -119,9 +119,8 @@ 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.iso9660_image != NULL) {
|
if (opts.iso9660_image != NULL) {
|
||||||
fprintf (stderr,
|
report( stderr, "%s: Source specified as --image %s and as %s\n",
|
||||||
"%s: Source specified as --image %s and as %s\n",
|
program_name, opts.iso9660_image, remaining_arg );
|
||||||
program_name, opts.iso9660_image, remaining_arg);
|
|
||||||
poptFreeContext(optCon);
|
poptFreeContext(optCon);
|
||||||
free(program_name);
|
free(program_name);
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
@@ -130,9 +129,10 @@ parse_options (int argc, const char *argv[])
|
|||||||
opts.iso9660_image = strdup(remaining_arg);
|
opts.iso9660_image = strdup(remaining_arg);
|
||||||
|
|
||||||
if ( (poptGetArgs(optCon)) != NULL) {
|
if ( (poptGetArgs(optCon)) != NULL) {
|
||||||
fprintf (stderr,
|
report( stderr,
|
||||||
"%s: use only one unnamed argument for the ISO 9660 image name\n",
|
"%s: use only one unnamed argument for the ISO 9660 "
|
||||||
program_name);
|
"image name\n",
|
||||||
|
program_name );
|
||||||
poptFreeContext(optCon);
|
poptFreeContext(optCon);
|
||||||
free(program_name);
|
free(program_name);
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
@@ -144,32 +144,27 @@ parse_options (int argc, const char *argv[])
|
|||||||
poptFreeContext(optCon);
|
poptFreeContext(optCon);
|
||||||
|
|
||||||
if (NULL == opts.iso9660_image) {
|
if (NULL == opts.iso9660_image) {
|
||||||
fprintf (stderr,
|
report( stderr, "%s: you need to specify an ISO-9660 image name.\n",
|
||||||
"%s: you need to specify an ISO-9660 image name.\n",
|
program_name );
|
||||||
program_name);
|
report( stderr, "%s: Use option --image or try --help.\n",
|
||||||
fprintf (stderr,
|
program_name );
|
||||||
"%s: Use option --image or try --help.\n",
|
|
||||||
program_name);
|
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NULL == opts.file_name) {
|
if (NULL == opts.file_name) {
|
||||||
fprintf (stderr,
|
report( stderr, "%s: you need to specify a filename to extract.\n",
|
||||||
"%s: you need to specify a filename to extract.\n",
|
program_name );
|
||||||
program_name);
|
report( stderr, "%s: Use option --extract or try --help.\n",
|
||||||
fprintf (stderr,
|
program_name );
|
||||||
"%s: Use option --extract or try --help.\n",
|
|
||||||
program_name);
|
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NULL == opts.output_file) {
|
if (NULL == opts.output_file) {
|
||||||
fprintf (stderr,
|
report( stderr,
|
||||||
"%s: you need to specify a place write filename extraction to.\n",
|
"%s: you need to specify a place write filename extraction to.\n",
|
||||||
program_name);
|
program_name );
|
||||||
fprintf (stderr,
|
report( stderr, "%s: Use option --output-file or try --help.\n",
|
||||||
"%s: Use option --output-file or try --help.\n",
|
program_name );
|
||||||
program_name);
|
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,7 +197,7 @@ main(int argc, const char *argv[])
|
|||||||
iso = iso9660_open (opts.iso9660_image);
|
iso = iso9660_open (opts.iso9660_image);
|
||||||
|
|
||||||
if (NULL == iso) {
|
if (NULL == iso) {
|
||||||
fprintf(stderr,
|
report(stderr,
|
||||||
"%s: Sorry, couldn't open ISO-9660 image file '%s'.\n",
|
"%s: Sorry, couldn't open ISO-9660 image file '%s'.\n",
|
||||||
program_name, opts.iso9660_image);
|
program_name, opts.iso9660_image);
|
||||||
return 1;
|
return 1;
|
||||||
@@ -212,11 +207,11 @@ main(int argc, const char *argv[])
|
|||||||
|
|
||||||
if (NULL == statbuf)
|
if (NULL == statbuf)
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
report(stderr,
|
||||||
"%s: Could not get ISO-9660 file information out of %s"
|
"%s: Could not get ISO-9660 file information out of %s"
|
||||||
" for file %s.\n",
|
" for file %s.\n",
|
||||||
program_name, opts.iso9660_image, opts.file_name);
|
program_name, opts.iso9660_image, opts.file_name);
|
||||||
fprintf(stderr,
|
report(stderr,
|
||||||
"%s: iso-info may be able to show the contents of %s.\n",
|
"%s: iso-info may be able to show the contents of %s.\n",
|
||||||
program_name, opts.iso9660_image);
|
program_name, opts.iso9660_image);
|
||||||
return 2;
|
return 2;
|
||||||
@@ -224,7 +219,7 @@ main(int argc, const char *argv[])
|
|||||||
|
|
||||||
if (!(outfd = fopen (opts.output_file, "wb")))
|
if (!(outfd = fopen (opts.output_file, "wb")))
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
report(stderr,
|
||||||
"%s: Could not open %s for writing: %s\n",
|
"%s: Could not open %s for writing: %s\n",
|
||||||
program_name, opts.output_file, strerror(errno));
|
program_name, opts.output_file, strerror(errno));
|
||||||
return 3;
|
return 3;
|
||||||
@@ -241,7 +236,7 @@ main(int argc, const char *argv[])
|
|||||||
+ (i / ISO_BLOCKSIZE),
|
+ (i / ISO_BLOCKSIZE),
|
||||||
1) )
|
1) )
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Error reading ISO 9660 file at lsn %lu\n",
|
report(stderr, "Error reading ISO 9660 file at lsn %lu\n",
|
||||||
(long unsigned int) statbuf->lsn + (i / ISO_BLOCKSIZE));
|
(long unsigned int) statbuf->lsn + (i / ISO_BLOCKSIZE));
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|||||||
334
src/util.c
334
src/util.c
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: util.c,v 1.24 2004/08/27 00:02:10 rocky Exp $
|
$Id: util.c,v 1.25 2004/11/04 10:08:23 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
@@ -44,10 +44,11 @@ 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)
|
||||||
printf( "%s version %s\nCopyright (c) 2003, 2004 R. Bernstein\n",
|
report( stdout, "%s version %s\nCopyright (c) 2003, 2004 R. Bernstein\n",
|
||||||
program_name, version);
|
program_name, version);
|
||||||
printf( _("This is free software; see the source for copying conditions.\n\
|
report( stdout,
|
||||||
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A\n\
|
_("This is free software; see the source for copying conditions.\n\
|
||||||
|
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A\n \
|
||||||
PARTICULAR PURPOSE.\n\
|
PARTICULAR PURPOSE.\n\
|
||||||
"));
|
"));
|
||||||
|
|
||||||
@@ -55,14 +56,14 @@ PARTICULAR PURPOSE.\n\
|
|||||||
char *default_device;
|
char *default_device;
|
||||||
for (driver_id=DRIVER_UNKNOWN+1; driver_id<=CDIO_MAX_DRIVER; driver_id++) {
|
for (driver_id=DRIVER_UNKNOWN+1; driver_id<=CDIO_MAX_DRIVER; driver_id++) {
|
||||||
if (cdio_have_driver(driver_id)) {
|
if (cdio_have_driver(driver_id)) {
|
||||||
printf("Have driver: %s\n", cdio_driver_describe(driver_id));
|
report( stdout, "Have driver: %s\n", cdio_driver_describe(driver_id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
default_device=cdio_get_default_device(NULL);
|
default_device=cdio_get_default_device(NULL);
|
||||||
if (default_device)
|
if (default_device)
|
||||||
printf("Default CD-ROM device: %s\n", default_device);
|
report( stdout, "Default CD-ROM device: %s\n", default_device);
|
||||||
else
|
else
|
||||||
printf("No CD-ROM device found.\n");
|
report( stdout, "No CD-ROM device found.\n");
|
||||||
free(program_name);
|
free(program_name);
|
||||||
exit(100);
|
exit(100);
|
||||||
}
|
}
|
||||||
@@ -81,7 +82,7 @@ fillout_device_name(const char *device_name)
|
|||||||
return strdup(device_name);
|
return strdup(device_name);
|
||||||
else {
|
else {
|
||||||
char *full_device_name = (char*) malloc(strlen(device_name)+prefix_len);
|
char *full_device_name = (char*) malloc(strlen(device_name)+prefix_len);
|
||||||
sprintf(full_device_name, DEV_PREFIX "%s", device_name);
|
report( stdout, full_device_name, DEV_PREFIX "%s", device_name);
|
||||||
return full_device_name;
|
return full_device_name;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -122,256 +123,287 @@ print_mmc_drive_features(CdIo *p_cdio)
|
|||||||
{
|
{
|
||||||
uint8_t *q;
|
uint8_t *q;
|
||||||
case CDIO_MMC_FEATURE_PROFILE_LIST:
|
case CDIO_MMC_FEATURE_PROFILE_LIST:
|
||||||
printf("Profile List Feature\n");
|
report( stdout, "Profile List Feature\n");
|
||||||
for ( q = p+4 ; q < p + i_feature_additional ; q += 4 ) {
|
for ( q = p+4 ; q < p + i_feature_additional ; q += 4 ) {
|
||||||
int i_profile=CDIO_MMC_GET_LEN16(q);
|
int i_profile=CDIO_MMC_GET_LEN16(q);
|
||||||
switch (i_profile) {
|
switch (i_profile) {
|
||||||
case CDIO_MMC_FEATURE_PROF_NON_REMOVABLE:
|
case CDIO_MMC_FEATURE_PROF_NON_REMOVABLE:
|
||||||
printf("\tRe-writable disk, capable of changing behavior");
|
report( stdout,
|
||||||
|
"\tRe-writable disk, capable of changing behavior");
|
||||||
break;
|
break;
|
||||||
case CDIO_MMC_FEATURE_PROF_REMOVABLE:
|
case CDIO_MMC_FEATURE_PROF_REMOVABLE:
|
||||||
printf("\tdisk Re-writable; with removable media");
|
report( stdout,
|
||||||
|
"\tdisk Re-writable; with removable media");
|
||||||
break;
|
break;
|
||||||
case CDIO_MMC_FEATURE_PROF_MO_ERASABLE:
|
case CDIO_MMC_FEATURE_PROF_MO_ERASABLE:
|
||||||
printf("\tErasable Magneto-Optical disk with sector erase capability");
|
report( stdout,
|
||||||
|
"\tErasable Magneto-Optical disk with sector erase capability");
|
||||||
break;
|
break;
|
||||||
case CDIO_MMC_FEATURE_PROF_MO_WRITE_ONCE:
|
case CDIO_MMC_FEATURE_PROF_MO_WRITE_ONCE:
|
||||||
printf("\tWrite Once Magneto-Optical write once");
|
report( stdout,
|
||||||
|
"\tWrite Once Magneto-Optical write once");
|
||||||
break;
|
break;
|
||||||
case CDIO_MMC_FEATURE_PROF_AS_MO:
|
case CDIO_MMC_FEATURE_PROF_AS_MO:
|
||||||
printf("\tAdvance Storage Magneto-Optical");
|
report( stdout,
|
||||||
|
"\tAdvance Storage Magneto-Optical");
|
||||||
break;
|
break;
|
||||||
case CDIO_MMC_FEATURE_PROF_CD_ROM:
|
case CDIO_MMC_FEATURE_PROF_CD_ROM:
|
||||||
printf("\tRead only Compact Disc capable");
|
report( stdout,
|
||||||
|
"\tRead only Compact Disc capable");
|
||||||
break;
|
break;
|
||||||
case CDIO_MMC_FEATURE_PROF_CD_R:
|
case CDIO_MMC_FEATURE_PROF_CD_R:
|
||||||
printf("\tWrite once Compact Disc capable");
|
report( stdout,
|
||||||
|
"\tWrite once Compact Disc capable");
|
||||||
break;
|
break;
|
||||||
case CDIO_MMC_FEATURE_PROF_CD_RW:
|
case CDIO_MMC_FEATURE_PROF_CD_RW:
|
||||||
printf("\tCD-RW Re-writable Compact Disc capable");
|
report( stdout,
|
||||||
|
"\tCD-RW Re-writable Compact Disc capable");
|
||||||
break;
|
break;
|
||||||
case CDIO_MMC_FEATURE_PROF_DVD_ROM:
|
case CDIO_MMC_FEATURE_PROF_DVD_ROM:
|
||||||
printf("\tRead only DVD");
|
report( stdout,
|
||||||
|
"\tRead only DVD");
|
||||||
break;
|
break;
|
||||||
case CDIO_MMC_FEATURE_PROF_DVD_R_SEQ:
|
case CDIO_MMC_FEATURE_PROF_DVD_R_SEQ:
|
||||||
printf("\tRe-recordable DVD using Sequential recording");
|
report( stdout,
|
||||||
|
"\tRe-recordable DVD using Sequential recording");
|
||||||
break;
|
break;
|
||||||
case CDIO_MMC_FEATURE_PROF_DVD_RAM:
|
case CDIO_MMC_FEATURE_PROF_DVD_RAM:
|
||||||
printf("\tRe-writable DVD");
|
report( stdout,
|
||||||
|
"\tRe-writable DVD");
|
||||||
break;
|
break;
|
||||||
case CDIO_MMC_FEATURE_PROF_DVD_RW_RO:
|
case CDIO_MMC_FEATURE_PROF_DVD_RW_RO:
|
||||||
printf("\tRe-recordable DVD using Restricted Overwrite");
|
report( stdout,
|
||||||
|
"\tRe-recordable DVD using Restricted Overwrite");
|
||||||
break;
|
break;
|
||||||
case CDIO_MMC_FEATURE_PROF_DVD_RW_SEQ:
|
case CDIO_MMC_FEATURE_PROF_DVD_RW_SEQ:
|
||||||
printf("\tRe-recordable DVD using Sequential recording");
|
report( stdout,
|
||||||
|
"\tRe-recordable DVD using Sequential recording");
|
||||||
break;
|
break;
|
||||||
case CDIO_MMC_FEATURE_PROF_DVD_PRW:
|
case CDIO_MMC_FEATURE_PROF_DVD_PRW:
|
||||||
printf("\tDVD+RW - DVD ReWritable");
|
report( stdout,
|
||||||
|
"\tDVD+RW - DVD ReWritable");
|
||||||
break;
|
break;
|
||||||
case CDIO_MMC_FEATURE_PROF_DVD_PR:
|
case CDIO_MMC_FEATURE_PROF_DVD_PR:
|
||||||
printf("\tDVD+R - DVD Recordable");
|
report( stdout,
|
||||||
|
"\tDVD+R - DVD Recordable");
|
||||||
break;
|
break;
|
||||||
case CDIO_MMC_FEATURE_PROF_DDCD_ROM:
|
case CDIO_MMC_FEATURE_PROF_DDCD_ROM:
|
||||||
printf("\tRead only DDCD");
|
report( stdout,
|
||||||
|
"\tRead only DDCD");
|
||||||
break;
|
break;
|
||||||
case CDIO_MMC_FEATURE_PROF_DDCD_R:
|
case CDIO_MMC_FEATURE_PROF_DDCD_R:
|
||||||
printf("\tDDCD-R Write only DDCD");
|
report( stdout,
|
||||||
|
"\tDDCD-R Write only DDCD");
|
||||||
break;
|
break;
|
||||||
case CDIO_MMC_FEATURE_PROF_DDCD_RW:
|
case CDIO_MMC_FEATURE_PROF_DDCD_RW:
|
||||||
printf("\tRe-Write only DDCD");
|
report( stdout,
|
||||||
|
"\tRe-Write only DDCD");
|
||||||
break;
|
break;
|
||||||
case CDIO_MMC_FEATURE_PROF_NON_CONFORM:
|
case CDIO_MMC_FEATURE_PROF_NON_CONFORM:
|
||||||
printf("\tThe Logical Unit does not conform to any Profile.");
|
report( stdout,
|
||||||
|
"\tThe Logical Unit does not conform to any Profile.");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf("\tUnknown Profile %x", i_profile);
|
report( stdout,
|
||||||
|
"\tUnknown Profile %x", i_profile);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (q[2] & 1) {
|
if (q[2] & 1) {
|
||||||
printf(" - on");
|
report( stdout, " - on");
|
||||||
}
|
}
|
||||||
printf("\n");
|
report( stdout, "\n");
|
||||||
}
|
}
|
||||||
printf("\n");
|
report( stdout, "\n");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case CDIO_MMC_FEATURE_CORE:
|
case CDIO_MMC_FEATURE_CORE:
|
||||||
{
|
{
|
||||||
uint8_t *q = p+4;
|
uint8_t *q = p+4;
|
||||||
uint32_t i_interface_standard = CDIO_MMC_GET_LEN32(q);
|
uint32_t i_interface_standard = CDIO_MMC_GET_LEN32(q);
|
||||||
printf("Core Feature\n");
|
report( stdout, "Core Feature\n");
|
||||||
switch(i_interface_standard) {
|
switch(i_interface_standard) {
|
||||||
case 0:
|
case 0:
|
||||||
printf("\tunspecified interface\n");
|
report( stdout, "\tunspecified interface\n");
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
printf("\tSCSI interface\n");
|
report( stdout, "\tSCSI interface\n");
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
printf("\tATAPI interface\n");
|
report( stdout, "\tATAPI interface\n");
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
printf("\tIEEE 1394 interface\n");
|
report( stdout, "\tIEEE 1394 interface\n");
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
printf("\tIEEE 1394A interface\n");
|
report( stdout, "\tIEEE 1394A interface\n");
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
printf("\tFibre Channel interface\n");
|
report( stdout, "\tFibre Channel interface\n");
|
||||||
}
|
}
|
||||||
printf("\n");
|
report( stdout, "\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CDIO_MMC_FEATURE_REMOVABLE_MEDIUM:
|
case CDIO_MMC_FEATURE_REMOVABLE_MEDIUM:
|
||||||
printf("Removable Medium Feature\n");
|
report( stdout, "Removable Medium Feature\n" );
|
||||||
switch(p[4] >> 5) {
|
switch(p[4] >> 5) {
|
||||||
case 0:
|
case 0:
|
||||||
printf("\tCaddy/Slot type loading mechanism\n");
|
report( stdout,
|
||||||
|
"\tCaddy/Slot type loading mechanism\n" );
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
printf("\tTray type loading mechanism\n");
|
report( stdout,
|
||||||
|
"\tTray type loading mechanism\n" );
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
printf("\tPop-up type loading mechanism\n");
|
report( stdout, "\tPop-up type loading mechanism\n");
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
printf("\tEmbedded changer with individually changeable discs\n");
|
report( stdout,
|
||||||
|
"\tEmbedded changer with individually changeable discs\n");
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
printf("\tEmbedded changer using a magazine mechanism\n");
|
report( stdout,
|
||||||
|
"\tEmbedded changer using a magazine mechanism\n" );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf("\tUnknown changer mechanism\n");
|
report( stdout,
|
||||||
|
"\tUnknown changer mechanism\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("\tcan%s eject the medium or magazine via the normal "
|
report( stdout,
|
||||||
|
"\tcan%s eject the medium or magazine via the normal "
|
||||||
"START/STOP command\n",
|
"START/STOP command\n",
|
||||||
(p[4] & 8) ? "": "not");
|
(p[4] & 8) ? "": "not" );
|
||||||
printf("\tcan%s be locked into the Logical Unit\n",
|
report( stdout, "\tcan%s be locked into the Logical Unit\n",
|
||||||
(p[4] & 1) ? "": "not");
|
(p[4] & 1) ? "": "not" );
|
||||||
printf("\n");
|
report( stdout, "\n" );
|
||||||
break;
|
break;
|
||||||
case CDIO_MMC_FEATURE_WRITE_PROTECT:
|
case CDIO_MMC_FEATURE_WRITE_PROTECT:
|
||||||
printf("Write Protect Feature\n");
|
report( stdout, "Write Protect Feature\n" );
|
||||||
break;
|
break;
|
||||||
case CDIO_MMC_FEATURE_RANDOM_READABLE:
|
case CDIO_MMC_FEATURE_RANDOM_READABLE:
|
||||||
printf("Random Readable Feature\n");
|
report( stdout, "Random Readable Feature\n" );
|
||||||
break;
|
break;
|
||||||
case CDIO_MMC_FEATURE_MULTI_READ:
|
case CDIO_MMC_FEATURE_MULTI_READ:
|
||||||
printf("Multi-Read Feature\n");
|
report( stdout, "Multi-Read Feature\n" );
|
||||||
break;
|
break;
|
||||||
case CDIO_MMC_FEATURE_CD_READ:
|
case CDIO_MMC_FEATURE_CD_READ:
|
||||||
printf("CD Read Feature\n");
|
report( stdout, "CD Read Feature\n" );
|
||||||
printf("\tC2 Error pointers are %ssupported\n",
|
report( stdout, "\tC2 Error pointers are %ssupported\n",
|
||||||
(p[4] & 2) ? "": "not ");
|
(p[4] & 2) ? "": "not " );
|
||||||
printf("\tCD-Text is %ssupported\n",
|
report( stdout, "\tCD-Text is %ssupported\n",
|
||||||
(p[4] & 1) ? "": "not ");
|
(p[4] & 1) ? "": "not " );
|
||||||
printf("\n");
|
report( stdout, "\n" );
|
||||||
break;
|
break;
|
||||||
case CDIO_MMC_FEATURE_DVD_READ:
|
case CDIO_MMC_FEATURE_DVD_READ:
|
||||||
printf("DVD Read Feature\n");
|
report( stdout, "DVD Read Feature\n" );
|
||||||
break;
|
break;
|
||||||
case CDIO_MMC_FEATURE_RANDOM_WRITABLE:
|
case CDIO_MMC_FEATURE_RANDOM_WRITABLE:
|
||||||
printf("Random Writable Feature\n");
|
report( stdout, "Random Writable Feature\n" );
|
||||||
break;
|
break;
|
||||||
case CDIO_MMC_FEATURE_INCR_WRITE:
|
case CDIO_MMC_FEATURE_INCR_WRITE:
|
||||||
printf("Incremental Streaming Writable Feature\n");
|
report( stdout, "Incremental Streaming Writable Feature\n" );
|
||||||
break;
|
break;
|
||||||
case CDIO_MMC_FEATURE_SECTOR_ERASE:
|
case CDIO_MMC_FEATURE_SECTOR_ERASE:
|
||||||
printf("Sector Erasable Feature\n");
|
report( stdout, "Sector Erasable Feature\n" );
|
||||||
break;
|
break;
|
||||||
case CDIO_MMC_FEATURE_FORMATABLE:
|
case CDIO_MMC_FEATURE_FORMATABLE:
|
||||||
printf("Formattable Feature\n");
|
report( stdout, "Formattable Feature\n" );
|
||||||
break;
|
break;
|
||||||
case CDIO_MMC_FEATURE_DEFECT_MGMT:
|
case CDIO_MMC_FEATURE_DEFECT_MGMT:
|
||||||
printf("Management Ability of the Logical Unit/media system "
|
report( stdout,
|
||||||
"to provide an apparently defect-free space.\n");
|
"Management Ability of the Logical Unit/media system "
|
||||||
|
"to provide an apparently defect-free space.\n" );
|
||||||
break;
|
break;
|
||||||
case CDIO_MMC_FEATURE_WRITE_ONCE:
|
case CDIO_MMC_FEATURE_WRITE_ONCE:
|
||||||
printf("Write Once Feature\n");
|
report( stdout, "Write Once Feature\n" );
|
||||||
break;
|
break;
|
||||||
case CDIO_MMC_FEATURE_RESTRICT_OVERW:
|
case CDIO_MMC_FEATURE_RESTRICT_OVERW:
|
||||||
printf("Restricted Overwrite Feature\n");
|
report( stdout, "Restricted Overwrite Feature\n" );
|
||||||
break;
|
break;
|
||||||
case CDIO_MMC_FEATURE_CD_RW_CAV:
|
case CDIO_MMC_FEATURE_CD_RW_CAV:
|
||||||
printf("CD-RW CAV Write Feature\n");
|
report( stdout, "CD-RW CAV Write Feature\n" );
|
||||||
break;
|
break;
|
||||||
case CDIO_MMC_FEATURE_MRW:
|
case CDIO_MMC_FEATURE_MRW:
|
||||||
printf("MRW Feature\n");
|
report( stdout, "MRW Feature\n" );
|
||||||
break;
|
break;
|
||||||
case CDIO_MMC_FEATURE_DVD_PRW:
|
case CDIO_MMC_FEATURE_DVD_PRW:
|
||||||
printf("DVD+RW Feature\n");
|
report( stdout, "DVD+RW Feature\n" );
|
||||||
break;
|
break;
|
||||||
case CDIO_MMC_FEATURE_DVD_PR:
|
case CDIO_MMC_FEATURE_DVD_PR:
|
||||||
printf("DVD+R Feature\n");
|
report( stdout, "DVD+R Feature\n" );
|
||||||
break;
|
break;
|
||||||
case CDIO_MMC_FEATURE_CD_TAO:
|
case CDIO_MMC_FEATURE_CD_TAO:
|
||||||
printf("CD Track at Once Feature\n");
|
report( stdout, "CD Track at Once Feature\n" );
|
||||||
break;
|
break;
|
||||||
case CDIO_MMC_FEATURE_CD_SAO:
|
case CDIO_MMC_FEATURE_CD_SAO:
|
||||||
printf("CD Mastering (Session at Once) Feature\n");
|
report( stdout, "CD Mastering (Session at Once) Feature\n" );
|
||||||
break;
|
break;
|
||||||
case CDIO_MMC_FEATURE_POWER_MGMT:
|
case CDIO_MMC_FEATURE_POWER_MGMT:
|
||||||
printf("Initiator and device directed power management\n");
|
report( stdout,
|
||||||
|
"Initiator and device directed power management\n" );
|
||||||
break;
|
break;
|
||||||
case CDIO_MMC_FEATURE_CDDA_EXT_PLAY:
|
case CDIO_MMC_FEATURE_CDDA_EXT_PLAY:
|
||||||
printf("CD Audio External Play Feature\n");
|
report( stdout, "CD Audio External Play Feature\n" );
|
||||||
printf("\tSCAN command is %ssupported\n",
|
report( stdout, "\tSCAN command is %ssupported\n",
|
||||||
(p[4] & 4) ? "": "not ");
|
(p[4] & 4) ? "": "not ");
|
||||||
printf("\taudio channels can %sbe muted separately\n",
|
report( stdout,
|
||||||
|
"\taudio channels can %sbe muted separately\n",
|
||||||
(p[4] & 2) ? "": "not ");
|
(p[4] & 2) ? "": "not ");
|
||||||
printf("\taudio channels can %shave separate volume levels\n",
|
report( stdout,
|
||||||
|
"\taudio channels can %shave separate volume levels\n",
|
||||||
(p[4] & 1) ? "": "not ");
|
(p[4] & 1) ? "": "not ");
|
||||||
{
|
{
|
||||||
uint8_t *q = p+6;
|
uint8_t *q = p+6;
|
||||||
uint16_t i_vol_levels = CDIO_MMC_GET_LEN16(q);
|
uint16_t i_vol_levels = CDIO_MMC_GET_LEN16(q);
|
||||||
printf("\t%d volume levels can be set\n", i_vol_levels);
|
report( stdout, "\t%d volume levels can be set\n", i_vol_levels );
|
||||||
}
|
}
|
||||||
printf("\n");
|
report( stdout, "\n");
|
||||||
break;
|
break;
|
||||||
case CDIO_MMC_FEATURE_MCODE_UPGRADE:
|
case CDIO_MMC_FEATURE_MCODE_UPGRADE:
|
||||||
printf("Ability for the device to accept new microcode via "
|
report( stdout, "Ability for the device to accept new microcode via "
|
||||||
"the interface\n");
|
"the interface\n" );
|
||||||
break;
|
break;
|
||||||
case CDIO_MMC_FEATURE_TIME_OUT:
|
case CDIO_MMC_FEATURE_TIME_OUT:
|
||||||
printf("Ability to respond to all commands within a "
|
report( stdout, "Ability to respond to all commands within a "
|
||||||
"specific time\n");
|
"specific time\n" );
|
||||||
break;
|
break;
|
||||||
case CDIO_MMC_FEATURE_DVD_CSS:
|
case CDIO_MMC_FEATURE_DVD_CSS:
|
||||||
printf("Ability to perform DVD CSS/CPPM authentication and"
|
report( stdout, "Ability to perform DVD CSS/CPPM authentication and"
|
||||||
" RPC\n");
|
" RPC\n" );
|
||||||
#if 0
|
#if 0
|
||||||
printf("\tMedium does%s have Content Scrambling (CSS/CPPM)\n",
|
report( stdout, "\tMedium does%s have Content Scrambling (CSS/CPPM)\n",
|
||||||
(p[2] & 1) ? "": "not ");
|
(p[2] & 1) ? "": "not " );
|
||||||
#endif
|
#endif
|
||||||
printf("\tCSS version %d\n", p[7]);
|
report( stdout, "\tCSS version %d\n", p[7] );
|
||||||
printf("\t\n");
|
report( stdout, "\t\n");
|
||||||
break;
|
break;
|
||||||
case CDIO_MMC_FEATURE_RT_STREAMING:
|
case CDIO_MMC_FEATURE_RT_STREAMING:
|
||||||
printf("Ability to read and write using Initiator requested performance parameters\n");
|
report( stdout,
|
||||||
|
"Ability to read and write using Initiator requested performance parameters\n");
|
||||||
break;
|
break;
|
||||||
case CDIO_MMC_FEATURE_LU_SN: {
|
case CDIO_MMC_FEATURE_LU_SN: {
|
||||||
uint8_t i_serial = *(p+3);
|
uint8_t i_serial = *(p+3);
|
||||||
char serial[257] = { '\0', };
|
char serial[257] = { '\0', };
|
||||||
|
|
||||||
printf("The Logical Unit has a unique identifier:\n");
|
report( stdout, "The Logical Unit has a unique identifier:\n" );
|
||||||
memcpy(serial, p+4, i_serial);
|
memcpy(serial, p+4, i_serial );
|
||||||
printf("\t%s\n\n", serial);
|
report( stdout, "\t%s\n\n", serial );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
if ( 0 != (i_feature & 0xFF00) ) {
|
if ( 0 != (i_feature & 0xFF00) ) {
|
||||||
printf("Vendor-specific feature code %x\n", i_feature);
|
report( stdout, "Vendor-specific feature code %x\n", i_feature );
|
||||||
} else {
|
} else {
|
||||||
printf("Unknown feature code %x\n", i_feature);
|
report( stdout, "Unknown feature code %x\n", i_feature );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
p += i_feature_additional + 4;
|
p += i_feature_additional + 4;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
printf("Didn't get all feature codes\n");
|
report( stdout, "Didn't get all feature codes\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -383,65 +415,81 @@ print_drive_capabilities(cdio_drive_read_cap_t i_read_cap,
|
|||||||
cdio_drive_misc_cap_t i_misc_cap)
|
cdio_drive_misc_cap_t i_misc_cap)
|
||||||
{
|
{
|
||||||
if (CDIO_DRIVE_CAP_ERROR == i_misc_cap) {
|
if (CDIO_DRIVE_CAP_ERROR == i_misc_cap) {
|
||||||
printf("Error in getting drive hardware properties\n");
|
report( stdout, "Error in getting drive hardware properties\n");
|
||||||
} else if (CDIO_DRIVE_CAP_UNKNOWN == i_misc_cap) {
|
} else if (CDIO_DRIVE_CAP_UNKNOWN == i_misc_cap) {
|
||||||
printf("Uknown drive hardware properties\n");
|
report( stdout, "Uknown drive hardware properties\n");
|
||||||
} else {
|
} else {
|
||||||
printf(_("Hardware : %s\n"),
|
report( stdout, _("Hardware : %s\n"),
|
||||||
i_misc_cap & CDIO_DRIVE_CAP_MISC_FILE
|
i_misc_cap & CDIO_DRIVE_CAP_MISC_FILE
|
||||||
? "Disk Image" : "CD-ROM or DVD");
|
? "Disk Image" : "CD-ROM or DVD");
|
||||||
printf(_("Can eject : %s\n"),
|
report( stdout, _("Can eject : %s\n"),
|
||||||
i_misc_cap & CDIO_DRIVE_CAP_MISC_EJECT ? "Yes" : "No");
|
i_misc_cap & CDIO_DRIVE_CAP_MISC_EJECT ? "Yes" : "No" );
|
||||||
printf(_("Can close tray : %s\n"),
|
report( stdout, _("Can close tray : %s\n"),
|
||||||
i_misc_cap & CDIO_DRIVE_CAP_MISC_CLOSE_TRAY ? "Yes" : "No");
|
i_misc_cap & CDIO_DRIVE_CAP_MISC_CLOSE_TRAY ? "Yes" : "No" );
|
||||||
printf(_("Can disable manual eject : %s\n"),
|
report( stdout, _("Can disable manual eject : %s\n"),
|
||||||
i_misc_cap & CDIO_DRIVE_CAP_MISC_LOCK ? "Yes" : "No");
|
i_misc_cap & CDIO_DRIVE_CAP_MISC_LOCK ? "Yes" : "No" );
|
||||||
printf(_("Can select juke-box disc : %s\n\n"),
|
report( stdout, _("Can select juke-box disc : %s\n\n"),
|
||||||
i_misc_cap & CDIO_DRIVE_CAP_MISC_SELECT_DISC ? "Yes" : "No");
|
i_misc_cap & CDIO_DRIVE_CAP_MISC_SELECT_DISC ? "Yes" : "No" );
|
||||||
|
|
||||||
printf(_("Can set drive speed : %s\n"),
|
report( stdout, _("Can set drive speed : %s\n"),
|
||||||
i_misc_cap & CDIO_DRIVE_CAP_MISC_SELECT_SPEED ? "Yes" : "No");
|
i_misc_cap & CDIO_DRIVE_CAP_MISC_SELECT_SPEED ? "Yes" : "No" );
|
||||||
printf(_("Can detect if CD changed : %s\n"),
|
report( stdout, _("Can detect if CD changed : %s\n"),
|
||||||
i_misc_cap & CDIO_DRIVE_CAP_MISC_MEDIA_CHANGED ? "Yes" : "No");
|
i_misc_cap & CDIO_DRIVE_CAP_MISC_MEDIA_CHANGED ? "Yes" : "No" );
|
||||||
printf(_("Can read multiple sessions : %s\n"),
|
report( stdout, _("Can read multiple sessions : %s\n"),
|
||||||
i_misc_cap & CDIO_DRIVE_CAP_MISC_MULTI_SESSION ? "Yes" : "No");
|
i_misc_cap & CDIO_DRIVE_CAP_MISC_MULTI_SESSION ? "Yes" : "No" );
|
||||||
printf(_("Can hard reset device : %s\n\n"),
|
report( stdout, _("Can hard reset device : %s\n\n"),
|
||||||
i_misc_cap & CDIO_DRIVE_CAP_MISC_RESET ? "Yes" : "No");
|
i_misc_cap & CDIO_DRIVE_CAP_MISC_RESET ? "Yes" : "No" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (CDIO_DRIVE_CAP_ERROR == i_read_cap) {
|
if (CDIO_DRIVE_CAP_ERROR == i_read_cap) {
|
||||||
printf("Error in getting drive reading properties\n");
|
report( stdout, "Error in getting drive reading properties\n" );
|
||||||
} else if (CDIO_DRIVE_CAP_UNKNOWN == i_misc_cap) {
|
} else if (CDIO_DRIVE_CAP_UNKNOWN == i_misc_cap) {
|
||||||
printf("Uknown drive reading properties\n");
|
report( stdout, "Uknown drive reading properties\n" );
|
||||||
} else {
|
} else {
|
||||||
printf("Reading....\n");
|
report( stdout, "Reading....\n");
|
||||||
printf(_(" Can play audio : %s\n"),
|
report( stdout, _(" Can play audio : %s\n"),
|
||||||
i_read_cap & CDIO_DRIVE_CAP_READ_AUDIO ? "Yes" : "No");
|
i_read_cap & CDIO_DRIVE_CAP_READ_AUDIO ? "Yes" : "No" );
|
||||||
printf(_(" Can read CD-R : %s\n"),
|
report( stdout, _(" Can read CD-R : %s\n"),
|
||||||
i_read_cap & CDIO_DRIVE_CAP_READ_CD_R ? "Yes" : "No");
|
i_read_cap & CDIO_DRIVE_CAP_READ_CD_R ? "Yes" : "No" );
|
||||||
printf(_(" Can read CD-RW : %s\n"),
|
report( stdout, _(" Can read CD-RW : %s\n"),
|
||||||
i_read_cap & CDIO_DRIVE_CAP_READ_CD_RW ? "Yes" : "No");
|
i_read_cap & CDIO_DRIVE_CAP_READ_CD_RW ? "Yes" : "No" );
|
||||||
printf(_(" Can read DVD-ROM : %s\n"),
|
report( stdout, _(" Can read DVD-ROM : %s\n"),
|
||||||
i_read_cap & CDIO_DRIVE_CAP_READ_DVD_ROM ? "Yes" : "No");
|
i_read_cap & CDIO_DRIVE_CAP_READ_DVD_ROM ? "Yes" : "No" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (CDIO_DRIVE_CAP_ERROR == i_write_cap) {
|
if (CDIO_DRIVE_CAP_ERROR == i_write_cap) {
|
||||||
printf("Error in getting drive writing properties\n");
|
report( stdout, "Error in getting drive writing properties\n" );
|
||||||
} else if (CDIO_DRIVE_CAP_UNKNOWN == i_misc_cap) {
|
} else if (CDIO_DRIVE_CAP_UNKNOWN == i_misc_cap) {
|
||||||
printf("Uknown drive writing properties\n");
|
report( stdout, "Uknown drive writing properties\n" );
|
||||||
} else {
|
} else {
|
||||||
printf("\nWriting....\n");
|
report( stdout, "\nWriting....\n");
|
||||||
printf(_(" Can write CD-RW : %s\n"),
|
report( stdout, _(" Can write CD-RW : %s\n"),
|
||||||
i_write_cap & CDIO_DRIVE_CAP_WRITE_CD_RW ? "Yes" : "No");
|
i_write_cap & CDIO_DRIVE_CAP_WRITE_CD_RW ? "Yes" : "No" );
|
||||||
printf(_(" Can write DVD-R : %s\n"),
|
report( stdout, _(" Can write DVD-R : %s\n"),
|
||||||
i_write_cap & CDIO_DRIVE_CAP_WRITE_DVD_R ? "Yes" : "No");
|
i_write_cap & CDIO_DRIVE_CAP_WRITE_DVD_R ? "Yes" : "No" );
|
||||||
printf(_(" Can write DVD-RAM : %s\n"),
|
report( stdout, _(" Can write DVD-RAM : %s\n"),
|
||||||
i_write_cap & CDIO_DRIVE_CAP_WRITE_DVD_RAM ? "Yes" : "No");
|
i_write_cap & CDIO_DRIVE_CAP_WRITE_DVD_RAM ? "Yes" : "No" );
|
||||||
printf(_(" Can write DVD-RW : %s\n"),
|
report( stdout, _(" Can write DVD-RW : %s\n"),
|
||||||
i_write_cap & CDIO_DRIVE_CAP_WRITE_DVD_RW ? "Yes" : "No");
|
i_write_cap & CDIO_DRIVE_CAP_WRITE_DVD_RW ? "Yes" : "No" );
|
||||||
printf(_(" Can write DVD+RW : %s\n"),
|
report( stdout, _(" Can write DVD+RW : %s\n"),
|
||||||
i_write_cap & CDIO_DRIVE_CAP_WRITE_DVD_RPW ? "Yes" : "No");
|
i_write_cap & CDIO_DRIVE_CAP_WRITE_DVD_RPW ? "Yes" : "No" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Common place for Output routine. Some environments like XBOX may not
|
||||||
|
stdout and stderr. */
|
||||||
|
void
|
||||||
|
report (FILE *stream, const char *psz_format, ...)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
va_start (args, psz_format);
|
||||||
|
#ifdef _XBOX
|
||||||
|
OutputDebugString(psz_format, args);
|
||||||
|
#else
|
||||||
|
vfprintf (stream, psz_format, args);
|
||||||
|
#endif
|
||||||
|
va_end(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
11
src/util.h
11
src/util.h
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: util.h,v 1.7 2004/08/07 01:48:36 rocky Exp $
|
$Id: util.h,v 1.8 2004/11/04 10:08:23 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
@@ -38,6 +38,11 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_STDARG_H
|
||||||
|
/* Get a definition for va_list. */
|
||||||
|
#include <stdarg.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <popt.h>
|
#include <popt.h>
|
||||||
/* Accomodate to older popt that doesn't support the "optional" flag */
|
/* Accomodate to older popt that doesn't support the "optional" flag */
|
||||||
#ifndef POPT_ARGFLAG_OPTIONAL
|
#ifndef POPT_ARGFLAG_OPTIONAL
|
||||||
@@ -109,4 +114,8 @@ void print_drive_capabilities(cdio_drive_read_cap_t p_read_cap,
|
|||||||
cdio_drive_misc_cap_t p_misc_cap);
|
cdio_drive_misc_cap_t p_misc_cap);
|
||||||
|
|
||||||
|
|
||||||
|
/* Common place for Output routine. Some environments like XBOX may not
|
||||||
|
stdout and stderr. */
|
||||||
|
void report (FILE *stream, const char *psz_format, ...);
|
||||||
|
|
||||||
#endif /* UTIL_H */
|
#endif /* UTIL_H */
|
||||||
|
|||||||
Reference in New Issue
Block a user