Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Jan 2002 22:44:29 -0800 (PST)
From:      George Genovezos <ggenovez@hotmail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/33506: inet.h incomplete type
Message-ID:  <200201030644.g036iTH61359@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         33506
>Category:       ports
>Synopsis:       inet.h incomplete type
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jan 02 22:50:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     George Genovezos
>Release:        4-3 release
>Organization:
Getthere 
>Environment:
FreeBSD dhcp-13-2.dsl.att.net 4.3-RELEASE FreeBSD 4.3-RELEASE #2: Mon Aug  6 02:00:34 GMT 2001     root@dhcp-13-2.dsl.att.net:/usr/src/sys/compile/FIREWALL  i386
>Description:
Constatly getting errors with gcc 2.8 2.9 & 30 errors are listed below

/usr/include/arpa/inet.h:89: warning: parameter has incomplete type
/usr/include/arpa/inet.h:92: warning: parameter has incomplete type
/usr/include/arpa/inet.h:96: warning: parameter has incomplete type

These errors do not occure with my lynux box (bleah). Source was take out of a Unix programming book.
>How-To-Repeat:
      #include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <errno.h>
#include <arpa/inet.h>
#include "safecalls.h"

#define PROTOCOL "tcp"
#define REQUEST "GET / HTTP/1.0\n\n"

int write_buffer(int fd, const void *buf, int count);

int main(int argc, char *argv[]) {
  int sockid;
  struct servent *serviceaddr;
  struct hostent *hostaddr;
  struct protoent *protocol;
  struct sockaddr_in *sockaddr;
  char buffer[1024];
  int count;

  /******** Step 1: resolve names and generate the socket structure. */

  /* First, initialize the socketaddr. */
  bzero((char *) &sockaddr, sizeof(sockaddr));
  sockaddr.sin_family = AF_INET;

  /* Resolve the service name. */

  serviceaddr = getservbyname(argv[2], PROTOCOL);
  if (!serviceaddr) {
    HandleError(0, "getservbyname", "service resolution failed");
  }
  sockaddr.sin_port = serviceaddr->s_port;

  /* Resolve the host name. */

  hostaddr = gethostbyname(argv[1]);
  if (!hostaddr) {
    HandleError(0, "gethostbyname", "host resolution failed");
  }

  memcpy(&sockaddr.sin_addr, hostaddr->h_addr, hostaddr->h_length);

  /* Resolve the protocol name. */

  protocol = getprotobyname(PROTOCOL);
  if (!protocol) {
    HandleError(0, "getprotobyname", "protocol resolution failed");
  }
  /* Note: using SOCK_STREAM below since this is only TCP. */

  /********* Step 2: Create the socket for this end. */

  sockid = socket(PF_INET, SOCK_STREAM, protocol->p_proto);
  if (sockid < 0) {
    HandleError(errno, "socket", "couldn't create socket");
  }

  /********* Step 3: Connect the socket to the server.  (Almost done!) */

  if (connect(sockid, &sockaddr, sizeof(sockaddr)) < 0) {
    HandleError(errno, "connect", "connect call failed");
  }

  /********************************************************************/

  /* The channel for communication to the server has now been established.
     Now, request the document at the server root. */

  write_buffer(sockid, REQUEST, strlen(REQUEST));
 
  /* Request has been sent.  Read the result. */
 
  while ((count = saferead(sockid, buffer, sizeof(buffer) - 1))) {
    write_buffer(1, buffer, count);
  }
 
  return 0;
}
 
int write_buffer(int fd, const void *buf, int count) {
  const void *pts = buf;
  int  status = 0, n;
 
  if (count < 0) return (-1);
 
  while (status != count) {
    n = safewrite(fd, pts+status, count-status);
    if (n < 0) return (n);
    status += n;
  }
  return (status);
}
>Fix:
      
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200201030644.g036iTH61359>