Subject: Re: "eval" in rc.d/network
To: Jun-ichiro itojun Hagino <itojun@iijlab.net>
From: Robert Elz <kre@munnari.OZ.AU>
List: tech-net
Date: 09/15/2000 01:59:30
    Date:        Thu, 14 Sep 2000 22:50:14 +0900
    From:        Jun-ichiro itojun Hagino <itojun@iijlab.net>
    Message-ID:  <200009141350.e8EDoE102931@itojun.org>

  | 	what is the reason for the use of "eval" in the following?  just to
  | 	strip off the comments in /etc/ifconfig.IF?

That's what I always assumed (comments, and empty lines) .. a rather
expensive way of doing

	sed -e '/^[ 	]*#/d' -e '/^$/d' /etc/ifconfig.$int |
	while read args; do
		ifconfig $int $args
	done

though without requiring "sed" in the path (/usr probably isn't
mounted yet) which is probably the real justification.

Perhaps

	while read args; do
	case "$args" in
		'')	;;
		'#'*)	;;
		*)	ifconfig $int $args ;;
	esac; done </etc/ifconfig.$int

would work more clearly ("read" already strips leading whitespace).

Trailing comments on a line containing ifconfig args have never been
handled, so there's no need to start now.

  | 	actually, I was confused by the fact
  | 		nwid ''
  | 	does not work in ifconfig.wi0, as '' itseif (not the empty string)
  | 	will be passed as the SSID.  

Fixing that would require an eval on the ifconfig, and while it isn't
likely, that could break other stuff.

kre