diff options
author | B. Watson <urchlay@slackware.uk> | 2024-04-13 16:28:48 -0400 |
---|---|---|
committer | B. Watson <urchlay@slackware.uk> | 2024-04-13 16:28:48 -0400 |
commit | d1f48f34e8af4842efb6952d72b9a52969e632ea (patch) | |
tree | f4e4e36949a8ecf5009ed1b557115ed20ee12938 | |
parent | 59ea1d3988599b49cff516ae0516fb2c6456ec21 (diff) | |
download | soxdial-d1f48f34e8af4842efb6952d72b9a52969e632ea.tar.gz |
soxdial: improve --input/--stdin.
-rwxr-xr-x | soxdial | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -590,12 +590,18 @@ sub check_stereo { sub read_file { my $file = shift; my $result = shift; + my $filename = ($file eq '-' ? "stdin" : "file '$file'"); + + warn "$SELF: reading $filename.\n"; open my $fh, "<$file" or die "$SELF: $file: $!\n"; while(<$fh>) { chomp; - push @$result, split ""; + push @$result, split " "; } + + warn "$SELF: read " . @$result . " dial strings from $filename.\n" if $verbose; + close $fh; } @@ -632,6 +638,8 @@ for(@ARGV) { if($input_seen) { read_file($_, \@newargv); $input_seen = 0; + } elsif(/^--?v(?:erbose)?$/) { + $verbose = 1; } elsif(/^--?stdin$/) { read_file("-", \@newargv); } elsif(/^--?i(?:nput)?=?(.+)?$/) { @@ -674,8 +682,6 @@ for ($argc = 0; $argc < @ARGV; $argc++) { $SOX = $ARGV[++$argc]; die "$SELF: missing argument for --sox.\n" unless defined $SOX; warn "$SELF: sox executable set to '$SOX'\n" if $verbose; - } elsif(/^--?v(?:erbose)?$/) { - $verbose = 1; } elsif(/^--?n(?:oexec)?$/) { $verbose = 1; $noexec = 1; |