autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

inet_addr? inet_aton?


From: Austin Schutz
Subject: inet_addr? inet_aton?
Date: Thu, 8 Aug 2002 13:43:01 -0700
User-agent: Mutt/1.2.5i

        I'm not an especially seasoned C programmer, so I apologize if
this is a dumb question:

        In order to speed up a Perl program I wrote a module in C. This
module has code to do the most mundane of tasks: convert an ipv4 address
into a long.
        My local system is Linux, which has:

int inet_aton(const char *cp, struct in_addr *inp);)

        but I would like it to be able to run on other systems, such as
Solaris, which doesn't have inet_aton, but has:

in_addr_t inet_addr(const char *cp);


        now, I've read various docs and I understand now, or at least will
be able to figure out, how to use autoconf to detect which is available,
then write #ifdefs, and pray that the user isn't on some platform which has
different semantics for e.g. inet_addr() (or doesn't have it at all!) on their
platform than are described in my system's man page.
        But this seems like too much work. Why should I even need to be aware
that inet_aton() doesn't exist on other platforms? Why shouldn't I be able
to do something like my_inet_int = AC_INET_ADDR(my_inet_string)? Surely
lots of folks have written the #ifdefs. Why not include them with autoconf
so I can be lazy and uninformed? :-)

        Austin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]