]> git.lizzy.rs Git - plan9front.git/commitdiff
play(1): handle file names containing consecutive spaces
authorAlex Musolino <alex@musolino.id.au>
Mon, 18 Jun 2018 03:41:03 +0000 (13:11 +0930)
committerAlex Musolino <alex@musolino.id.au>
Mon, 18 Jun 2018 03:41:03 +0000 (13:11 +0930)
rc/bin/play

index 8953a1024a5e4cc7a53fd53423b60ece8cb88ce1..dfb05ed7f7a70db108403f1ceceb4e2284a8282c 100755 (executable)
@@ -1,6 +1,8 @@
 #!/bin/rc
 rfork e
 
+nl='
+'
 out=/dev/audio
 typ=()
 tmp=()
@@ -31,7 +33,7 @@ fn play1 {
        if not {
                switch($2){
                case *plain*
-                       sed 's/\r//g' | while(j=`{read}){
+                       sed 's/\r//g' | while(j=`$nl{read}){
                                echo $"j >[1=2]
                                if(~ $"j http:* https:* HTTP:* HTTPS:*){
                                        hget -r 'User-Agent: play' -r 'Icy-MetaData: 0' $"j | play1 $"j
@@ -104,5 +106,5 @@ while(~ $1 -*){
 
 >$out {
        if(~ $#* 0){play1 stdin; exit}
-       for(i){echo $i} | play1 args plain
+       for(i){echo $"i} | play1 args plain
 }