Package: cdparanoia / 3.10.2+debian-14

cdparanoia-force-progress-bar.diff Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
From: Optical Media Tools Team <pkg-opt-media-team@lists.alioth.debian.org>
Date: Tue, 30 Jan 2018 13:51:00 +0900
Subject: New option "--force-progress-bar"

---
 main.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/main.c b/main.c
index ed485d2..d7b4b09 100644
--- a/main.c
+++ b/main.c
@@ -213,6 +213,8 @@ VERSION"\n"
 "  -q --quiet                      : quiet operation\n"
 "  -e --stderr-progress            : force output of progress information to\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"
 "                                    filename cdparanoia.log\n"
 "  -L --log-debug   [<file>]       : save detailed device autosense and\n"
@@ -341,6 +343,7 @@ VERSION"\n"
 long callbegin;
 long callend;
 long callscript=0;
+long force_progress_bar=0;
 
 static char *callback_strings[16]={"wrote",
                                    "finished",
@@ -407,13 +410,13 @@ static void callback(long inpos, int function){
     }
   }
 
-  if(!quiet){
+  if(force_progress_bar || !quiet){
     long test;
     osector=inpos;
     sector=inpos/CD_FRAMEWORDS;
     
     if(printit==-1){
-      if(isatty(STDERR_FILENO)){
+      if(force_progress_bar || isatty(STDERR_FILENO)){
 	printit=1;
       }else{
 	printit=0;
@@ -607,10 +610,11 @@ static void callback(long inpos, int function){
     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 [] = {
 	{"stderr-progress",no_argument,NULL,'e'},
+	{"force-progress-bar",no_argument,NULL,'E'},
 	{"search-for-drive",no_argument,NULL,'s'},
 	{"force-cdrom-little-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;
       fprintf(stderr,"Sending all callbacks to stderr for wrapper script\n");
       break;
+    case 'E':
+      force_progress_bar=1;
+      break;
     case 'V':
       fprintf(stderr,VERSION);
       fprintf(stderr,"\n");