diff --git a/src/util.c b/src/util.c index 707a11b9..21c83cce 100644 --- a/src/util.c +++ b/src/util.c @@ -51,15 +51,16 @@ print_version (char *program_name, const char *version, int no_header, bool version_only) { - if (no_header == 0) + if (no_header == 0) { report( stdout, "%s version %s\nCopyright (c) 2003, 2004, 2005, 2007, 2008, 2011 R. Bernstein\n", program_name, version); - report( stdout, - _("This is free software; see the source for copying conditions.\n\ + report( stdout, + _("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\ ")); + } if (version_only) { char *default_device; diff --git a/test/cdda-mcn.right b/test/cdda-mcn.right index dd53487d..4a2faa81 100644 --- a/test/cdda-mcn.right +++ b/test/cdda-mcn.right @@ -1,6 +1,3 @@ -This is free software; see the source for copying conditions. -There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A -PARTICULAR PURPOSE. __________________________________ Disc mode is listed as: CD-DA diff --git a/test/cdda-read.right b/test/cdda-read.right index e5e583ea..cad25fc1 100644 --- a/test/cdda-read.right +++ b/test/cdda-read.right @@ -1,6 +1,3 @@ -This is free software; see the source for copying conditions. -There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A -PARTICULAR PURPOSE. 0x0000: 0000 0000 0000 0000 0000 0000 0000 0000 0x0010: 0000 0000 0000 0000 0000 0000 0000 0000 0x0020: 0000 0000 0000 0000 0000 0000 0000 0000 diff --git a/test/cdda.right b/test/cdda.right index ca2307af..63645164 100644 --- a/test/cdda.right +++ b/test/cdda.right @@ -1,6 +1,3 @@ -This is free software; see the source for copying conditions. -There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A -PARTICULAR PURPOSE. __________________________________ Disc mode is listed as: CD-DA diff --git a/test/check_common_fn.in b/test/check_common_fn.in index a175682a..6ea9e778 100755 --- a/test/check_common_fn.in +++ b/test/check_common_fn.in @@ -46,75 +46,56 @@ check_result() { fi } -test_cdinfo() { +test_common() { - opts="$1" - outfile="$2" - rightfile="$3" + cmdname="$1" + cmd="../src/${cmdname}@EXEEXT@" + opts="$2" + outfile="$3" + rightfile="$4" - CD_INFO="../src/cd-info@EXEEXT@" - - if [ ! -x ${CD_INFO} ]; then - echo "$0: No ${CD_INFO}" + if [ ! -x "${cmd}" ]; then + echo "$0: No ${cmd}" return 1 fi - if ${CD_INFO} --no-header ${opts} >${outfile} 2>&1 ; then + cmdline="${cmd}" + if "${cmd}" --no-header ${opts} >"${outfile}" 2>&1 ; then if test "@DIFF@" != no; then - if @DIFF@ @DIFF_OPTS@ ${outfile} ${rightfile} ; then - rm -f $outfile + if @DIFF@ @DIFF_OPTS@ "${outfile}" "${rightfile}" ; then + rm -f "${outfile}" return 0 else return 3 fi else - echo "$0: No diff(1) or cmp(1) found - cannot test ${CD_INFO}" - rm -f $outfile - return 77 + echo "$0: No diff(1) or cmp(1) found - cannot test ${cmdname}" + rm -f "${outfile}" + return $SKIP_TEST_EXITCODE fi else - echo "$0 failed running: ${CD_INFO} ${opts}" + echo "$0 failed running: ${cmdname} ${opts}" return 2 fi } +test_cdinfo() { + test_common cd-info "$@" +} + test_iso_info() { + test_common iso-info "$@" +} - opts="$1" - outfile="$2" - rightfile="$3" - - ISO_INFO="../src/iso-info@EXEEXT@" - - if [ ! -x ${ISO_INFO} ]; then - echo "$0: No ${ISO_INFO}" - return 1 - fi - - cmdline="${ISO_INFO} --no-header ${opts}" - if $cmdline >${outfile} 2>&1 ; then - if test "/usr/bin/diff" != no; then - if @DIFF@ @DIFF_OPTS@ ${outfile} ${rightfile} ; then - rm -f $outfile - return 0 - else - return 3 - fi - else - echo "$0: No diff(1) or cmp(1 found - cannot test ${ISO_INFO}" - rm -f $outfile - return 77 - fi - else - echo "$0 failed running: $cmdline" - return 2 - fi - +test_cd_read() { + test_common cd-read "$@" } test_iso_read() { + # not test_common, as we use an output file not stdout. + opts="$1" outfile="$2" rightfile="$3" @@ -126,17 +107,17 @@ test_iso_read() { return 1 fi - if ${ISO_READ} ${opts} -o ${outfile} 2>&1 ; then + if "${ISO_READ}" ${opts} -o "${outfile}" 2>&1 ; then if test "@DIFF@" != no; then - if @DIFF@ @DIFF_OPTS@ ${outfile} ${rightfile} ; then - rm -f $outfile + if @DIFF@ @DIFF_OPTS@ "${outfile}" "${rightfile}" ; then + rm -f "${outfile}" return 0 else return 3 fi else - echo "$0: No diff(1) or cmp(1 found - cannot test ${ISO_READ}" - rm -f $outfile + echo "$0: No diff(1) or cmp(1) found - cannot test ${ISO_READ}" + rm -f "${outfile}" return 77 fi else @@ -146,36 +127,31 @@ test_iso_read() { } -test_cd_read() { +test_legal_header() { - opts="$1" - outfile="$2" - rightfile="$3" + cmdname="$1" + cmd="../src/${cmdname}@EXEEXT@" + opts="$2" + outfile="$3" - CD_READ="../src/cd-read@EXEEXT@" - - if [ ! -x ${CD_READ} ]; then - echo "$0: No ${CD_READ}" - return 1 + if test "@GREP@" == no; then + echo "$0: No grep(1) found - cannot test ${cmd}." + echo "$0: Legal header test skipped." + exit $SKIP_TEST_EXITCODE fi - - if ${CD_READ} --no-header ${opts} >${outfile} 2>&1 ; then - if test "@DIFF@" != no; then - if @DIFF@ @DIFF_OPTS@ ${outfile} ${rightfile} ; then - rm -f $outfile - return 0 - else - return 3 - fi - else - echo "$0: No diff(1) or cmp(1 found - cannot test ${CD_READ}" - rm -f $outfile - return 77 + "${cmd}" ${opts} > ${outfile} 2>&1 + while read line; do + if ! grep -q "${line}" ${outfile}; then + echo "$0: Legal header test failed due to missing expected line:" + echo " ${line}" + echo "$0: Failed command:" + echo " ${cmd} ${opts}" + rm -f "${outfile}" + exit 4 fi - else - echo "$0 failed running: ${CD_READ} ${opts}" - return 2 - fi + done < ${srcdir}/check_legal.regex + rm -f ${outfile} + echo "$0: Legal header of ${cmd} ${opts} ok." } diff --git a/test/check_opts.sh b/test/check_opts.sh index 31036865..26833a64 100755 --- a/test/check_opts.sh +++ b/test/check_opts.sh @@ -29,6 +29,8 @@ for opt in '-T' '--no-tracks' '-A' '--no-analyze' '-I' '--no-ioctl' \ i=`expr $i + 1` done +test_legal_header cd-info "${srcdir}/data/${fname}.cue" cd-info_legal.dump + exit $RC #;;; Local Variables: *** diff --git a/test/check_opts0.right b/test/check_opts0.right index 8af8ff71..f5e163fc 100644 --- a/test/check_opts0.right +++ b/test/check_opts0.right @@ -1,6 +1,3 @@ -This is free software; see the source for copying conditions. -There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A -PARTICULAR PURPOSE. __________________________________ Disc mode is listed as: CD-DATA (Mode 1) diff --git a/test/check_opts1.right b/test/check_opts1.right index 8af8ff71..f5e163fc 100644 --- a/test/check_opts1.right +++ b/test/check_opts1.right @@ -1,6 +1,3 @@ -This is free software; see the source for copying conditions. -There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A -PARTICULAR PURPOSE. __________________________________ Disc mode is listed as: CD-DATA (Mode 1) diff --git a/test/check_opts2.right b/test/check_opts2.right index 7723e0d1..c4712945 100644 --- a/test/check_opts2.right +++ b/test/check_opts2.right @@ -1,6 +1,3 @@ -This is free software; see the source for copying conditions. -There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A -PARTICULAR PURPOSE. __________________________________ Disc mode is listed as: CD-DATA (Mode 1) diff --git a/test/check_opts3.right b/test/check_opts3.right index 7723e0d1..c4712945 100644 --- a/test/check_opts3.right +++ b/test/check_opts3.right @@ -1,6 +1,3 @@ -This is free software; see the source for copying conditions. -There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A -PARTICULAR PURPOSE. __________________________________ Disc mode is listed as: CD-DATA (Mode 1) diff --git a/test/check_opts4.right b/test/check_opts4.right index bd05bdc3..e4977f34 100644 --- a/test/check_opts4.right +++ b/test/check_opts4.right @@ -1,6 +1,3 @@ -This is free software; see the source for copying conditions. -There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A -PARTICULAR PURPOSE. __________________________________ Disc mode is listed as: CD-DATA (Mode 1) diff --git a/test/check_opts5.right b/test/check_opts5.right index bd05bdc3..e4977f34 100644 --- a/test/check_opts5.right +++ b/test/check_opts5.right @@ -1,6 +1,3 @@ -This is free software; see the source for copying conditions. -There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A -PARTICULAR PURPOSE. __________________________________ Disc mode is listed as: CD-DATA (Mode 1) diff --git a/test/check_opts6.right b/test/check_opts6.right index bd05bdc3..e4977f34 100644 --- a/test/check_opts6.right +++ b/test/check_opts6.right @@ -1,6 +1,3 @@ -This is free software; see the source for copying conditions. -There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A -PARTICULAR PURPOSE. __________________________________ Disc mode is listed as: CD-DATA (Mode 1) diff --git a/test/check_opts7.right b/test/check_opts7.right index bd05bdc3..e4977f34 100644 --- a/test/check_opts7.right +++ b/test/check_opts7.right @@ -1,6 +1,3 @@ -This is free software; see the source for copying conditions. -There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A -PARTICULAR PURPOSE. __________________________________ Disc mode is listed as: CD-DATA (Mode 1) diff --git a/test/copying-rr.right b/test/copying-rr.right index 41115fd2..278b099a 100644 --- a/test/copying-rr.right +++ b/test/copying-rr.right @@ -1,6 +1,3 @@ -This is free software; see the source for copying conditions. -There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A -PARTICULAR PURPOSE. __________________________________ ISO-9660 Information /: diff --git a/test/copying.right b/test/copying.right index 492128ff..5eb38db5 100644 --- a/test/copying.right +++ b/test/copying.right @@ -1,6 +1,3 @@ -This is free software; see the source for copying conditions. -There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A -PARTICULAR PURPOSE. __________________________________ ISO-9660 Information /: diff --git a/test/fsf.right b/test/fsf.right index 7d1ebf9c..81f6f018 100644 --- a/test/fsf.right +++ b/test/fsf.right @@ -1,7 +1,4 @@ CD Info 2.0 | (c) 2003 Gerd Knorr, Heiko Eißfeldt & R. Bernstein -This is free software; see the source for copying conditions. -There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A -PARTICULAR PURPOSE. __________________________________ CD-ROM Track List (1 - 1) #: MSF LSN Type diff --git a/test/isofs-m1-no-rr.right b/test/isofs-m1-no-rr.right index 762202fe..5d8b5d95 100644 --- a/test/isofs-m1-no-rr.right +++ b/test/isofs-m1-no-rr.right @@ -1,6 +1,3 @@ -This is free software; see the source for copying conditions. -There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A -PARTICULAR PURPOSE. __________________________________ CD-ROM Track List (1 - 1) diff --git a/test/isofs-m1-read.right b/test/isofs-m1-read.right index 3cbf0442..96c50a7b 100644 --- a/test/isofs-m1-read.right +++ b/test/isofs-m1-read.right @@ -1,6 +1,3 @@ -This is free software; see the source for copying conditions. -There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A -PARTICULAR PURPOSE. 0x0000: 0909 2020 2020 474e 5520 4745 4e45 5241 .. GNU GENERA 0x0010: 4c20 5055 424c 4943 204c 4943 454e 5345 L PUBLIC LICENSE 0x0020: 0a09 0920 2020 2020 2020 5665 7273 696f ... Versio diff --git a/test/isofs-m1.right b/test/isofs-m1.right index 312dc7a0..a26074d9 100644 --- a/test/isofs-m1.right +++ b/test/isofs-m1.right @@ -1,6 +1,3 @@ -This is free software; see the source for copying conditions. -There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A -PARTICULAR PURPOSE. __________________________________ CD-ROM Track List (1 - 1) diff --git a/test/joliet-nojoliet.right b/test/joliet-nojoliet.right index e942d4c2..584ef573 100644 --- a/test/joliet-nojoliet.right +++ b/test/joliet-nojoliet.right @@ -1,6 +1,3 @@ -This is free software; see the source for copying conditions. -There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A -PARTICULAR PURPOSE. __________________________________ ISO-9660 Information /: diff --git a/test/joliet.right b/test/joliet.right index 8733d114..7212410c 100644 --- a/test/joliet.right +++ b/test/joliet.right @@ -1,6 +1,3 @@ -This is free software; see the source for copying conditions. -There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A -PARTICULAR PURPOSE. __________________________________ ISO-9660 Information /: diff --git a/test/monvoisin.right b/test/monvoisin.right index c10fb230..30cbb218 100644 --- a/test/monvoisin.right +++ b/test/monvoisin.right @@ -1,6 +1,3 @@ -This is free software; see the source for copying conditions. -There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A -PARTICULAR PURPOSE. __________________________________ Disc mode is listed as: CD DATA (Mode 2) diff --git a/test/svcd_ogt_test_ntsc.right b/test/svcd_ogt_test_ntsc.right index e7e30b53..e2303d78 100644 --- a/test/svcd_ogt_test_ntsc.right +++ b/test/svcd_ogt_test_ntsc.right @@ -1,6 +1,3 @@ -This is free software; see the source for copying conditions. -There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A -PARTICULAR PURPOSE. __________________________________ CD-ROM Track List (1 - 2) diff --git a/test/svcdgs.right b/test/svcdgs.right index 6ce2c235..128e699b 100644 --- a/test/svcdgs.right +++ b/test/svcdgs.right @@ -1,6 +1,3 @@ -This is free software; see the source for copying conditions. -There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A -PARTICULAR PURPOSE. __________________________________ Disc mode is listed as: CD DATA (Mode 2) diff --git a/test/vcd_demo.right b/test/vcd_demo.right index c08999ca..c7915866 100644 --- a/test/vcd_demo.right +++ b/test/vcd_demo.right @@ -1,6 +1,3 @@ -This is free software; see the source for copying conditions. -There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A -PARTICULAR PURPOSE. __________________________________ CD-ROM Track List (1 - 3) diff --git a/test/vcd_demo_vcdinfo.right b/test/vcd_demo_vcdinfo.right index 1c98f0f2..ce3bd9a5 100644 --- a/test/vcd_demo_vcdinfo.right +++ b/test/vcd_demo_vcdinfo.right @@ -1,6 +1,3 @@ -This is free software; see the source for copying conditions. -There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A -PARTICULAR PURPOSE. __________________________________ CD-ROM Track List (1 - 3) diff --git a/test/vcd_demo_vcdinfo_toc.right b/test/vcd_demo_vcdinfo_toc.right index ef66ceb5..a0e9842c 100644 --- a/test/vcd_demo_vcdinfo_toc.right +++ b/test/vcd_demo_vcdinfo_toc.right @@ -1,6 +1,3 @@ -This is free software; see the source for copying conditions. -There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A -PARTICULAR PURPOSE. __________________________________ CD-ROM Track List (1 - 3) diff --git a/test/videocd.right b/test/videocd.right index 4e89b585..9e83716e 100644 --- a/test/videocd.right +++ b/test/videocd.right @@ -1,6 +1,3 @@ -This is free software; see the source for copying conditions. -There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A -PARTICULAR PURPOSE. __________________________________ Disc mode is listed as: CD DATA (Mode 2)