On Sun, Mar 1, 2009 at 2:25 AM, Andrew McGlashan <andrew.mcglas...@affinityvision.com.au> wrote: > Hi, > > Aneurin Price wrote: >> >> On Fri, Feb 27, 2009 at 12:36 PM, Andrew McGlashan >> <andrew.mcglas...@affinityvision.com.au> wrote: >>> >>> Aneurin Price wrote: >>>> >>>> Maybe this would suit you: >>>> http://www.geekpage.jp/en/programming/linux-network/get-ipaddr.php >>>> (Changing eth0 to ppp0 obviously) >>> >>> Okay. >>>> >>>> NB. To get that example to work I had to change the includes as >>> >>> I got it to work fine without _any_ changes. >> >> That's interesting. I got a segfault, which turned out to be caused by >> include problems; -Wall says: >> test.c: In function ‘main’: >> test.c:27: warning: implicit declaration of function ‘close’ >> test.c:30: warning: implicit declaration of function ‘inet_ntoa’ >> test.c:30: warning: format ‘%s’ expects type ‘char *’, but argument 2 >> has type ‘int’ >> >> I wonder why my headers don't declare the same things as yours... > > Perhaps it is the Debian version or architecture. I actully did it on an > Etch i686 system
Ah, that's it. The includes really are wrong - if you compile with -Wall you should get the same warnings. It just happens to work on a machine where sizeof(char*) == sizeof(int) - ie. not AMD64. Tested with -m32 and it runs without segfaulting. Nye -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org