Rename many of the "sample" programs to something more descriptive.
libcdio.texi: add a SCSI-MMC example program.
This commit is contained in:
160
doc/libcdio.texi
160
doc/libcdio.texi
@@ -46,7 +46,7 @@ development.''
|
|||||||
|
|
||||||
@titlepage
|
@titlepage
|
||||||
@title GNU libcdio library
|
@title GNU libcdio library
|
||||||
@subtitle $Id: libcdio.texi,v 1.26 2004/08/07 11:27:03 rocky Exp $
|
@subtitle $Id: libcdio.texi,v 1.27 2004/10/10 00:21:08 rocky Exp $
|
||||||
@author Rocky Bernstein et al.
|
@author Rocky Bernstein et al.
|
||||||
@page
|
@page
|
||||||
|
|
||||||
@@ -558,16 +558,17 @@ Other sources for examples would be the larger utility programs
|
|||||||
@menu
|
@menu
|
||||||
* Example 1:: list out tracks and LSNs
|
* Example 1:: list out tracks and LSNs
|
||||||
* Example 2:: list drivers available and default CD device
|
* Example 2:: list drivers available and default CD device
|
||||||
* Example 3:: list out tracks and LSNs
|
* Example 3:: figure out what kind of CD (image) we've got
|
||||||
* Example 4:: use libiso9660 to extract a file from an ISO-9660 image
|
* Example 4:: use libiso9660 to extract a file from an ISO-9660 image
|
||||||
* Example 5:: list CD-Text and CD disc mode info
|
* Example 5:: list CD-Text and CD disc mode info
|
||||||
|
* Example 6:: run a SCSI-MMC INQUIRY command
|
||||||
* All sample programs:: list of all programs in the example directory
|
* All sample programs:: list of all programs in the example directory
|
||||||
@end menu
|
@end menu
|
||||||
|
|
||||||
@node Example 1
|
@node Example 1
|
||||||
@section Example 1: list out tracks and LSNs
|
@section Example 1: list out tracks and LSNs
|
||||||
Here we will give an annotated example which can be found in the
|
Here we will give an annotated example which can be found in the
|
||||||
distribution as @file{example/sample1.c}.
|
distribution as @file{example/tracks.c}.
|
||||||
|
|
||||||
@smallexample
|
@smallexample
|
||||||
1: #include <stdio.h>
|
1: #include <stdio.h>
|
||||||
@@ -685,11 +686,11 @@ device that is right for it.
|
|||||||
|
|
||||||
|
|
||||||
@node Example 3
|
@node Example 3
|
||||||
@section Example 3: figure out what kind of CD image we've got
|
@section Example 3: figure out what kind of CD (image) we've got
|
||||||
|
|
||||||
In this example is a somewhat simplified program to show the use of
|
In this example is a somewhat simplified program to show the use of
|
||||||
@command{cdio_guess_cd_type()} to figure out the kind of CD image
|
@command{cdio_guess_cd_type()} to figure out the kind of CD image
|
||||||
we've got. This can be in the distribution as @file{example/sample3.c}.
|
we've got. This can be found in the distribution as @file{example/sample3.c}.
|
||||||
|
|
||||||
@smallexample
|
@smallexample
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
@@ -875,8 +876,8 @@ main(int argc, const char *argv[])
|
|||||||
@section Example 4: use libiso9660 to extract a file from an ISO-9660 image
|
@section Example 4: use libiso9660 to extract a file from an ISO-9660 image
|
||||||
|
|
||||||
Next a program to show using @command{libiso9660} to extract a file
|
Next a program to show using @command{libiso9660} to extract a file
|
||||||
from an ISO-9660 image. This can be in the distribution as
|
from an ISO-9660 image. This can be found in the distribution as
|
||||||
@file{example/sample7.c}. A more complete and expanded version of this
|
@file{example/iso3.c}. A more complete and expanded version of this
|
||||||
is @command{iso-read}, part of this distribution.
|
is @command{iso-read}, part of this distribution.
|
||||||
|
|
||||||
@smallexample
|
@smallexample
|
||||||
@@ -989,10 +990,10 @@ main(int argc, const char *argv[])
|
|||||||
@section Example 5: list CD-Text and disc mode info
|
@section Example 5: list CD-Text and disc mode info
|
||||||
|
|
||||||
Next a program to show using @command{libcdio} to list CD-TEXT data.
|
Next a program to show using @command{libcdio} to list CD-TEXT data.
|
||||||
This can be in the distribution as @file{example/sample8.c}.
|
This can be found in the distribution as @file{example/cdtext.c}.
|
||||||
|
|
||||||
@smallexample
|
@smallexample
|
||||||
/* Simple program to list CD-TEXT info of a Compact Disc using libcdio. */
|
/* Simple program to list CD-Text info of a Compact Disc using libcdio. */
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -1026,10 +1027,10 @@ print_disc_info(CdIo *p_cdio, track_t i_tracks, track_t i_first_track) @{
|
|||||||
|
|
||||||
printf("%s\n", discmode2str[cd_discmode]);
|
printf("%s\n", discmode2str[cd_discmode]);
|
||||||
|
|
||||||
print_cdtext_track_info(p_cdio, 0, "\nCD-TEXT for Disc:");
|
print_cdtext_track_info(p_cdio, 0, "\nCD-Text for Disc:");
|
||||||
for ( ; i_first_track < i_last_track; i_first_track++ ) @{
|
for ( ; i_first_track < i_last_track; i_first_track++ ) @{
|
||||||
char psz_msg[50];
|
char psz_msg[50];
|
||||||
sprintf(msg, "CD-TEXT for Track %d:", i_first_track);
|
sprintf(msg, "CD-Text for Track %d:", i_first_track);
|
||||||
print_cdtext_track_info(p_cdio, i_first_track, psz_msg);
|
print_cdtext_track_info(p_cdio, i_first_track, psz_msg);
|
||||||
@}
|
@}
|
||||||
@}
|
@}
|
||||||
@@ -1057,6 +1058,80 @@ main(int argc, const char *argv[])
|
|||||||
@}
|
@}
|
||||||
@end smallexample
|
@end smallexample
|
||||||
|
|
||||||
|
@node Example 6
|
||||||
|
@section Example 6: Using SCSI-MMC to run an @code{INQURY} command
|
||||||
|
|
||||||
|
Now a program to show issuing a simple SCSI-MMC command
|
||||||
|
(@code{INQUIRY}). This MMC command retrieves the vendor, model and
|
||||||
|
firmware revision number of a CD drive. For this command to work,
|
||||||
|
usually a CD to be loaded into the drive; odd since the CD itself is
|
||||||
|
not used.
|
||||||
|
|
||||||
|
This can be found in the distribution as @file{example/scsi-mmc1.c}.
|
||||||
|
|
||||||
|
@smallexample
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include "config.h"
|
||||||
|
#endif
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <cdio/cdio.h>
|
||||||
|
#include <cdio/scsi_mmc.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
/* Set how long do wto wait for SCSI-MMC commands to complete */
|
||||||
|
#define DEFAULT_TIMEOUT_MS 10000
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, const char *argv[])
|
||||||
|
@{
|
||||||
|
CdIo *p_cdio;
|
||||||
|
|
||||||
|
p_cdio = cdio_open (NULL, DRIVER_UNKNOWN);
|
||||||
|
|
||||||
|
if (NULL == p_cdio) @{
|
||||||
|
printf("Couldn't find CD\n");
|
||||||
|
return 1;
|
||||||
|
@} else @{
|
||||||
|
int i_status; /* Result of SCSI MMC command */
|
||||||
|
char buf[36] = @{ 0, @}; /* Place to hold returned data */
|
||||||
|
scsi_mmc_cdb_t cdb = @{@{0, @}@}; /* Command Descriptor Block */
|
||||||
|
|
||||||
|
CDIO_MMC_SET_COMMAND(cdb.field, CDIO_MMC_GPCMD_INQUIRY);
|
||||||
|
cdb.field[4] = sizeof(buf);
|
||||||
|
|
||||||
|
i_status = scsi_mmc_run_cmd(p_cdio, DEFAULT_TIMEOUT_MS,
|
||||||
|
&cdb, SCSI_MMC_DATA_READ,
|
||||||
|
sizeof(buf), &buf);
|
||||||
|
if (i_status == 0) @{
|
||||||
|
char psz_vendor[CDIO_MMC_HW_VENDOR_LEN+1];
|
||||||
|
char psz_model[CDIO_MMC_HW_MODEL_LEN+1];
|
||||||
|
char psz_rev[CDIO_MMC_HW_REVISION_LEN+1];
|
||||||
|
|
||||||
|
memcpy(psz_vendor, buf + 8, sizeof(psz_vendor)-1);
|
||||||
|
psz_vendor[sizeof(psz_vendor)-1] = '\0';
|
||||||
|
memcpy(psz_model,
|
||||||
|
buf + 8 + CDIO_MMC_HW_VENDOR_LEN,
|
||||||
|
sizeof(psz_model)-1);
|
||||||
|
psz_model[sizeof(psz_model)-1] = '\0';
|
||||||
|
memcpy(psz_rev,
|
||||||
|
buf + 8 + CDIO_MMC_HW_VENDOR_LEN +CDIO_MMC_HW_MODEL_LEN,
|
||||||
|
sizeof(psz_rev)-1);
|
||||||
|
psz_rev[sizeof(psz_rev)-1] = '\0';
|
||||||
|
|
||||||
|
printf("Vendor: %s\nModel: %s\nRevision: %s\n",
|
||||||
|
psz_vendor, psz_model, psz_rev);
|
||||||
|
@} else @{
|
||||||
|
printf("Couldn't get INQUIRY data (vendor, model, and revision\n");
|
||||||
|
@}
|
||||||
|
@}
|
||||||
|
|
||||||
|
cdio_destroy(p_cdio);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
@}
|
||||||
|
@end smallexample
|
||||||
|
|
||||||
@node All sample programs
|
@node All sample programs
|
||||||
@section A list of all sample progrmas in the @code{example} directory
|
@section A list of all sample progrmas in the @code{example} directory
|
||||||
|
|
||||||
@@ -1071,7 +1146,40 @@ Descriptions of the sample are as follows...
|
|||||||
|
|
||||||
@table @code
|
@table @code
|
||||||
|
|
||||||
@item @code{sample1.c}
|
@item @code{iso1.c}
|
||||||
|
|
||||||
|
A program to show using @code{libiso9660} to list files in a
|
||||||
|
directory of an ISO-9660 image.
|
||||||
|
|
||||||
|
@item @code{iso2.c}
|
||||||
|
|
||||||
|
A program to show using @code{libiso9660} to extract a file from a
|
||||||
|
CDRWIN cue/bin CD image.
|
||||||
|
|
||||||
|
@item @code{iso3.c}
|
||||||
|
|
||||||
|
A program to show using libiso9660 to extract a file from an ISO-9660
|
||||||
|
image.
|
||||||
|
|
||||||
|
@item @code{cdtext.c}
|
||||||
|
|
||||||
|
A program to show CD-Text and CD disc mode info.
|
||||||
|
|
||||||
|
@item @code{drives.c}
|
||||||
|
|
||||||
|
A program to show drivers installed and what the default CD-ROM drive
|
||||||
|
is and what CD drives are available.
|
||||||
|
|
||||||
|
@item @code{scsi-mmc1.c}
|
||||||
|
|
||||||
|
A program to show issuing a simple SCSI-MMC command (@code{INQUIRY}).
|
||||||
|
|
||||||
|
@item @code{scsi-mmc2.c}
|
||||||
|
|
||||||
|
A more involved SCSI-MMC command to list CD and drive features from a
|
||||||
|
SCSI-MMC @code{GET_CONFIGURATION} command.
|
||||||
|
|
||||||
|
@item @code{tracks.c}
|
||||||
|
|
||||||
A simple program to list track numbers and logical sector numbers of a
|
A simple program to list track numbers and logical sector numbers of a
|
||||||
Compact Disc using @value{libcdio}.
|
Compact Disc using @value{libcdio}.
|
||||||
@@ -1091,34 +1199,6 @@ the kind of CD image we've got.
|
|||||||
A slightly improved sample3 program: we handle cdio logging and take
|
A slightly improved sample3 program: we handle cdio logging and take
|
||||||
an optional CD-location.
|
an optional CD-location.
|
||||||
|
|
||||||
@item @code{sample5.c}
|
|
||||||
|
|
||||||
A program to show drivers installed and what the default CD-ROM drive
|
|
||||||
is and what CD drives are available.
|
|
||||||
|
|
||||||
@item @code{sample6.c}
|
|
||||||
|
|
||||||
A simple program to show using @code{libiso9660} to extract a file from a
|
|
||||||
CDRWIN cue/bin CD image.
|
|
||||||
|
|
||||||
@item @code{sample7.c}
|
|
||||||
|
|
||||||
A program to show using libiso9660 to extract a file from an ISO-9660
|
|
||||||
image.
|
|
||||||
|
|
||||||
@item @code{sample8.c}
|
|
||||||
|
|
||||||
A program to show CD-Text and CD disc mode info.
|
|
||||||
|
|
||||||
@item @code{sample9.c}
|
|
||||||
|
|
||||||
A program to show issuing a simple SCSI-MMC command (@code{INQUIRY}).
|
|
||||||
|
|
||||||
@item @code{sample10.c}
|
|
||||||
|
|
||||||
A more involved SCSI-MMC command to list features from a SCSI-MMC
|
|
||||||
@code{GET_CONFIGURATION} command.
|
|
||||||
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
@node Utility Programs
|
@node Utility Programs
|
||||||
|
|||||||
@@ -4,5 +4,10 @@
|
|||||||
Makefile.in
|
Makefile.in
|
||||||
Makefile
|
Makefile
|
||||||
copying
|
copying
|
||||||
|
drives
|
||||||
|
iso?
|
||||||
|
cdtext
|
||||||
sample?
|
sample?
|
||||||
sample??
|
scsi-mmc1
|
||||||
|
scsi-mmc2
|
||||||
|
tracks
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# $Id: Makefile.am,v 1.8 2004/10/09 03:20:28 rocky Exp $
|
# $Id: Makefile.am,v 1.9 2004/10/10 00:21:08 rocky Exp $
|
||||||
#
|
#
|
||||||
# Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
# Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
#
|
#
|
||||||
@@ -20,19 +20,24 @@
|
|||||||
# Things to regression testing
|
# Things to regression testing
|
||||||
####################################################
|
####################################################
|
||||||
#
|
#
|
||||||
noinst_PROGRAMS = sample1 sample2 sample3 sample4 sample5 sample6 \
|
noinst_PROGRAMS = cdtext drives iso1 iso2 iso3 scsi-mmc1 scsi-mmc2 \
|
||||||
sample7 sample8 sample9 sample10 iso1
|
tracks sample2 sample3 sample4
|
||||||
|
|
||||||
INCLUDES = -I$(top_srcdir) $(LIBCDIO_CFLAGS)
|
INCLUDES = -I$(top_srcdir) $(LIBCDIO_CFLAGS)
|
||||||
|
|
||||||
|
cdtext_LDADD = $(LIBCDIO_LIBS)
|
||||||
|
|
||||||
|
drives_LDADD = $(LIBCDIO_LIBS)
|
||||||
|
|
||||||
iso1_LDADD = $(LIBISO9660_LIBS) $(LIBCDIO_LIBS)
|
iso1_LDADD = $(LIBISO9660_LIBS) $(LIBCDIO_LIBS)
|
||||||
sample1_LDADD = $(LIBCDIO_LIBS)
|
iso2_LDADD = $(LIBISO9660_LIBS) $(LIBCDIO_LIBS)
|
||||||
|
iso3_LDADD = $(LIBISO9660_LIBS) $(LIBCDIO_LIBS)
|
||||||
|
|
||||||
|
scsi_mmc1_LDADD = $(LIBCDIO_LIBS)
|
||||||
|
scsi_mmc2_LDADD = $(LIBCDIO_LIBS)
|
||||||
|
|
||||||
sample2_LDADD = $(LIBCDIO_LIBS)
|
sample2_LDADD = $(LIBCDIO_LIBS)
|
||||||
sample3_LDADD = $(LIBCDIO_LIBS)
|
sample3_LDADD = $(LIBCDIO_LIBS)
|
||||||
sample4_LDADD = $(LIBCDIO_LIBS)
|
sample4_LDADD = $(LIBCDIO_LIBS)
|
||||||
sample5_LDADD = $(LIBCDIO_LIBS)
|
|
||||||
sample6_LDADD = $(LIBISO9660_LIBS) $(LIBCDIO_LIBS)
|
tracks_LDADD = $(LIBCDIO_LIBS)
|
||||||
sample7_LDADD = $(LIBISO9660_LIBS) $(LIBCDIO_LIBS)
|
|
||||||
sample8_LDADD = $(LIBCDIO_LIBS)
|
|
||||||
sample9_LDADD = $(LIBCDIO_LIBS)
|
|
||||||
sample10_LDADD = $(LIBCDIO_LIBS)
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
$Id: README,v 1.8 2004/08/07 10:40:29 rocky Exp $
|
$Id: README,v 1.9 2004/10/10 00:21:08 rocky Exp $
|
||||||
|
|
||||||
This directory contains some simple examples of the use of the libcdio
|
This directory contains some simple examples of the use of the libcdio
|
||||||
library.
|
library.
|
||||||
@@ -8,6 +8,22 @@ iso-info and iso-read programs in the src directory.
|
|||||||
|
|
||||||
Descriptions of the programs here are as follows...
|
Descriptions of the programs here are as follows...
|
||||||
|
|
||||||
|
cdtext.c: A program to show CD-Text and CD disc mode info.
|
||||||
|
|
||||||
|
iso1.c: A program to show using libiso9660 to list files in a
|
||||||
|
directory of an ISO-9660 image.
|
||||||
|
|
||||||
|
iso2.c: A simple program to show using libiso9660 to extract a file
|
||||||
|
from a CDRWIN cue/bin CD image.
|
||||||
|
|
||||||
|
iso3.c: A program to show using libiso9660 to extract a file from an
|
||||||
|
ISO-9660 image.
|
||||||
|
|
||||||
|
scsi-mmc1.c: A program to show issuing a simple SCSI-MMC command (INQUIRY).
|
||||||
|
|
||||||
|
scsi-mmc2.c: A more involved SCSI-MMC command to list features from
|
||||||
|
a SCSI GET_CONFIGURATION command.
|
||||||
|
|
||||||
sample1.c: A simple program to list track numbers and logical sector
|
sample1.c: A simple program to list track numbers and logical sector
|
||||||
numbers of a Compact Disc using libcdio.
|
numbers of a Compact Disc using libcdio.
|
||||||
|
|
||||||
@@ -23,17 +39,4 @@ sample4.c: A slightly improved sample3 program: we handle cdio logging
|
|||||||
sample5.c: A program to show drivers installed and what the default
|
sample5.c: A program to show drivers installed and what the default
|
||||||
CD-ROM drive is and what CD drives are available.
|
CD-ROM drive is and what CD drives are available.
|
||||||
|
|
||||||
sample6.c: A simple program to show using libiso9660 to extract a file
|
|
||||||
from a CDRWIN cue/bin CD image.
|
|
||||||
|
|
||||||
sample7.c: A program to show using libiso9660 to extract a file from an
|
|
||||||
ISO-9660 image.
|
|
||||||
|
|
||||||
sample8.c: A program to show CD-Text and CD disc mode info.
|
|
||||||
|
|
||||||
sample9.c: A program to show issuing a simple SCSI-MMC command (INQUIRY).
|
|
||||||
|
|
||||||
sample10.c: A more involved SCSI-MMC command to list features from
|
|
||||||
a SCSI GET_CONFIGURATION command.
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: sample8.c,v 1.12 2004/07/29 05:32:55 rocky Exp $
|
$Id: cdtext.c,v 1.1 2004/10/10 00:21:08 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Simple program to list CD-TEXT info of a Compact Disc using libcdio. */
|
/* Simple program to list CD-Text info of a Compact Disc using libcdio. */
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -52,10 +52,10 @@ print_disc_info(CdIo *p_cdio, track_t i_tracks, track_t i_first_track) {
|
|||||||
|
|
||||||
printf("%s\n", discmode2str[cd_discmode]);
|
printf("%s\n", discmode2str[cd_discmode]);
|
||||||
|
|
||||||
print_cdtext_track_info(p_cdio, 0, "\nCD-TEXT for Disc:");
|
print_cdtext_track_info(p_cdio, 0, "\nCD-Text for Disc:");
|
||||||
for ( ; i_first_track < i_last_track; i_first_track++ ) {
|
for ( ; i_first_track < i_last_track; i_first_track++ ) {
|
||||||
char psz_msg[50];
|
char psz_msg[50];
|
||||||
sprintf(psz_msg, "CD-TEXT for Track %d:", i_first_track);
|
sprintf(psz_msg, "CD-Text for Track %d:", i_first_track);
|
||||||
print_cdtext_track_info(p_cdio, i_first_track, psz_msg);
|
print_cdtext_track_info(p_cdio, i_first_track, psz_msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: sample5.c,v 1.7 2004/08/27 11:32:12 rocky Exp $
|
$Id: drives.c,v 1.1 2004/10/10 00:21:08 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
82
example/iso1.c
Normal file
82
example/iso1.c
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
/*
|
||||||
|
$Id: iso1.c,v 1.1 2004/10/10 00:21:08 rocky Exp $
|
||||||
|
|
||||||
|
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
|
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
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Simple program to show using libiso9660 to list files in a directory of
|
||||||
|
an ISO-9660 image.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* This is the ISO 9660 image. */
|
||||||
|
#define ISO9660_IMAGE_PATH "../"
|
||||||
|
#define ISO9660_IMAGE ISO9660_IMAGE_PATH "test/copying.iso"
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include "config.h"
|
||||||
|
#endif
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <cdio/cdio.h>
|
||||||
|
#include <cdio/iso9660.h>
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_STDLIB_H
|
||||||
|
#include <stdlib.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_STRING_H
|
||||||
|
#include <string.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_SYS_TYPES_H
|
||||||
|
#include <sys/types.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, const char *argv[])
|
||||||
|
{
|
||||||
|
CdioList *entlist;
|
||||||
|
CdioListNode *entnode;
|
||||||
|
|
||||||
|
iso9660_t *p_iso = iso9660_open (ISO9660_IMAGE);
|
||||||
|
|
||||||
|
if (NULL == p_iso) {
|
||||||
|
fprintf(stderr, "Sorry, couldn't open ISO 9660 image %s\n", ISO9660_IMAGE);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
entlist = iso9660_ifs_readdir (p_iso, "/");
|
||||||
|
|
||||||
|
/* Iterate over the list of nodes that iso9660_ifs_readdir gives */
|
||||||
|
|
||||||
|
_CDIO_LIST_FOREACH (entnode, entlist)
|
||||||
|
{
|
||||||
|
char filename[4096];
|
||||||
|
iso9660_stat_t *p_statbuf = _cdio_list_node_data (entnode);
|
||||||
|
iso9660_name_translate(p_statbuf->filename, filename);
|
||||||
|
printf ("/%s\n", filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
_cdio_list_free (entlist, true);
|
||||||
|
|
||||||
|
iso9660_close(p_iso);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: sample6.c,v 1.8 2004/08/27 11:34:44 rocky Exp $
|
$Id: iso2.c,v 1.1 2004/10/10 00:21:08 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: sample7.c,v 1.8 2004/08/27 11:36:45 rocky Exp $
|
$Id: iso3.c,v 1.1 2004/10/10 00:21:08 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: sample9.c,v 1.2 2004/08/27 11:53:38 rocky Exp $
|
$Id: scsi-mmc1.c,v 1.1 2004/10/10 00:21:08 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: sample10.c,v 1.8 2004/08/10 11:58:14 rocky Exp $
|
$Id: scsi-mmc2.c,v 1.1 2004/10/10 00:21:08 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
@@ -18,7 +18,8 @@
|
|||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Simple program to show use of SCSI MMC interface. */
|
/* A program to using the SCSI-MMC interface to list CD and drive features
|
||||||
|
from the MMC GET_CONFIGURATION command . */
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: sample1.c,v 1.6 2004/08/07 10:50:03 rocky Exp $
|
$Id: tracks.c,v 1.1 2004/10/10 00:21:08 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
Reference in New Issue
Block a user