[alsa-devel] [PATCH 4/8] Fix bashisms.

Jordi Mallach jordi at debian.org
Wed May 15 19:19:07 CEST 2013


From: Elimar Riesebieter <riesebie at lxtec.de>

The “function” builtin is a bashism that can be simply omitted with
no behaviour change, if parentheses are supplied.

Signed-off-by: Jordi Mallach <jordi at debian.org>
---
 ld10k1/setup/init_live.in |   64 ++++++++++++++++++++++-----------------------
 1 file changed, 32 insertions(+), 32 deletions(-)

diff --git a/ld10k1/setup/init_live.in b/ld10k1/setup/init_live.in
index 70d30c8..5e6580f 100644
--- a/ld10k1/setup/init_live.in
+++ b/ld10k1/setup/init_live.in
@@ -46,7 +46,7 @@ std_playback=playback
 std_capture=capture
 #std_capture=capture_noswitch
 
-function log
+log
 {
     local level=$1
 
@@ -57,7 +57,7 @@ function log
     fi
 }
 
-function runlo10k1
+runlo10k1
 {
     log 2 $LO10K1 "$@"
 
@@ -71,7 +71,7 @@ function runlo10k1
     fi
 }
 
-function rename
+rename
 {
     port=$1
     name=$2
@@ -81,7 +81,7 @@ function rename
     runlo10k1 --renam "$port=$name"
 }
 
-function connect
+connect
 {
     from=$1
     op=$2
@@ -92,7 +92,7 @@ function connect
     runlo10k1 --conadd "$from$op$to"
 }
 
-function copy
+copy
 {
     local name=$1
     local port=$2
@@ -105,7 +105,7 @@ function copy
     connect "PIN($name Copy)" '=' "$port"
 }
 
-function volume
+volume
 {
     local name=$1
     local port=$2
@@ -120,7 +120,7 @@ function volume
     connect "PIN($name Volume)" '=' "$port"
 }
 
-function master_volume
+master_volume
 {
     local name=$1
     local port=$2
@@ -135,7 +135,7 @@ function master_volume
     connect "$port" '=' "PIN($name Volume)"
 }
 
-function switch
+switch
 {
     local name=$1
     local port=$2
@@ -150,7 +150,7 @@ function switch
     connect "PIN($name Switch)" '>' "$port"
 }
 
-function switch_2x2
+switch_2x2
 {
     local name=$1
     local port1=$2
@@ -166,7 +166,7 @@ function switch_2x2
     connect "PIN($name Switch,2,3)" '>' "$port2"
 }
 
-function switch_5x2
+switch_5x2
 {
     local name=$1
     local port1=$2
@@ -182,7 +182,7 @@ function switch_5x2
     connect "PIN($name Switch,5,6,7,8,9)" '>' "$port2"
 }
 
-function master_switch
+master_switch
 {
     local name=$1
     local port=$2
@@ -197,7 +197,7 @@ function master_switch
     connect "PIN($name Switch)" '=' "$port"
 }
 
-function playback
+playback
 {
     name=$1
     port=$2
@@ -211,7 +211,7 @@ function playback
     add_output "POUT($name Playback Volume)"
 }
 
-function playback_noswitch
+playback_noswitch
 {
     name=$1
     port=$2
@@ -224,7 +224,7 @@ function playback_noswitch
     add_output "POUT($name Playback Volume)"
 }
 
-function capture
+capture
 {
     name=$1
     port=$2
@@ -238,7 +238,7 @@ function capture
     connect "POUT($name Capture Volume)" '>' "OUT(OUT_PCM_Capture_Left,OUT_PCM_Capture_Right)"
 }
 
-function capture_noswitch
+capture_noswitch
 {
     name=$1
     port=$2
@@ -251,7 +251,7 @@ function capture_noswitch
     connect "POUT($name Capture Volume)" '>' "OUT(OUT_PCM_Capture_Left,OUT_PCM_Capture_Right)"
 }
 
-function master
+master
 {
     local name=$1
     local port=$2
@@ -264,48 +264,48 @@ function master
     master_switch "$name Playback" "POUT($name Playback Volume)" 1 $index
 }
 
-function dump_patches
+dump_patches
 {
-    num=$1
+    max=$(( ${1} - 1 ))
+    line=$(seq -s ' ' 0 $max)
 
-    for (( i=0; $i < $num; i=$i+1 )); do
-	p=$(( $i + 100))
-	runlo10k1 --debug $p
+    for i in ${line}; do
+      p=$(( $i + 100))
+      runlo10k1 --debug $p
     done
 
-
     exit
 }
 
-function add_output
+add_output
 {
     local port=$1
 
     $add_output_func "$port"
 }
 
-function add_output_tone_2
+add_output_tone_2
 {
     local port=$1
 
     connect "$port" '>' "PIN(Tone Control,0,1)"
 }
 
-function add_output_simple_2
+add_output_simple_2
 {
     local port=$1
 
     connect "$port" '>' "PIN(Wave Simple Stereo To 51,0,1)"
 }
 
-function add_output_prologic_2
+add_output_prologic_2
 {
     local port=$1
 
     connect "$port" '>' "PIN(Wave Prologic,0,1)"
 }
 
-function add_output_switched_2
+add_output_switched_2
 {
     local port=$1
 
@@ -314,7 +314,7 @@ function add_output_switched_2
 }
 
 
-function simple_stereo_to_51
+simple_stereo_to_51
 {
     local name=$1
     local control=$2
@@ -330,7 +330,7 @@ function simple_stereo_to_51
     fi
 }
 
-function prologic
+prologic
 {
     local name=$1
     local control=$2
@@ -351,7 +351,7 @@ function prologic
     connect "POUT($name Prologic)" '=' "PIN($name Multi Volume,0,1,2,3,4,5)"
 }
 
-function tone
+tone
 {
     local name=$1
     local port=$2
@@ -364,7 +364,7 @@ function tone
     runlo10k1 -n --ctrl "c-bass0,bass1,bass2,bass3,bass4:$name - Bass,t-$name - Bass:2,v-$name - Bass:1,c-treble0,treble1,treble2,treble3,treble4:$name - Treble,t-$name - Treble:3,v-$name - Treble:1,c-toneonoff:$name - Switch,t-$name - Switch:4" --patch_name "${name}" -a tone.emu10k1
 }
 
-function multi_playback
+multi_playback
 {
     local name=$1
     local port=$2
@@ -383,7 +383,7 @@ function multi_playback
     connect "POUT($name Multi Volume)" '>' "PIN(Tone Control)"
 }
 
-function fxbus
+fxbus
 {
     local name=$1
     local enable_pcm_fx89=$2
-- 
1.7.10.4



More information about the Alsa-devel mailing list