Re: getservbyname function gives me problems

From: Fletcher Glenn (fletcher_at_removethisfoglight.com)
Date: 06/27/05

  • Next message: Brian Raiter: "Re: The difference between 0 and NULL?"
    Date: Mon, 27 Jun 2005 20:16:13 GMT
    
    

    Rajan wrote:
    > Hi,
    > On SunOS 5.6 my program looked like this:-
    >
    > #include <stdio.h>
    > #include <netdb.h>
    >
    > int main()
    > {
    > struct servent *serv;
    > serv = getservbyname("ftp","tcp");
    > printf("%d\n",serv->s_port);
    > return 0;
    > }
    >
    > When I compiled this using gcc port.c -lxnet I got the following
    > warnings and errors, can you figure out what it is?
    >
    > In file included from /usr/include/sys/turnstile.h:12,
    > from /usr/include/sys/t_lock.h:20,
    > from /usr/include/sys/vnode.h:37,
    > from /usr/include/sys/stream.h:21,
    > from /usr/include/netinet/in.h:38,
    > from /usr/include/netdb.h:96,
    > from port.c:2:
    > /opt/gnu/lib/gcc-lib/sparc-sun-solaris2.5/2.7.2.1/include/sys/param.h:187:
    > warning: `NBBY' redefined
    > /usr/include/sys/select.h:45: warning: this is the location of the
    > previous definition
    > In file included from /usr/include/sys/stream.h:26,
    > from /usr/include/netinet/in.h:38,
    > from /usr/include/netdb.h:96,
    > from port.c:2:
    > /usr/include/sys/model.h:32: #error "No DATAMODEL_NATIVE specified"
    >

    Works fine for me on SunOS5.6 using a native compiler. From the output
    above, it looks like you have some gnu compiler header issues.

    --
    Fletcher Glenn
    

  • Next message: Brian Raiter: "Re: The difference between 0 and NULL?"

    Relevant Pages

    • Re: data types
      ... Usually short is smaller than an int. ... Your compiler is either *really* old or broken or both. ... recommend either a version of gcc,, or Visual Studio ... Microsoft's Visual Studio Express has an onerous EULA). ...
      (comp.lang.c)
    • Re: data types
      ... Usually short is smaller than an int. ... memory per dms structure if they are 32-bit integers. ... current compiler system. ... recommend either a version of gcc,, or Visual Studio ...
      (comp.lang.c)
    • Re: Question
      ... 3 Assignment of int to unsigned short. ... in C so the compiler is probably borrowing a message from another ... disable warnings. ...
      (comp.lang.c)
    • Re: [OT] Compiler warning level
      ... > I can believe that, I've had to tell it (OK, lclint but they are from ... When the int ... >>to correct some program which will give no warnings up to splint ... > have noticed other bugs that the compiler didn't see. ...
      (comp.lang.c)
    • Re: help with type-punned warning please
      ... >using gcc). ... signal processing CPUs -- and objects with types like "int" and ... If some pointer might ... provided the compiler is sufficiently stupid (and/or run with "do ...
      (comp.lang.c)