Improve shell portability
authorRoy Marples <roy@marples.name>
Wed, 1 Jun 2011 06:20:02 +0000 (06:20 +0000)
committerRoy Marples <roy@marples.name>
Wed, 1 Jun 2011 06:20:02 +0000 (06:20 +0000)
Thanks to jilles@FreeBSD.org
Fixes #15

configure
libc.in
resolvconf.in

index 39bdddb65412d2b2e988e812e0fb8c925103f096..13b68e6741809afe7e97986bfa7d761af5051f7e 100755 (executable)
--- a/configure
+++ b/configure
@@ -9,7 +9,7 @@ TARGET=
 RESTARTCMD=
 RCDIR=
 
-for x; do
+for x do
        opt=${x%%=*}
        var=${x#*=}
        case "$opt" in
diff --git a/libc.in b/libc.in
index 4ceb0d2d038fd383f0fee5bbe475f8aa1f2c7e6f..c542d3b349c9ced080f77f8d0e10f37ed330c084 100644 (file)
--- a/libc.in
+++ b/libc.in
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (c) 2007-2009 Roy Marples
+# Copyright (c) 2007-2011 Roy Marples
 # All rights reserved
 
 # libc subscriber for resolvconf
@@ -160,7 +160,7 @@ for script in "$LIBEXECDIR"/libc.d/*; do
                if [ -x "$script" ]; then
                        "$script" "$@"
                else
-                       (. "$script" "$@")
+                       (. "$script")
                fi
                retval=$(($retval + $?))
        fi
index c3a1aa331690a9b2839bdb99b30022fb2fbee430..3896c3425ec54ffaec0000a2442a4874cbd0ecf9 100644 (file)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (c) 2007-2009 Roy Marples
+# Copyright (c) 2007-2011 Roy Marples
 # All rights reserved
 
 # Redistribution and use in source and binary forms, with or without
@@ -197,7 +197,7 @@ list_resolv()
        # If we have an interface ordering list, then use that.
        # It works by just using pathname expansion in the interface directory.
        if [ -n "$1" ]; then
-               list="$@"
+               list="$*"
                $force || report=true
        else
                cd "$IFACEDIR"
@@ -285,7 +285,7 @@ while getopts a:d:fhIilm:puv OPT; do
        esac
 done
 shift $(($OPTIND - 1))
-args="$iface${iface:+ }$@"
+args="$iface${iface:+ }$*"
 
 # -I inits the state dir
 if [ "$cmd" = I ]; then
@@ -413,7 +413,7 @@ for script in "$LIBEXECDIR"/*; do
                if [ -x "$script" ]; then
                        "$script" "$cmd" "$iface"
                else
-                       (. "$script" "$cmd" "$iface")
+                       (set -- "$cmd" "$iface"; . "$script")
                fi
                retval=$(($retval + $?))
        fi