ref: af78af162bb2b70380349fd166e2308114ef7a9b
parent: 3bf8d9c0b71f67970eba6af780b682195fc3c0c2
author: Sigrid Haflínudóttir <ftrvxmtrx@gmail.com>
date: Wed Aug 19 04:36:24 EDT 2020
add -d option for debugging
--- a/zuke.c
+++ b/zuke.c
@@ -41,6 +41,7 @@
int mainstacksize = 32768;
+static int debug;
static int audio;
static Meta *pl;
static int plnum;
@@ -364,7 +365,10 @@
if((pid = rfork(RFPROC|RFFDG|RFREND|RFNOTEG)) == 0){
dup(fd, 0); close(fd);
dup(p[1], 1); close(p[1]);
- dup(open("/dev/null", OWRITE), 2);
+ if(!debug) {
+ dup(fd = open("/dev/null", OWRITE), 2);
+ close(fd);
+ }
snprint(tmp, sizeof(tmp), "%s -9t | resample -x128", prog);
execl("/bin/rc", "rc", "-c", tmp, nil);
sysfatal("execl: %r");
@@ -482,7 +486,10 @@
fd = open("/dev/null", OREAD);
dup(fd, 0); close(fd);
dup(p[0], 1); close(p[0]);
- dup(fd = open("/dev/null", OWRITE), 2); close(fd);
+ if(!debug){
+ dup(fd = open("/dev/null", OWRITE), 2);
+ close(fd);
+ }
close(p[1]);
if(*fmt){
snprint(cmd, sizeof(cmd), "/bin/audio/%sdec", fmt);
@@ -859,6 +866,9 @@
shuffled = 0;
ARGBEGIN{
+ case 'd':
+ debug++;
+ break;
case 's':
shuffled = 1;
break;