[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: system/4035: /etc/mygate should allow comments



The following reply was made to PR system/4035; it has been noted by GNATS.

From: Han Boetes <han_(_at_)_mijncomputer_(_dot_)_nl>
To: bugs_(_at_)_openbsd_(_dot_)_org
Cc: gnats_(_at_)_openbsd_(_dot_)_org
Subject: Re: system/4035: /etc/mygate should allow comments
Date: Thu, 16 Dec 2004 08:14:51 +0059

 gaston_(_at_)_9dejulio1020_(_dot_)_com_(_dot_)_ar wrote:
 > The /etc/netstart script doesn't allow comments or more
 > than one line in the config file /etc/mygate, only an IP
 > address. It would be useful when changing networks, and to
 > preserve an old value.
 >
 > # /etc/mygate, if it exists, contains the name of my gateway host
 > # that name must be in /etc/hosts.
 > if [ -f /etc/mygate ]; then
 >    while read line ; do
 >       line=${line%%#*}     # strip comments
 >       test -z "$line" && continue
 >       route -qn delete default > /dev/null 2> &1
 >       route -qn add -host default $line
 >       exit			# allow first entry found only
 >    done < /etc/mygate
 > fi
 
 I would prefer using the function stripcom from /etc/rc of which
 this is a slightly improved version.
 
 stripcom() {
     local _file="$1"
     local _line
     if [ -r "$_file" ]; then
         {   
             while read _line ; do
                 _line=${_line%%#*}
                 [ -n "$_line" ] && echo $_line
             done
         } < $_file
     fi
 }
 
 
 
 # Han



Visit your host, monkey.org