New option "--force-progress-bar"

Gbp-Pq: Name cdparanoia-force-progress-bar.diff
This commit is contained in:
Optical Media Tools Team 2018-01-30 13:51:00 +09:00 committed by openKylinBot
parent 88bb04ed23
commit 23b5e2b21c
1 changed files with 10 additions and 3 deletions

13
main.c
View File

@ -213,6 +213,8 @@ VERSION"\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"
" stderr (for wrapper scripts)\n" " stderr (for wrapper scripts)\n"
" -E --force-progress-bar : force output of progress bar even if\n"
" stderr is not a terminal\n"
" -l --log-summary [<file>] : save result summary to file, default\n" " -l --log-summary [<file>] : save result summary to file, default\n"
" filename cdparanoia.log\n" " filename cdparanoia.log\n"
" -L --log-debug [<file>] : save detailed device autosense and\n" " -L --log-debug [<file>] : save detailed device autosense and\n"
@ -341,6 +343,7 @@ VERSION"\n"
long callbegin; long callbegin;
long callend; long callend;
long callscript=0; long callscript=0;
long force_progress_bar=0;
static char *callback_strings[16]={"wrote", static char *callback_strings[16]={"wrote",
"finished", "finished",
@ -407,13 +410,13 @@ static void callback(long inpos, int function){
} }
} }
if(!quiet){ if(force_progress_bar || !quiet){
long test; long test;
osector=inpos; osector=inpos;
sector=inpos/CD_FRAMEWORDS; sector=inpos/CD_FRAMEWORDS;
if(printit==-1){ if(printit==-1){
if(isatty(STDERR_FILENO)){ if(force_progress_bar || isatty(STDERR_FILENO)){
printit=1; printit=1;
}else{ }else{
printit=0; printit=0;
@ -607,10 +610,11 @@ static void callback(long inpos, int function){
memset(dispcache,' ',graph); memset(dispcache,' ',graph);
} }
const char *optstring = "escCn:o:O:d:g:k:S:prRwafvqVQhZz::YXWBi:Tt:l::L::A"; const char *optstring = "eEscCn:o:O:d:g:k:S:prRwafvqVQhZz::YXWBi:Tt:l::L::A";
struct option options [] = { struct option options [] = {
{"stderr-progress",no_argument,NULL,'e'}, {"stderr-progress",no_argument,NULL,'e'},
{"force-progress-bar",no_argument,NULL,'E'},
{"search-for-drive",no_argument,NULL,'s'}, {"search-for-drive",no_argument,NULL,'s'},
{"force-cdrom-little-endian",no_argument,NULL,'c'}, {"force-cdrom-little-endian",no_argument,NULL,'c'},
{"force-cdrom-big-endian",no_argument,NULL,'C'}, {"force-cdrom-big-endian",no_argument,NULL,'C'},
@ -786,6 +790,9 @@ int main(int argc,char *argv[]){
callscript=1; callscript=1;
fprintf(stderr,"Sending all callbacks to stderr for wrapper script\n"); fprintf(stderr,"Sending all callbacks to stderr for wrapper script\n");
break; break;
case 'E':
force_progress_bar=1;
break;
case 'V': case 'V':
fprintf(stderr,VERSION); fprintf(stderr,VERSION);
fprintf(stderr,"\n"); fprintf(stderr,"\n");