diff options
author | R. Bernstein <rocky@gnu.org> | 2012-09-26 13:36:59 -0400 |
---|---|---|
committer | R. Bernstein <rocky@gnu.org> | 2012-09-26 13:36:59 -0400 |
commit | 74b0b023f4aad4832bdf2e9df3752c5ff2e65dc6 (patch) | |
tree | de19e1e26aaf4148367bbccc2044b1a05350f259 /example | |
parent | 4c5369b7c407666f15beef4b6cacba8d8dfdf397 (diff) |
Add "make check-short" target to run tests without bloated output.
Diffstat (limited to 'example')
-rw-r--r-- | example/Makefile.am | 10 | ||||
-rw-r--r-- | example/README | 16 | ||||
-rw-r--r-- | example/cdchange.c | 2 | ||||
-rw-r--r-- | example/cdtext.c | 16 | ||||
-rw-r--r-- | example/device.c | 49 | ||||
-rw-r--r-- | example/drives.c | 17 | ||||
-rw-r--r-- | example/extract.c | 4 | ||||
-rw-r--r-- | example/isofuzzy.c | 4 | ||||
-rw-r--r-- | example/mmc1.c | 14 | ||||
-rw-r--r-- | example/mmc2.c | 48 | ||||
-rw-r--r-- | example/mmc2a.c | 101 | ||||
-rw-r--r-- | example/mmc3.c | 32 | ||||
-rw-r--r-- | example/sample4.c | 4 |
13 files changed, 172 insertions, 145 deletions
diff --git a/example/Makefile.am b/example/Makefile.am index 2782dfa4..086d694d 100644 --- a/example/Makefile.am +++ b/example/Makefile.am @@ -1,4 +1,4 @@ -# Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 +# Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2012 # Rocky Bernstein <rocky@gnu.org> # # This program is free software: you can redistribute it and/or modify @@ -50,6 +50,14 @@ noinst_PROGRAMS = \ check_PROGRAMS = cdtext device drives \ mmc1 mmc2 mmc2a mmc3 sample4 +#: run regression tests. "test" is the same thing as "check" +test: check-am + +#: Run all tests without bloated output +check-short: + $(MAKE) check 2>&1 | ruby @abs_top_srcdir@/make-check-filter.rb + + INCLUDES = $(LIBCDIO_CFLAGS) audio_DEPENDENCIES = $(LIBCDIO_DEPS) diff --git a/example/README b/example/README index 4a675ba3..6fceee63 100644 --- a/example/README +++ b/example/README @@ -29,6 +29,10 @@ cdio-eject.c: a stripped-down "eject" command to open or close a CDROM cdtext.c: A program to show CD-Text and CD disc mode info. +device.c: A program to show drivers installed and what the default + CD-ROM drive is. See also corresponding C++ programs of similar + names. + discid.c: http://sourceforge.net/projects/discid/ using libcdio: a small program to calculate the disc-ID for audio compact discs. The disc-ID can be used to query info @@ -66,6 +70,9 @@ mmc2.c: A more involved MMC command to list features from mmc2a.c: Show MODE_SENSE page 2A paramaters: CD/DVD Capabilities and Mechanical Status Page +mmc3.c Another simple program to show use of SCSI MMC interface. + Is basically the the libdio scsi_mmc_get_hwinfo() routine. + paranoia: A program to show using CD-DA paranoia (a library for jitter detection and audio-read error correction). This program uses an interface compatible (mostly) with cdparanoia. It looks for @@ -77,9 +84,6 @@ paranoia2: Another program to show using CD-DA paranoia using a more things that otherwise use libcdio such as media players (e.g. for getting CDDB or CD-Text info) -sample2.c: A simple program to show drivers installed and what the - default CD-ROM drive is. - sample3.c: A simple program to show the use of cdio_guess_cd_type(). Figure out the kind of CD image we've got. @@ -95,5 +99,11 @@ udf1.c: A program to show using libudf to list files in a directory of udf2.c: A program to show using libudf to extract a file from an UDF image. +udffile.c A program to show using libudf to extract a file. + Many of the above programs can be compiled in C++. See that directory for C++ examples which include some of the above. + +Some of these programs are also used in testing. When this occurs, +output is prepended with -- so it can be filtered out by Ruby program +make-check-filter.rb when running "make check-short". diff --git a/example/cdchange.c b/example/cdchange.c index 240263b5..f9ffabd8 100644 --- a/example/cdchange.c +++ b/example/cdchange.c @@ -1,5 +1,5 @@ /* - Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 + Copyright (C) 2005-2012 Rocky Bernstein <rocky@gnu.org> This program is free software: you can redistribute it and/or modify diff --git a/example/cdtext.c b/example/cdtext.c index 82699e78..edd9ffd0 100644 --- a/example/cdtext.c +++ b/example/cdtext.c @@ -39,7 +39,7 @@ print_cdtext_track_info(cdtext_t *cdtext, track_t i_track) { for (i=0; i < MAX_CDTEXT_FIELDS; i++) { if (cdtext_get_const(cdtext, i, i_track)) { - printf("\t%s: %s\n", cdtext_field2str(i), + printf("-- \t%s: %s\n", cdtext_field2str(i), cdtext_get_const(cdtext, i, i_track)); } } @@ -55,11 +55,11 @@ print_disc_info(CdIo_t *p_cdio) { cdtext_t *cdtext = cdio_get_cdtext (p_cdio); int i; - printf("Discmode: %s\n\n", discmode2str[cd_discmode]); + printf("-- Discmode: %s\n\n", discmode2str[cd_discmode]); if (NULL == cdtext) { - printf("No CD-Text found on Disc.\n"); + printf("-- No CD-Text found on Disc.\n"); return; } @@ -67,7 +67,7 @@ print_disc_info(CdIo_t *p_cdio) { { cdtext_lang_t *languages; - printf("CD-Text available in: "); + printf("-- CD-Text available in: "); languages = cdtext_list_languages(cdtext); for(i=0; i<8; i++) @@ -78,18 +78,18 @@ print_disc_info(CdIo_t *p_cdio) { /* select language */ if(cdtext_select_language(cdtext, EXAMPLE_PREF_LANG)) { - printf("%s selected.\n", cdtext_lang2str (EXAMPLE_PREF_LANG)); + printf("-- %s selected.\n", cdtext_lang2str (EXAMPLE_PREF_LANG)); } else { - printf("'%s' is not available. Using '%s'\n", + printf("-- '%s' is not available. Using '%s'\n", cdtext_lang2str (EXAMPLE_PREF_LANG), cdtext_lang2str (cdtext_get_language (cdtext))); } /* print cd-text */ - printf("CD-Text for Disc:\n"); + printf("-- CD-Text for Disc:\n"); print_cdtext_track_info(cdtext, 0); for (i=i_first_track ; i < i_last_track; i++ ) { - printf("CD-Text for Track %d:\n", i); + printf("-- CD-Text for Track %d:\n", i); print_cdtext_track_info(cdtext, i); } } diff --git a/example/device.c b/example/device.c index 0fd005ea..afc3b83a 100644 --- a/example/device.c +++ b/example/device.c @@ -1,5 +1,6 @@ /* - Copyright (C) 2003, 2004, 2005, 2008, 2009 Rocky Bernstein <rocky@gnu.org> + Copyright (C) 2003, 2004, 2005, 2008, 2009, 2012 + Rocky Bernstein <rocky@gnu.org> 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 @@ -46,25 +47,25 @@ print_drive_capabilities(cdio_drive_read_cap_t i_read_cap, if (CDIO_DRIVE_CAP_ERROR == i_misc_cap) { printf("Error in getting drive hardware properties\n"); } else { - printf(_("Hardware : %s\n"), + printf(_("-- Hardware : %s\n"), i_misc_cap & CDIO_DRIVE_CAP_MISC_FILE ? "Disk Image" : "CD-ROM or DVD"); - printf(_("Can eject : %s\n"), + printf(_("-- Can eject : %s\n"), i_misc_cap & CDIO_DRIVE_CAP_MISC_EJECT ? "Yes" : "No"); - printf(_("Can close tray : %s\n"), + printf(_("-- Can close tray : %s\n"), i_misc_cap & CDIO_DRIVE_CAP_MISC_CLOSE_TRAY ? "Yes" : "No"); - printf(_("Can disable manual eject : %s\n"), + printf(_("-- Can disable manual eject : %s\n"), i_misc_cap & CDIO_DRIVE_CAP_MISC_LOCK ? "Yes" : "No"); - printf(_("Can select juke-box disc : %s\n\n"), + printf(_("-- Can select juke-box disc : %s\n\n"), i_misc_cap & CDIO_DRIVE_CAP_MISC_SELECT_DISC ? "Yes" : "No"); - printf(_("Can set drive speed : %s\n"), + printf(_("-- Can set drive speed : %s\n"), i_misc_cap & CDIO_DRIVE_CAP_MISC_SELECT_SPEED ? "Yes" : "No"); - printf(_("Can detect if CD changed : %s\n"), + printf(_("-- Can detect if CD changed : %s\n"), i_misc_cap & CDIO_DRIVE_CAP_MISC_MEDIA_CHANGED ? "Yes" : "No"); - printf(_("Can read multiple sessions : %s\n"), + printf(_("-- Can read multiple sessions : %s\n"), i_misc_cap & CDIO_DRIVE_CAP_MISC_MULTI_SESSION ? "Yes" : "No"); - printf(_("Can hard reset device : %s\n\n"), + printf(_("-- Can hard reset device : %s\n\n"), i_misc_cap & CDIO_DRIVE_CAP_MISC_RESET ? "Yes" : "No"); } @@ -72,14 +73,14 @@ print_drive_capabilities(cdio_drive_read_cap_t i_read_cap, if (CDIO_DRIVE_CAP_ERROR == i_read_cap) { printf("Error in getting drive reading properties\n"); } else { - printf("Reading....\n"); - printf(_(" Can play audio : %s\n"), + printf("-- Reading....\n"); + printf(_("-- Can play audio : %s\n"), i_read_cap & CDIO_DRIVE_CAP_READ_AUDIO ? "Yes" : "No"); - printf(_(" Can read CD-R : %s\n"), + printf(_("-- Can read CD-R : %s\n"), i_read_cap & CDIO_DRIVE_CAP_READ_CD_R ? "Yes" : "No"); - printf(_(" Can read CD-RW : %s\n"), + printf(_("-- Can read CD-RW : %s\n"), i_read_cap & CDIO_DRIVE_CAP_READ_CD_RW ? "Yes" : "No"); - printf(_(" Can read DVD-ROM : %s\n"), + printf(_("-- Can read DVD-ROM : %s\n"), i_read_cap & CDIO_DRIVE_CAP_READ_DVD_ROM ? "Yes" : "No"); } @@ -87,12 +88,12 @@ print_drive_capabilities(cdio_drive_read_cap_t i_read_cap, if (CDIO_DRIVE_CAP_ERROR == i_write_cap) { printf("Error in getting drive writing properties\n"); } else { - printf("\nWriting....\n"); - printf(_(" Can write CD-RW : %s\n"), + printf("\n-- Writing....\n"); + printf(_("-- Can write CD-RW : %s\n"), i_read_cap & CDIO_DRIVE_CAP_READ_CD_RW ? "Yes" : "No"); - printf(_(" Can write DVD-R : %s\n"), + printf(_("-- Can write DVD-R : %s\n"), i_write_cap & CDIO_DRIVE_CAP_READ_DVD_R ? "Yes" : "No"); - printf(_(" Can write DVD-RAM : %s\n"), + printf(_("-- Can write DVD-RAM : %s\n"), i_write_cap & CDIO_DRIVE_CAP_READ_DVD_RAM ? "Yes" : "No"); } } @@ -108,10 +109,10 @@ main(int argc, const char *argv[]) cdio_drive_write_cap_t i_write_cap; cdio_drive_misc_cap_t i_misc_cap; - 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)); if (default_device) - printf("The default device for this driver is %s\n", default_device); + printf("-- The default device for this driver is %s\n", default_device); cdio_get_drive_cap(p_cdio, &i_read_cap, &i_write_cap, &i_misc_cap); print_drive_capabilities(i_read_cap, i_write_cap, i_misc_cap); @@ -121,16 +122,16 @@ main(int argc, const char *argv[]) printf("\n"); } else { - printf("Problem in trying to find a driver.\n\n"); + printf("-- Problem in trying to find a driver.\n\n"); } { const driver_id_t *driver_id_p; for (driver_id_p=cdio_drivers; *driver_id_p!=DRIVER_UNKNOWN; driver_id_p++) if (cdio_have_driver(*driver_id_p)) - printf("We have: %s\n", cdio_driver_describe(*driver_id_p)); + printf("-- We have: %s\n", cdio_driver_describe(*driver_id_p)); else - printf("We don't have: %s\n", cdio_driver_describe(*driver_id_p)); + printf("-- We don't have: %s\n", cdio_driver_describe(*driver_id_p)); } return 0; } diff --git a/example/drives.c b/example/drives.c index b28d2797..cfa9722d 100644 --- a/example/drives.c +++ b/example/drives.c @@ -1,5 +1,6 @@ /* - Copyright (C) 2003, 2004, 2006, 2008, 2009 Rocky Bernstein <rocky@gnu.org> + Copyright (C) 2003, 2004, 2006, 2008, 2009, 2012 + Rocky Bernstein <rocky@gnu.org> 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 @@ -52,11 +53,11 @@ static void print_drive_class(const char *psz_msg, cdio_fs_anal_t bitmask, bool b_any) { char **ppsz_cd_drives=NULL, **c; - printf("%s...\n", psz_msg); + printf("-- %s...\n", psz_msg); ppsz_cd_drives = cdio_get_devices_with_cap(NULL, bitmask, b_any); if (NULL != ppsz_cd_drives) for( c = ppsz_cd_drives; *c != NULL; c++ ) { - printf("Drive %s\n", *c); + printf("-- Drive %s\n", *c); } cdio_free_device_list(ppsz_cd_drives); @@ -74,7 +75,7 @@ main(int argc, const char *argv[]) ppsz_cd_drives = cdio_get_devices(DRIVER_DEVICE); if (NULL != ppsz_cd_drives) for( c = ppsz_cd_drives; *c != NULL; c++ ) { - printf("Drive %s\n", *c); + printf("-- Drive %s\n", *c); } cdio_free_device_list(ppsz_cd_drives); @@ -83,12 +84,12 @@ main(int argc, const char *argv[]) printf("-----\n"); /* Print out a list of CD-drives the harder way. */ - print_drive_class("All CD-ROM drives (again)", CDIO_FS_MATCH_ALL, false); - print_drive_class("CD-ROM drives with a CD-DA loaded...", + print_drive_class("-- All CD-ROM drives (again)", CDIO_FS_MATCH_ALL, false); + print_drive_class("-- CD-ROM drives with a CD-DA loaded...", CDIO_FS_AUDIO, false); - print_drive_class("CD-ROM drives with some sort of ISO 9660 filesystem...", + print_drive_class("-- CD-ROM drives with some sort of ISO 9660 filesystem...", CDIO_FS_ANAL_ISO9660_ANY, true); - print_drive_class("(S)VCD drives...", CDIO_FS_ANAL_VCD_ANY, true); + print_drive_class("-- (S)VCD drives...", CDIO_FS_ANAL_VCD_ANY, true); return 0; } diff --git a/example/extract.c b/example/extract.c index dd6164e0..22229e40 100644 --- a/example/extract.c +++ b/example/extract.c @@ -112,7 +112,7 @@ static int udf_extract_files(udf_t *p_udf, udf_dirent_t *p_udf_dirent, const cha if (i_length < 0) { goto out; } - printf("Extracting: %s\n", psz_fullpath); + printf("-- Extracting: %s\n", psz_fullpath); if (udf_is_dir(p_udf_dirent)) { _mkdir(psz_fullpath); p_udf_dirent2 = udf_opendir(p_udf_dirent); @@ -256,7 +256,7 @@ int main(int argc, char** argv) psz_extract_dir = argv[2]; if (_mkdir(psz_extract_dir) == 0) { - printf("Creating directory: %s\n", psz_extract_dir); + printf("-- Creating directory: %s\n", psz_extract_dir); } else if (errno != EEXIST) { fprintf(stderr, "Unable to create extraction directory %s\n", psz_extract_dir); return 1; diff --git a/example/isofuzzy.c b/example/isofuzzy.c index 138e1fcf..cffe9b3e 100644 --- a/example/isofuzzy.c +++ b/example/isofuzzy.c @@ -68,7 +68,7 @@ main(int argc, const char *argv[]) p_iso = iso9660_open_fuzzy (psz_fname, 5); if (NULL == p_iso) { - fprintf(stderr, "Sorry, could not find an ISO 9660 image from %s\n", + fprintf(stderr, "-- Sorry, could not find an ISO 9660 image from %s\n", psz_fname); return 1; } @@ -84,7 +84,7 @@ main(int argc, const char *argv[]) iso9660_stat_t *p_statbuf = (iso9660_stat_t *) _cdio_list_node_data (entnode); iso9660_name_translate(p_statbuf->filename, filename); - printf ("/%s\n", filename); + printf ("-- /%s\n", filename); } _cdio_list_free (entlist, true); diff --git a/example/mmc1.c b/example/mmc1.c index 08bfddc8..29991e78 100644 --- a/example/mmc1.c +++ b/example/mmc1.c @@ -1,5 +1,5 @@ /* - Copyright (C) 2004, 2005, 2008, 2009, 2010, 2011 + Copyright (C) 2004, 2005, 2008, 2009, 2010, 2011, 2012 Rocky Bernstein <rocky@gnu.org> This program is free software: you can redistribute it and/or modify @@ -53,7 +53,7 @@ main(int argc, const char *argv[]) p_cdio = cdio_open (psz_drive, DRIVER_UNKNOWN); if (!p_cdio) { - printf("Couldn't find CD\n"); + printf("-- Couldn't find CD\n"); return 77; } else { int i_status; /* Result of MMC command */ @@ -81,10 +81,10 @@ main(int argc, const char *argv[]) sizeof(psz_rev)-1); psz_rev[sizeof(psz_rev)-1] = '\0'; - printf("Vendor: %s\nModel: %s\nRevision: %s\n", + printf("-- Vendor: %s\n-- Model: %s\n-- Revision: %s\n", psz_vendor, psz_model, psz_rev); } else { - printf("Couldn't get INQUIRY data (vendor, model, and revision).\n"); + printf("-- Couldn't get INQUIRY data (vendor, model, and revision).\n"); } { @@ -94,13 +94,13 @@ main(int argc, const char *argv[]) i_status = mmc_get_disc_erasable(p_cdio, &b_erasable); cdio_mmc_feature_profile_t disctype; if (DRIVER_OP_SUCCESS == i_status) - printf("Disc is %serasable.\n", b_erasable ? "" : "not "); + printf("-- Disc is %serasable.\n", b_erasable ? "" : "not "); else - printf("Can't determine if disc is erasable.\n"); + printf("-- Can't determine if disc is erasable.\n"); i_status = mmc_get_disctype(p_cdio, 0, &disctype); if (DRIVER_OP_SUCCESS == i_status) { - printf("disc type: profile is %s (0x%X)\n", + printf("-- disc type: profile is %s (0x%X)\n", mmc_feature_profile2str(disctype), disctype); } diff --git a/example/mmc2.c b/example/mmc2.c index e98cd0fd..f950b020 100644 --- a/example/mmc2.c +++ b/example/mmc2.c @@ -1,5 +1,5 @@ /* - Copyright (C) 2004, 2005, 2008, 2009 Rocky Bernstein <rocky@gnu.org> + Copyright (C) 2004, 2005, 2008, 2009, 2012 Rocky Bernstein <rocky@gnu.org> 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 @@ -46,7 +46,7 @@ main(int argc, const char *argv[]) p_cdio = cdio_open (psz_drive, DRIVER_DEVICE); if (NULL == p_cdio) { - printf("Couldn't find CD\n"); + printf("-- Couldn't find CD\n"); return 77; } else { int i_status; /* Result of MMC command */ @@ -76,7 +76,7 @@ main(int argc, const char *argv[]) { uint8_t *q; const char *feature_str = mmc_feature2str(i_feature); - printf("%s Feature\n", feature_str); + printf("-- %s Feature\n", feature_str); switch( i_feature ) { case CDIO_MMC_FEATURE_PROFILE_LIST: @@ -84,7 +84,7 @@ main(int argc, const char *argv[]) int i_profile=CDIO_MMC_GET_LEN16(q); const char *feature_profile_str = mmc_feature_profile2str(i_profile); - printf( "\t%s", feature_profile_str ); + printf( "-- \t%s", feature_profile_str ); if (q[2] & 1) { printf(" - on"); } @@ -99,22 +99,22 @@ main(int argc, const char *argv[]) uint32_t i_interface_standard = CDIO_MMC_GET_LEN32(q); switch(i_interface_standard) { case 0: - printf("\tunspecified interface.\n"); + printf("-- \tunspecified interface.\n"); break; case 1: - printf("\tSCSI interface.\n"); + printf("-- \tSCSI interface.\n"); break; case 2: - printf("\tATAPI interface.\n"); + printf("-- \tATAPI interface.\n"); break; case 3: - printf("\tIEEE 1394 interface.\n"); + printf("-- \tIEEE 1394 interface.\n"); break; case 4: - printf("\tIEEE 1394A interface.\n"); + printf("-- \tIEEE 1394A interface.\n"); break; case 5: - printf("\tFibre Channel interface.\n"); + printf("-- \tFibre Channel interface.\n"); } printf("\n"); break; @@ -122,36 +122,36 @@ main(int argc, const char *argv[]) case CDIO_MMC_FEATURE_REMOVABLE_MEDIUM: switch(p[4] >> 5) { case 0: - printf("\tCaddy/Slot type loading mechanism,\n"); + printf("-- \tCaddy/Slot type loading mechanism,\n"); break; case 1: - printf("\tTray type loading mechanism,\n"); + printf("-- \tTray type loading mechanism,\n"); break; case 2: - printf("\tPop-up type loading mechanism,\n"); + printf("-- \tPop-up type loading mechanism,\n"); break; case 4: - printf("\tEmbedded changer with individually changeable discs,\n"); + printf("-- \tEmbedded changer with individually changeable discs,\n"); break; case 5: - printf("\tEmbedded changer using a magazine mechanism,\n"); + printf("-- \tEmbedded changer using a magazine mechanism,\n"); break; default: - printf("\tUnknown changer mechanism,\n"); + printf("-- \tUnknown changer mechanism,\n"); } - printf("\tcan%s eject the medium or magazine via the normal " + printf("-- \tcan%s eject the medium or magazine via the normal " "START/STOP command,\n", (p[4] & 8) ? "": "not"); - printf("\tcan%s be locked into the Logical Unit.\n", + printf("-- \tcan%s be locked into the Logical Unit.\n", (p[4] & 1) ? "": "not"); printf("\n"); break; case CDIO_MMC_FEATURE_CD_READ: - printf("CD Read Feature\n"); - printf("\tC2 Error pointers are %ssupported,\n", + printf("-- CD Read Feature\n"); + printf("-- \tC2 Error pointers are %ssupported,\n", (p[4] & 2) ? "": "not "); - printf("\tCD-Text is %ssupported.\n", + printf("-- \tCD-Text is %ssupported.\n", (p[4] & 1) ? "": "not "); printf("\n"); break; @@ -184,14 +184,14 @@ main(int argc, const char *argv[]) } } } else { - printf("Didn't get all feature codes.\n"); + printf("-- Didn't get all feature codes.\n"); } } if (mmc_have_interface(p_cdio, CDIO_MMC_FEATURE_INTERFACE_ATAPI)) - printf("CD-ROM is an ATAPI interface.\n"); + printf("-- CD-ROM is an ATAPI interface.\n"); else - printf("CD-ROM is not an ATAPI interface.\n"); + printf("-- CD-ROM is not an ATAPI interface.\n"); cdio_destroy(p_cdio); diff --git a/example/mmc2a.c b/example/mmc2a.c index b90a87be..88f184f6 100644 --- a/example/mmc2a.c +++ b/example/mmc2a.c @@ -1,5 +1,5 @@ /* - Copyright (C) 2006, 2008, 2009, 2010, 2011 + Copyright (C) 2006, 2008-2012 Rocky Bernstein <rocky@gnu.org> This program is free software: you can redistribute it and/or modify @@ -47,105 +47,105 @@ static void print_mode_sense (const char *psz_drive, const char *six_or_ten, const uint8_t buf[30]) { - printf("Mode sense %s information for %s:\n", six_or_ten, psz_drive); + printf("-- Mode sense %s information for %s:\n", six_or_ten, psz_drive); if (buf[2] & 0x01) { - printf("\tReads CD-R media.\n"); + printf("-- \tReads CD-R media.\n"); } if (buf[2] & 0x02) { - printf("\tReads CD-RW media.\n"); + printf("-- \tReads CD-RW media.\n"); } if (buf[2] & 0x04) { - printf("\tReads fixed-packet tracks when Addressing type is method 2.\n"); + printf("-- \tReads fixed-packet tracks when Addressing type is method 2.\n"); } if (buf[2] & 0x08) { - printf("\tReads DVD ROM media.\n"); + printf("-- \tReads DVD ROM media.\n"); } if (buf[2] & 0x10) { - printf("\tReads DVD-R media.\n"); + printf("-- \tReads DVD-R media.\n"); } if (buf[2] & 0x20) { - printf("\tReads DVD-RAM media.\n"); + printf("-- \tReads DVD-RAM media.\n"); } if (buf[2] & 0x40) { - printf("\tReads DVD-RAM media.\n"); + printf("-- \tReads DVD-RAM media.\n"); } if (buf[3] & 0x01) { - printf("\tWrites CD-R media.\n"); + printf("-- \tWrites CD-R media.\n"); } if (buf[3] & 0x02) { - printf("\tWrites CD-RW media.\n"); + printf("-- \tWrites CD-RW media.\n"); } if (buf[3] & 0x04) { - printf("\tSupports emulation write.\n"); + printf("-- \tSupports emulation write.\n"); } if (buf[3] & 0x10) { - printf("\tWrites DVD-R media.\n"); + printf("-- \tWrites DVD-R media.\n"); } if (buf[3] & 0x20) { - printf("\tWrites DVD-RAM media.\n"); + printf("-- \tWrites DVD-RAM media.\n"); } if (buf[4] & 0x01) { - printf("\tCan play audio.\n"); + printf("-- \tCan play audio.\n"); } if (buf[4] & 0x02) { - printf("\tDelivers composition A/V stream.\n"); + printf("-- \tDelivers composition A/V stream.\n"); } if (buf[4] & 0x04) { - printf("\tSupports digital output on port 2.\n"); + printf("-- \tSupports digital output on port 2.\n"); } if (buf[4] & 0x08) { - printf("\tSupports digital output on port 1.\n"); + printf("-- \tSupports digital output on port 1.\n"); } if (buf[4] & 0x10) { - printf("\tReads Mode-2 form 1 (e.g. XA) media.\n"); + printf("-- \tReads Mode-2 form 1 (e.g. XA) media.\n"); } if (buf[4] & 0x20) { - printf("\tReads Mode-2 form 2 media.\n"); + printf("-- \tReads Mode-2 form 2 media.\n"); } if (buf[4] & 0x40) { - printf("\tReads multi-session CD media.\n"); + printf("-- \tReads multi-session CD media.\n"); } if (buf[4] & 0x80) { - printf("\tSupports Buffer under-run free recording on CD-R/RW media.\n"); + printf("-- \tSupports Buffer under-run free recording on CD-R/RW media.\n"); } if (buf[4] & 0x01) { - printf("\tCan read audio data with READ CD.\n"); + printf("-- \tCan read audio data with READ CD.\n"); } if (buf[4] & 0x02) { - printf("\tREAD CD data stream is accurate.\n"); + printf("-- \tREAD CD data stream is accurate.\n"); } if (buf[5] & 0x04) { - printf("\tReads R-W subchannel information.\n"); + printf("-- \tReads R-W subchannel information.\n"); } if (buf[5] & 0x08) { - printf("\tReads de-interleaved R-W subchannel.\n"); + printf("-- \tReads de-interleaved R-W subchannel.\n"); } if (buf[5] & 0x10) { printf("\tSupports C2 error pointers.\n"); } if (buf[5] & 0x20) { - printf("\tReads ISRC information.\n"); + printf("-- \tReads ISRC information.\n"); } if (buf[5] & 0x40) { - printf("\tReads ISRC informaton.\n"); + printf("-- \tReads ISRC informaton.\n"); } if (buf[5] & 0x40) { - printf("\tReads media catalog number (MCN also known as UPC).\n"); + printf("-- \tReads media catalog number (MCN also known as UPC).\n"); } if (buf[5] & 0x80) { - printf("\tReads bar codes.\n"); + printf("-- \tReads bar codes.\n"); } if (buf[6] & 0x01) { printf("\tPREVENT/ALLOW may lock media.\n"); } - printf("\tLock state is %slocked.\n", (buf[6] & 0x02) ? "" : "un"); - printf("\tPREVENT/ALLOW jumper is %spresent.\n", (buf[6] & 0x04) ? "": "not "); + printf("-- \tLock state is %slocked.\n", (buf[6] & 0x02) ? "" : "un"); + printf("-- \tPREVENT/ALLOW jumper is %spresent.\n", (buf[6] & 0x04) ? "": "not "); if (buf[6] & 0x08) { - printf("\tEjects media with START STOP UNIT.\n"); + printf("-- \tEjects media with START STOP UNIT.\n"); } { const unsigned int i_load_type = (buf[6]>>5 & 0x07); - printf("\tLoading mechanism type is %d: ", i_load_type); + printf("-- \tLoading mechanism type is %d: ", i_load_type); switch (buf[6]>>5 & 0x07) { case 0: printf("caddy type loading mechanism.\n"); @@ -175,30 +175,35 @@ print_mode_sense (const char *psz_drive, const char *six_or_ten, } if (buf[7] & 0x01) { - printf("\tVolume controls each channel separately.\n"); + printf("-- \tVolume controls each channel separately.\n"); } if (buf[7] & 0x02) { - printf("\tHas a changer that supports disc present reporting.\n"); + printf("-- \tHas a changer that supports disc present reporting.\n"); } if (buf[7] & 0x04) { - printf("\tCan load empty slot in changer.\n"); + printf("-- \tCan load empty slot in changer.\n"); } if (buf[7] & 0x08) { - printf("\tSide change capable.\n"); + printf("-- \tSide change capable.\n"); } if (buf[7] & 0x10) { - printf("\tReads raw R-W subchannel information from lead in.\n"); + printf("-- \tReads raw R-W subchannel information from lead in.\n"); } { const unsigned int i_speed_Kbs = CDIO_MMC_GETPOS_LEN16(buf, 8); - printf("\tMaximum read speed is %d K bytes/sec (about %dX)\n", + printf("-- \tMaximum read speed is %d K bytes/sec (about %dX)\n", i_speed_Kbs, i_speed_Kbs / 176) ; } - printf("\tNumber of Volume levels is %d\n", CDIO_MMC_GETPOS_LEN16(buf, 10)); - printf("\tBuffers size for data is %d KB\n", CDIO_MMC_GETPOS_LEN16(buf, 12)); - printf("\tCurrent read speed is %d KB\n", CDIO_MMC_GETPOS_LEN16(buf, 14)); - printf("\tMaximum write speed is %d KB\n", CDIO_MMC_GETPOS_LEN16(buf, 18)); - printf("\tCurrent write speed is %d KB\n", CDIO_MMC_GETPOS_LEN16(buf, 28)); + printf("-- \tNumber of Volume levels is %d\n", + CDIO_MMC_GETPOS_LEN16(buf, 10)); + printf("-- \tBuffers size for data is %d KB\n", + CDIO_MMC_GETPOS_LEN16(buf, 12)); + printf("-- \tCurrent read speed is %d KB\n", + CDIO_MMC_GETPOS_LEN16(buf, 14)); + printf("-- \tMaximum write speed is %d KB\n", + CDIO_MMC_GETPOS_LEN16(buf, 18)); + printf("-- \tCurrent write speed is %d KB\n", + CDIO_MMC_GETPOS_LEN16(buf, 28)); } @@ -212,7 +217,7 @@ main(int argc, const char *argv[]) p_cdio = cdio_open (psz_drive, DRIVER_UNKNOWN); if (!p_cdio) { - printf("Couldn't find CD\n"); + printf("-- Couldn't find CD\n"); return 77; } else { uint8_t buf[30] = { 0, }; /* Place to hold returned data */ @@ -221,13 +226,13 @@ main(int argc, const char *argv[]) CDIO_MMC_CAPABILITIES_PAGE) ) { print_mode_sense(psz_cd, "6", buf); } else { - printf("Couldn't get MODE_SENSE 6 data.\n"); + printf("-- Couldn't get MODE_SENSE 6 data.\n"); } if (DRIVER_OP_SUCCESS == mmc_mode_sense_10(p_cdio, buf, sizeof(buf), CDIO_MMC_CAPABILITIES_PAGE) ) { print_mode_sense(psz_cd, "10", buf); } else { - printf("Couldn't get MODE_SENSE 10 data.\n"); + printf("-- Couldn't get MODE_SENSE 10 data.\n"); } free(psz_cd); } diff --git a/example/mmc3.c b/example/mmc3.c index 033593ad..66a5184d 100644 --- a/example/mmc3.c +++ b/example/mmc3.c @@ -15,8 +15,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* Simple program to show use of SCSI MMC interface. Is basically the - the libdio scsi_mmc_get_hwinfo() routine. +/* Another simple program to show use of SCSI MMC interface. Is + basically the the libdio scsi_mmc_get_hwinfo() routine. */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -58,29 +58,29 @@ main(int argc, const char *argv[]) if (!psz_drive) { psz_drive = cdio_get_default_device_driver(&driver_id); if (!psz_drive) { - printf("Can't find a CD-ROM\n"); + printf("-- Can't find a CD-ROM\n"); exit(77); } } p_cdio = cdio_open (psz_drive, driver_id); if (!p_cdio) { - printf("Can't open %s\n", psz_drive); + printf("-- Can't open %s\n", psz_drive); exit(77); } ret = mmc_get_tray_status(p_cdio); switch((int) ret) { case 0: - printf("CD-ROM drive %s is closed.\n", psz_drive); + printf("-- CD-ROM drive %s is closed.\n", psz_drive); do_eject = true; do_close = true; break; case 1: - printf("CD-ROM drive %s is open.\n", psz_drive); + printf("-- CD-ROM drive %s is open.\n", psz_drive); break; default: - printf("Error status for drive %s: %s.\n", psz_drive, + printf("-- Error status for drive %s: %s.\n", psz_drive, cdio_driver_errmsg(ret)); return 77; } @@ -88,13 +88,14 @@ main(int argc, const char *argv[]) ret = mmc_get_media_changed(p_cdio); switch((int) ret) { case 0: - printf("CD-ROM drive %s media not changed since last test.\n", psz_drive); + printf("-- CD-ROM drive %s media not changed since last test.\n", + psz_drive); break; case 1: - printf("CD-ROM drive %s media changed since last test.\n", psz_drive); + printf("-- CD-ROM drive %s media changed since last test.\n", psz_drive); break; default: - printf("Error status for drive %s: %s.\n", psz_drive, + printf("-- Error status for drive %s: %s.\n", psz_drive, cdio_driver_errmsg(ret)); return 77; } @@ -107,10 +108,10 @@ main(int argc, const char *argv[]) ret = mmc_get_tray_status(p_cdio); switch((int) ret) { case 0: - printf("CD-ROM drive %s is closed.\n", psz_drive); + printf("-- CD-ROM drive %s is closed.\n", psz_drive); break; case 1: - printf("CD-ROM drive %s is open.\n", psz_drive); + printf("-- CD-ROM drive %s is open.\n", psz_drive); break; default: printf("Error status for drive %s: %s.\n", psz_drive, @@ -121,13 +122,14 @@ main(int argc, const char *argv[]) ret = mmc_get_media_changed(p_cdio); switch((int) ret) { case 0: - printf("CD-ROM drive %s media not changed since last test.\n", psz_drive); + printf("-- CD-ROM drive %s media not changed since last test.\n", + psz_drive); break; case 1: - printf("CD-ROM drive %s media changed since last test.\n", psz_drive); + printf("-- CD-ROM drive %s media changed since last test.\n", psz_drive); break; default: - printf("Error status for drive %s: %s.\n", psz_drive, + printf("-- Error status for drive %s: %s.\n", psz_drive, cdio_driver_errmsg(ret)); return 77; } diff --git a/example/sample4.c b/example/sample4.c index 4e75f5c4..34ae2e22 100644 --- a/example/sample4.c +++ b/example/sample4.c @@ -155,7 +155,7 @@ main(int argc, const char *argv[]) p_cdio = cdio_open (cd_image_name, DRIVER_UNKNOWN); if (NULL == p_cdio) { - printf("Problem in trying to find a driver.\n\n"); + printf("-- Problem in trying to find a driver.\n\n"); return 77; } @@ -175,7 +175,7 @@ main(int argc, const char *argv[]) /* try to find out what sort of CD we have */ if (0 == num_data) { - printf("Audio CD\n"); + printf("-- Audio CD\n"); } else { /* we have data track(s) */ cdio_iso_analysis_t cdio_iso_analysis; |