shithub: pplay

Download patch

ref: 3f2ec921691046ec1738aeeeb494be9bfef21120
parent: 6d4ecd6bb7c46e508d89ae2bab911f5f3b206d94
author: qwx <qwx@sciops.net>
date: Mon Feb 27 12:41:03 EST 2023

pcmmix: fix using stdin only

the heuristic might not work to begin with? not sure

--- a/pcmmix.c
+++ b/pcmmix.c
@@ -11,7 +11,7 @@
 void
 usage(void)
 {
-	fprint(2, "usage: %s [-f] [FILE..]\n", argv0);
+	fprint(2, "usage: %s [-f factor] [FILE..]\n", argv0);
 	exits("usage");
 }
 
@@ -36,10 +36,12 @@
 		sysfatal("mallocz: %r");
 	fp = ftab;
 	fp->path = "stdin";
-	if((d = dirfstat(0)) == nil)
-		sysfatal("dirfstat: %r");
-	fp->fd = d->length > 0 ? 0 : -1;
-	free(d);
+	if(nf > 1){
+		if((d = dirfstat(0)) == nil)
+			sysfatal("dirfstat: %r");
+		fp->fd = d->length > 0 ? 0 : -1;
+		free(d);
+	}
 	fp++;
 	while(*argv != nil){
 		if((fp->fd = open(*argv, OREAD)) < 0)