Skip to content

Commit

Permalink
compat: match multiple spaces/tabs for different platforms
Browse files Browse the repository at this point in the history
Signed-off-by: Beau Hastings <[email protected]>
  • Loading branch information
hastinbe committed Dec 24, 2024
1 parent 9a8f7fa commit 7191992
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions volume
Original file line number Diff line number Diff line change
Expand Up @@ -737,8 +737,8 @@ define_pulseaudio_functions() {
local -r sink=${1:?$(error 'Sink name is required')}

pa_list_sinks | \
awk -W posix '/^\tName: / {insink = $2 == "'"$sink"'"}
/^\tActive Port: / && insink' | \
awk -W posix '/^[ \t]+Name: / {insink = $2 == "'"$sink"'"}
/^[ \t]+Active Port: / && insink' | \
cut -d' ' -f3-
}

Expand Down Expand Up @@ -766,9 +766,9 @@ define_pulseaudio_functions() {
while IFS=: read -r name description; do
SINK_PORTS["$name"]="$description"
done < <(pa_list_sinks | awk -W posix \
'/^\tName: / {insink = $2 == "'"$sink"'"}
/^\tPorts:/ {inport = insink}
/^\t\t[[:print:]]+: [[:print:]]+ \(/ && inport {
'/^[ \t]+Name: / {insink = ($2 == "'"$sink"'")}
/^[ \t]+Ports:/ {inport = insink}
/^[ \t]+[[:print:]]+: [[:print:]]+ \(/ && inport {
start=index($0, ": ")+2;
end=strlen=index($0, "(");
description=substr($0, start, end-start)
Expand Down

0 comments on commit 7191992

Please sign in to comment.