Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Feb 1998 21:44:46 -0800 (PST)
From:      Doug Ambrisko <ambrisko@whistle.com>
To:        hackers@FreeBSD.ORG
Subject:   Re: a chicken-egg problem with bootp and nfs_mountroot
Message-ID:  <199802270544.VAA08864@crab.whistle.com>
In-Reply-To: <199802270504.VAA26238@dingo.cdrom.com> from Mike Smith at "Feb 26, 98 09:04:07 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
Mike Smith writes:
| > John-Mark Gurney writes:
| > | Doug Ambrisko scribbled this message on Feb 26:
| > | > BTW anyone know how to pass a string in via a #define in config?
| > | 
| > | in your config file:
| > | options	"DEFINENAME=string value"
| > | 
| > | should do it...
| > 
| > 
| > Don't think so for example:
| > 	options	"BOOTP_WIRED_TO=fxp0"
| 
| options "BOOTP_WIRED_TO=\"fxp0\""
| 
| You may need to triple the backslashes, it's been a while since I tried 
| this.

With single, double or triple backslashes I get a syntax error when I run
config.  Archie was close.  Looking in the cpp info page I found this example
>     #define xstr(s) str(s)
>     #define str(s) #s
>     #define foo 4
>     xstr (foo)
>   This expands into `"4"', not `"foo"'.

Doing just
>     #define str(s) #s
>     #define foo 4
>     str (foo)
>   expands to `"foo"'. 

So now I have:
	options "BOOTP_WIRED_TO=fxp0"
and the c-snippet from nfs/bootp_subr.c
	  /*
	   * Find a network interface.
	   */
	  for (ifp = TAILQ_FIRST(&ifnet); ifp != 0; ifp = TAILQ_NEXT(ifp,if_link))
	#ifdef BOOTP_WIRED_TO
	#define xstr(s) str(s)
	#define str(s)  #s
	  {   
	    sprintf(ireq.ifr_name, "%s%d", ifp->if_name,ifp->if_unit);
	    if (strcmp(ireq.ifr_name,xstr(BOOTP_WIRED_TO)) == 0)
	        break;
	  }
	#else 
	     if ((ifp->if_flags &
	      (IFF_LOOPBACK|IFF_POINTOPOINT)) == 0)
	        break;
	#endif

and this works!

Doug A.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199802270544.VAA08864>