On Tue, 23 Mar 1999, Mark Riehl wrote:
> Can't you use an ioctl() call for this?
> On Tue, 23 Mar 1999, Pauline Middelink wrote:
> > Chuck Gadd wrote:
> > [snipped]
> > > ISP_IP=`ifconfig ppp0 |grep 'inet addr'| awk '{print $2}'|sed -e "s/addr\://"`
> > > echo $ISP_IP
> > 
> > Please! don't go suggesting that we have to run scripts in C/C++ to get
> > this kind of information! the overhead is staggering!

Yes.  The SIOCGIFADDR ioctl() ought to translate an interface name to an 
IP address.  See for example Stevens' _UNIX Network Programming_ V1 2/e, 
chapter 16.

(This is using the word "device" a little loosely:  there's no way to
create a device-special-file inode to refer to a network interface.  "In
Unix, everything looks like a file" *unless* it's a network. :-/  Old
DECnet hackers find this amazingly convoluted, but to each his own.)

-- 
Mark H. Wood, radical centrist                             [EMAIL PROTECTED]
Charlie, put down that Glitter Glue -- it's time to show the audience
some content!

-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to [EMAIL PROTECTED]

Reply via email to