-/* Copyright (C) 1996,1997,1998 Free Software Foundation, Inc.
+/* Copyright (C) 1996,1997,1998, 2000 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include <stdio.h>
-#include "_scm.h"
-#include "unif.h"
-#include "feature.h"
-#include "fports.h"
-#include "strings.h"
-#include "vectors.h"
+#include "libguile/_scm.h"
+#include "libguile/unif.h"
+#include "libguile/feature.h"
+#include "libguile/fports.h"
+#include "libguile/strings.h"
+#include "libguile/vectors.h"
-#include "validate.h"
-#include "socket.h"
+#include "libguile/validate.h"
+#include "libguile/socket.h"
#ifdef HAVE_STRING_H
#include <string.h>
#define FUNC_NAME s_scm_getsockopt
{
int fd;
- int optlen;
+ size_t optlen;
#ifdef HAVE_STRUCT_LINGER
char optval[sizeof (struct linger)];
#else
int ioptname;
#ifdef HAVE_STRUCT_LINGER
- optlen = (int) sizeof (struct linger);
+ optlen = sizeof (struct linger);
#else
- optlen = (int) sizeof (scm_sizet);
+ optlen = sizeof (size_t);
#endif
sock = SCM_COERCE_OUTPORT (sock);
- SCM_VALIDATE_OPFPORT (1,sock);
- SCM_VALIDATE_INUM_COPY (2,level,ilevel);
- SCM_VALIDATE_INUM_COPY (3,optname,ioptname);
+ SCM_VALIDATE_OPFPORT (1, sock);
+ SCM_VALIDATE_INUM_COPY (2, level, ilevel);
+ SCM_VALIDATE_INUM_COPY (3, optname, ioptname);
fd = SCM_FPORT_FDES (sock);
if (getsockopt (fd, ilevel, ioptname, (void *) optval, &optlen) == -1)
/* Allocate a buffer large enough to hold any sockaddr type. */
static char *scm_addr_buffer;
-static int scm_addr_buffer_size;
+static size_t scm_addr_buffer_size;
static void
scm_init_addr_buffer (void)
{
scm_addr_buffer_size =
#ifdef HAVE_UNIX_DOMAIN_SOCKETS
- (int) sizeof (struct sockaddr_un)
+ sizeof (struct sockaddr_un)
#else
0
#endif
;
if (sizeof (struct sockaddr_in) > scm_addr_buffer_size)
- scm_addr_buffer_size = (int) sizeof (struct sockaddr_in);
+ scm_addr_buffer_size = sizeof (struct sockaddr_in);
scm_addr_buffer = scm_must_malloc (scm_addr_buffer_size, "address buffer");
}
SCM address;
SCM newsock;
- int tmp_size;
+ size_t tmp_size;
sock = SCM_COERCE_OUTPORT (sock);
SCM_VALIDATE_OPFPORT (1,sock);
fd = SCM_FPORT_FDES (sock);
"in the @code{AF_FILE} namespace cannot be read.")
#define FUNC_NAME s_scm_getsockname
{
- int tmp_size;
+ size_t tmp_size;
int fd;
SCM result;
sock = SCM_COERCE_OUTPORT (sock);
"in the @code{AF_FILE} namespace cannot be read.")
#define FUNC_NAME s_scm_getpeername
{
- int tmp_size;
+ size_t tmp_size;
int fd;
SCM result;
sock = SCM_COERCE_OUTPORT (sock);
"The optional @var{flags} argument is a value or\n"
"bitwise OR of MSG_OOB, MSG_PEEK, MSG_DONTROUTE etc.\n\n"
"The value returned is the number of bytes read from the socket.\n\n"
- "Note that the data is read directly from the socket file descriptor:any unread buffered port data is ignored.")
+ "Note that the data is read directly from the socket file descriptor:\n"
+ "any unread buffered port data is ignored.")
#define FUNC_NAME s_scm_recv
{
int rv;
int flg;
int offset = 0;
int cend;
- int tmp_size;
+ size_t tmp_size;
SCM address;
SCM_VALIDATE_OPFPORT (1,sock);
scm_add_feature ("socket");
scm_init_addr_buffer ();
-#include "socket.x"
+#include "libguile/socket.x"
}