Remove vim comments and fix formatting a little.
[openresolv] / resolvconf.in
index 111c27ed78cabfe938afba2d81b887a68a4ea643..d76a0e085c01e96b046de0465105eaadebabdba2 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright 2007 Roy Marples
+# Copyright 2007-2008 Roy Marples
 # All rights reserved
 
 # Redistribution and use in source and binary forms, with or without
@@ -104,16 +104,16 @@ if [ "x${CMD}" = "x-s" ]; then
        # If restarting check if service is running or not if we can
        if [ "x${ACTION}" = "xrestart" ]; then
                if [ -s /var/run/"${SERVICE}".pid ]; then
-                       kill -0 $(cat /var/run/"${SERVICE}".pid)
+                       kill -0 $(cat /var/run/"${SERVICE}".pid) 2>/dev/null
                elif [ -s /var/run/"${SERVICE}"/"${SERVICE}".pid ]; then
-                       kill -0 $(cat /var/run/"${SERVICE}".pid)
+                       kill -0 $(cat /var/run/"${SERVICE}".pid) 2>/dev/null
                elif [ -s /var/run/"${SERVICE}"/pid ]; then
-                       kill -0 $(cat /var/run/"${SERVICE}"/pid)
+                       kill -0 $(cat /var/run/"${SERVICE}"/pid) 2>/dev/null
                else
                        false
                fi
                # Service not running, so don't restart
-               [ $? != 0 ] && exit 1
+               [ $? != 0 ] && exit 0
        fi      
        if [ -x /sbin/service ]; then
                service "${SERVICE}" "${ACTION}" "$@" 
@@ -180,7 +180,8 @@ if [ "x${CMD}" = "x-v" ]; then
        NEWSEARCH=
        NEWNS=
        NEWDOMAIN=
-       LINES="$("${argv0}" -l "${IFACE}" | sed -e "s/'/'\\\\''/g" -e "s/^/'/g" -e "s/$/'/g")"
+       LINES="$("${argv0}" -l "${IFACE}" |
+               sed -e "s/'/'\\\\''/g" -e "s/^/'/g" -e "s/$/'/g")"
        eval set -- ${LINES}
        for LINE in "$@"; do
                case "${LINE}" in
@@ -226,8 +227,10 @@ if [ "x${CMD}" = "x-v" ]; then
        for S in ${NEWSEARCH}; do
                for DN in ${NEWDOMAIN}; do
                        if [ "${S%,*}" = "${DN%,*}" ]; then
-                               NEWSEARCH="$(echo "${NEWSEARCH}" | sed -e "s/${S}/${DN}/g")"
-                               NEWDOMAIN="$(echo "${NEWDOMAIN}" | sed -e "s/${DN}//g")"
+                               NEWSEARCH="$(echo "${NEWSEARCH}" |
+                                       sed -e "s/${S}/${DN}/g")"
+                               NEWDOMAIN="$(echo "${NEWDOMAIN}" |
+                                       sed -e "s/${DN}//g")"
                                break
                        fi
                done
@@ -305,5 +308,3 @@ for x in "${UPDATED}"/*; do
 done
 
 exit ${retval}
-
-# vim: set ts=4 :