read the IP automatically???

Li-Kai Liu news@likai.net
Fri Sep 21 08:01:00 GMT 2001


if you just want to run the program on cygwin, then simple enough, you 
can just parse the output from ipconfig.exe

but if you want to maintain a cross compatibility with linux, then i 
have a gift for you. it is a ipconfig to dhcpcd wrapper. it is written 
in perl and it emulates a subset of what linux dhcpcd has to offer. 
after you run dhcpcd, the file containing gateway and interface IP is 
generated at /etc/dhcpc/dhcpcd-ethn.info (whereas ethn is the linux 
style interface name, such as eth0, eth1, eth2, ...)

this is a primitive hack, and it has proven to be workable.

installation: just put the file in /sbin where linux usually put it.

if you run into problems, first check if you have /etc/dhcpc directory 
set with a permission that dhcpcd can access. dhcpcd is a user mode 
program that does not bear special privilege. also, it does not perform 
error checking. so if there is an error with ipconfig, you will get an 
empty /etc/dhcpc/dhcpcd-ethn.info file. there will be more ways to break 
dhcpcd, so please bear with me. i haven't worked on it for a long time, 
and if it is needed, i *could* ...

liulk

hongxun lee wrote:

>Hi, all
>cygwin/xfree is installed on win2000. Is it possible to read the IP
>automatically (and then exported to a variale for display configration)
>whenevr xwindow is started? Thanks
>
>
>
>--
>Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
>Bug reporting:         http://cygwin.com/bugs.html
>Documentation:         http://cygwin.com/docs.html
>FAQ:                   http://cygwin.com/faq/
>
>




More information about the Cygwin mailing list