Add option to cd-paranoia to log summary output to a file. Patch from and

thanks to Daniel Schwarz.
This commit is contained in:
rocky
2008-02-29 11:34:15 +00:00
parent 2e34115075
commit 5f10277136
7 changed files with 75 additions and 34 deletions

10
NEWS
View File

@@ -1,8 +1,12 @@
$Id: NEWS,v 1.114 2008/01/05 12:12:52 rocky Exp $ $Id: NEWS,v 1.115 2008/02/29 11:34:15 rocky Exp $
version 0.80 version 0.80
2008-03-15
- Add get_media_changed for FreeBSD - Add get_media_changed for FreeBSD
- Savannah bug #21910 - Add option to log summary output in cd-paranoia
- More string bounds checking to eliminate known string overflow conditions,
e.g. Savannah bug #21910
version 0.79 version 0.79
2007-10-27 2007-10-27
@@ -391,4 +395,4 @@ version 0.1
Routines split off from VCDImager. Routines split off from VCDImager.
$Id: NEWS,v 1.114 2008/01/05 12:12:52 rocky Exp $ $Id: NEWS,v 1.115 2008/02/29 11:34:15 rocky Exp $

2
THANKS
View File

@@ -50,3 +50,5 @@ Svend S. Sorensen <ssorensen at fastmail.fm>
xboxmediacenter team (www.xboxmediacenter.de) xboxmediacenter team (www.xboxmediacenter.de)
X-Box detection and XDF filesystem things X-Box detection and XDF filesystem things
Daniel Schwarz
log-summary option in cd-paranoia.

View File

@@ -20,33 +20,6 @@
* *
* See ChangeLog for recent changes. * See ChangeLog for recent changes.
* *
* last changes:
* 22.01.98 - first version
* 15.02.98 - alpha 2: juggled two includes from interface/low_interface.h
* that move contents in Linux 2.1
* Linked status bar to isatty to avoid it appearing
* in a redirected file.
* Played with making TOC less verbose.
* 04.04.98 - alpha 3: zillions of bugfixes, also added MMC and IDE_SCSI
* emulation support
* 05.04.98 - alpha 4: Segfault fix, cosmetic repairs
* 05.04.98 - alpha 5: another segfault fix, cosmetic repairs,
* Gadi Oxman provided code to identify/fix nonstandard
* ATAPI CDROMs
* 07.04.98 - alpha 6: Bugfixes to autodetection
* 18.06.98 - alpha 7: Additional SCSI error handling code
* cosmetic fixes
* segfault fixes
* new sync/silence code, smaller fft
* 15.07.98 - alpha 8: More new SCSI code, better error recovery
* more segfault fixes (two linux bugs, one my fault)
* Fixup reporting fixes, smilie fixes.
* AIFF support (in addition to AIFC)
* Path parsing fixes
* Changes are becoming TNTC. Will resume the log at beta.
*
* 09.04.04 - conversion to use libcdio. See top-level Changelog for
* libcdio history.
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
@@ -317,6 +290,7 @@ long callscript=0;
static int skipped_flag=0; static int skipped_flag=0;
static int abort_on_skip=0; static int abort_on_skip=0;
FILE *logfile = NULL;
#if TRACE_PARANOIA #if TRACE_PARANOIA
static void static void
@@ -557,6 +531,12 @@ callback(long int inpos, paranoia_cb_mode_t function)
} }
fprintf(stderr,buffer); fprintf(stderr,buffer);
if (logfile != NULL && function==-1) {
fprintf(logfile,buffer+1);
fprintf(logfile,"\n\n");
fflush(logfile);
}
} }
} }
} }
@@ -567,7 +547,7 @@ callback(long int inpos, paranoia_cb_mode_t function)
} }
#endif /* !TRACE_PARANOIA */ #endif /* !TRACE_PARANOIA */
const char *optstring = "aBcCd:efg:hi:m:n:o:O:pqQrRsS:Tt:VvwWx:XYZz::"; const char *optstring = "aBcCd:efg:hi:l:m:n:o:O:pqQrRsS:Tt:VvwWx:XYZz::";
struct option options [] = { struct option options [] = {
{"abort-on-skip", no_argument, NULL, 'X'}, {"abort-on-skip", no_argument, NULL, 'X'},
@@ -583,6 +563,7 @@ struct option options [] = {
{"force-read-speed", required_argument, NULL, 'S'}, {"force-read-speed", required_argument, NULL, 'S'},
{"force-search-overlap", required_argument, NULL, 'o'}, {"force-search-overlap", required_argument, NULL, 'o'},
{"help", no_argument, NULL, 'h'}, {"help", no_argument, NULL, 'h'},
{"log-summary", required_argument, NULL, 'l'},
{"mmc-timeout", required_argument, NULL, 'm'}, {"mmc-timeout", required_argument, NULL, 'm'},
{"never-skip", optional_argument, NULL, 'z'}, {"never-skip", optional_argument, NULL, 'z'},
{"output-aifc", no_argument, NULL, 'a'}, {"output-aifc", no_argument, NULL, 'a'},
@@ -638,6 +619,10 @@ cleanup (void)
free_and_null(force_cdrom_device); free_and_null(force_cdrom_device);
free_and_null(span); free_and_null(span);
free_and_null(info_file); free_and_null(info_file);
if(logfile && logfile != stdout) {
fclose(logfile);
logfile = NULL;
}
} }
/* Returns true if we have an integer argument. /* Returns true if we have an integer argument.
@@ -747,6 +732,19 @@ main(int argc,char *argv[])
if(info_file)free(info_file); if(info_file)free(info_file);
info_file=strdup(info_file); info_file=strdup(info_file);
break; break;
case 'l':
if(logfile && logfile != stdout)fclose(logfile);
if(!strcmp(optarg,"-"))
logfile=stdout;
else{
logfile=fopen(optarg,"w");
if(logfile==NULL){
report3("Cannot open log summary file %s: %s",(char*)optarg,
strerror(errno));
exit(1);
}
}
break;
case 'm': case 'm':
{ {
long int mmc_timeout_sec; long int mmc_timeout_sec;
@@ -839,6 +837,18 @@ main(int argc,char *argv[])
exit(1); exit(1);
} }
} }
if(logfile){
/* log command line and version */
int i;
for (i = 0; i < argc; i++)
fprintf(logfile,"%s ",argv[i]);
fprintf(logfile,"\n");
fprintf(logfile,VERSION);
fprintf(logfile,"\n");
fflush(logfile);
}
if(optind>=argc && !query_only){ if(optind>=argc && !query_only){
if(batch) if(batch)
@@ -919,6 +929,8 @@ main(int argc,char *argv[])
report("Search overlap sectors must be 0<= n <=75\n"); report("Search overlap sectors must be 0<= n <=75\n");
cdda_close(d); cdda_close(d);
d=NULL; d=NULL;
if(logfile && logfile != stdout)
fclose(logfile);
exit(1); exit(1);
} }
{ {
@@ -1138,6 +1150,10 @@ main(int argc,char *argv[])
report("Are you sure you wanted 'batch' " report("Are you sure you wanted 'batch' "
"(-B) output with stdout?"); "(-B) output with stdout?");
report("outputting to stdout\n"); report("outputting to stdout\n");
if(logfile){
fprintf(logfile,"outputting to stdout\n");
fflush(logfile);
}
outfile_name[0]='\0'; outfile_name[0]='\0';
} else { } else {
char path[256]; char path[256];
@@ -1181,6 +1197,10 @@ main(int argc,char *argv[])
exit(1); exit(1);
} }
report2("outputting to %s\n", outfile_name); report2("outputting to %s\n", outfile_name);
if(logfile){
fprintf(logfile,"outputting to %s\n",outfile_name);
fflush(logfile);
}
} }
} else { } else {
/* default */ /* default */
@@ -1211,6 +1231,11 @@ main(int argc,char *argv[])
exit(1); exit(1);
} }
report2("outputting to %s\n", outfile_name); report2("outputting to %s\n", outfile_name);
if(logfile){
fprintf(logfile,"outputting to %s\n",outfile_name);
fflush(logfile);
}
} }
switch(output_type) { switch(output_type) {

View File

@@ -57,6 +57,10 @@ Print a brief synopsis of
.B @CDPARANOIA_NAME@ .B @CDPARANOIA_NAME@
usage and options. usage and options.
.TP
.BI "\-l --log-summary " file
Save result summary to file.
.TP .TP
.B \-p --output-raw .B \-p --output-raw
Output headerless data as raw 16 bit PCM data with interleaved samples in host byte order. To force little or big endian byte order, use Output headerless data as raw 16 bit PCM data with interleaved samples in host byte order. To force little or big endian byte order, use

View File

@@ -23,6 +23,7 @@ const char usage_help[] =
" -v --verbose : extra verbose operation\n" " -v --verbose : extra verbose operation\n"
" -q --quiet : quiet operation\n" " -q --quiet : quiet operation\n"
" -e --stderr-progress : force output of progress information to\n" " -e --stderr-progress : force output of progress information to\n"
" -l --log-summary <file> : save result summary to file\n"
" stderr (for wrapper scripts)\n" " stderr (for wrapper scripts)\n"
" -V --version : print version info and quit\n" " -V --version : print version info and quit\n"
" -Q --query : autosense drive, query disc and quit\n" " -Q --query : autosense drive, query disc and quit\n"

View File

@@ -6,6 +6,7 @@ OPTIONS:
-q --quiet : quiet operation -q --quiet : quiet operation
-e --stderr-progress : force output of progress information to -e --stderr-progress : force output of progress information to
stderr (for wrapper scripts) stderr (for wrapper scripts)
-l --log-summary <file> : save result summary to file
-V --version : print version info and quit -V --version : print version info and quit
-Q --query : autosense drive, query disc and quit -Q --query : autosense drive, query disc and quit
-B --batch : 'batch' mode (saves each track to a -B --batch : 'batch' mode (saves each track to a

View File

@@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# $Id: check_paranoia.sh.in,v 1.11 2005/10/17 15:10:55 pjcreath Exp $ # $Id: check_paranoia.sh.in,v 1.12 2008/02/29 11:34:15 rocky Exp $
# Compare our cd-paranoia with an installed cdparanoia # Compare our cd-paranoia with known good results.
if test "X$srcdir" = "X" ; then if test "X$srcdir" = "X" ; then
srcdir=`pwd` srcdir=`pwd`
@@ -68,7 +68,11 @@ if test "@CMP@" != no -a "@BUILD_CD_PARANOIA_TRUE@"X = X ; then
### FIXME: large jitter is known to fail. Investigate. ### FIXME: large jitter is known to fail. Investigate.
exit 0 exit 0
else else
echo "Don't see libcdio cd-paranoia program. Test skipped." if test "@CMP@" != no ; then
echo "Don't see 'cmp' program. Test skipped."
else
echo "Don't see libcdio 'cd-paranoia' program. Test skipped."
fi
exit 77 exit 77
fi fi
fi fi