#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <unistd.h>
#include <sys/un.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <net/if.h>
#include <netdb.h>
#include <errno.h>
#include <netinet/tcp.h>
#include <fcntl.h>
#define SIGNEDP(x) (((x)-1)<0)
#define SIGNED_(x) (SIGNEDP(x)?"":"un")
int main() {
    printf ("(cl:in-package #:SOCKINT)\n");
    printf ("(cl:eval-when (:compile-toplevel)\n");
    printf ("  (cl:defparameter *integer-sizes* (cl:make-hash-table))\n");
    printf ("  (cl:setf (cl:gethash %d *integer-sizes*) 'sb-alien:char)\n", sizeof(char));
    printf ("  (cl:setf (cl:gethash %d *integer-sizes*) 'sb-alien:short)\n", sizeof(short));
    printf ("  (cl:setf (cl:gethash %d *integer-sizes*) 'sb-alien:long)\n", sizeof(long));
    printf ("  (cl:setf (cl:gethash %d *integer-sizes*) 'sb-alien:int)\n", sizeof(int));
    printf (")\n");
#ifdef AF_INET
    printf ("(cl:defconstant AF-INET %d \"IP Protocol family\")\n", AF_INET);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for AF_INET (unknown to the C compiler).\")\n");
#endif
#ifdef AF_UNSPEC
    printf ("(cl:defconstant AF-UNSPEC %d \"Unspecified\")\n", AF_UNSPEC);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for AF_UNSPEC (unknown to the C compiler).\")\n");
#endif
#ifdef AF_LOCAL
    printf ("(cl:defconstant AF-LOCAL %d \"Local to host (pipes and file-domain).\")\n", AF_LOCAL);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for AF_LOCAL (unknown to the C compiler).\")\n");
#endif
#ifdef SOCK_STREAM
    printf ("(cl:defconstant SOCK-STREAM %d \"Sequenced, reliable, connection-based byte streams.\")\n", SOCK_STREAM);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for SOCK_STREAM (unknown to the C compiler).\")\n");
#endif
#ifdef SOCK_DGRAM
    printf ("(cl:defconstant SOCK-DGRAM %d \"Connectionless, unreliable datagrams of fixed maximum length.\")\n", SOCK_DGRAM);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for SOCK_DGRAM (unknown to the C compiler).\")\n");
#endif
#ifdef SOCK_RAW
    printf ("(cl:defconstant SOCK-RAW %d \"Raw protocol interface.\")\n", SOCK_RAW);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for SOCK_RAW (unknown to the C compiler).\")\n");
#endif
#ifdef SOCK_RDM
    printf ("(cl:defconstant SOCK-RDM %d \"Reliably-delivered messages.\")\n", SOCK_RDM);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for SOCK_RDM (unknown to the C compiler).\")\n");
#endif
#ifdef SOCK_SEQPACKET
    printf ("(cl:defconstant SOCK-SEQPACKET %d \"Sequenced, reliable, connection-based, datagrams of fixed maximum length.\")\n", SOCK_SEQPACKET);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for SOCK_SEQPACKET (unknown to the C compiler).\")\n");
#endif
#ifdef SOL_SOCKET
    printf ("(cl:defconstant SOL-SOCKET %d \"NIL\")\n", SOL_SOCKET);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for SOL_SOCKET (unknown to the C compiler).\")\n");
#endif
#ifdef SO_DEBUG
    printf ("(cl:defconstant SO-DEBUG %d \"Enable debugging in underlying protocol modules\")\n", SO_DEBUG);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for SO_DEBUG (unknown to the C compiler).\")\n");
#endif
#ifdef SO_REUSEADDR
    printf ("(cl:defconstant SO-REUSEADDR %d \"Enable local address reuse\")\n", SO_REUSEADDR);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for SO_REUSEADDR (unknown to the C compiler).\")\n");
#endif
#ifdef SO_TYPE
    printf ("(cl:defconstant SO-TYPE %d \"NIL\")\n", SO_TYPE);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for SO_TYPE (unknown to the C compiler).\")\n");
#endif
#ifdef SO_ERROR
    printf ("(cl:defconstant SO-ERROR %d \"NIL\")\n", SO_ERROR);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for SO_ERROR (unknown to the C compiler).\")\n");
#endif
#ifdef SO_DONTROUTE
    printf ("(cl:defconstant SO-DONTROUTE %d \"Bypass routing facilities: instead send direct to appropriate network interface for the network portion of the destination address\")\n", SO_DONTROUTE);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for SO_DONTROUTE (unknown to the C compiler).\")\n");
#endif
#ifdef SO_BROADCAST
    printf ("(cl:defconstant SO-BROADCAST %d \"Request permission to send broadcast datagrams\")\n", SO_BROADCAST);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for SO_BROADCAST (unknown to the C compiler).\")\n");
#endif
#ifdef SO_SNDBUF
    printf ("(cl:defconstant SO-SNDBUF %d \"NIL\")\n", SO_SNDBUF);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for SO_SNDBUF (unknown to the C compiler).\")\n");
#endif
#ifdef SO_RCVBUF
    printf ("(cl:defconstant SO-RCVBUF %d \"NIL\")\n", SO_RCVBUF);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for SO_RCVBUF (unknown to the C compiler).\")\n");
#endif
#ifdef SO_KEEPALIVE
    printf ("(cl:defconstant SO-KEEPALIVE %d \"Send periodic keepalives: if peer does not respond, we get SIGPIPE\")\n", SO_KEEPALIVE);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for SO_KEEPALIVE (unknown to the C compiler).\")\n");
#endif
#ifdef SO_OOBINLINE
    printf ("(cl:defconstant SO-OOBINLINE %d \"Put out-of-band data into the normal input queue when received\")\n", SO_OOBINLINE);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for SO_OOBINLINE (unknown to the C compiler).\")\n");
#endif
#ifdef SO_NO_CHECK
    printf ("(cl:defconstant SO-NO-CHECK %d \"NIL\")\n", SO_NO_CHECK);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for SO_NO_CHECK (unknown to the C compiler).\")\n");
#endif
#ifdef SO_LINGER
    printf ("(cl:defconstant SO-LINGER %d \"For reliable streams, pause a while on closing when unsent messages are queued\")\n", SO_LINGER);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for SO_LINGER (unknown to the C compiler).\")\n");
#endif
#ifdef SO_SNDLOWAT
    printf ("(cl:defconstant SO-SNDLOWAT %d \"NIL\")\n", SO_SNDLOWAT);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for SO_SNDLOWAT (unknown to the C compiler).\")\n");
#endif
#ifdef SO_RCVLOWAT
    printf ("(cl:defconstant SO-RCVLOWAT %d \"NIL\")\n", SO_RCVLOWAT);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for SO_RCVLOWAT (unknown to the C compiler).\")\n");
#endif
#ifdef SO_SNDTIMEO
    printf ("(cl:defconstant SO-SNDTIMEO %d \"NIL\")\n", SO_SNDTIMEO);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for SO_SNDTIMEO (unknown to the C compiler).\")\n");
#endif
#ifdef SO_RCVTIMEO
    printf ("(cl:defconstant SO-RCVTIMEO %d \"NIL\")\n", SO_RCVTIMEO);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for SO_RCVTIMEO (unknown to the C compiler).\")\n");
#endif
#ifdef TCP_NODELAY
    printf ("(cl:defconstant TCP-NODELAY %d \"NIL\")\n", TCP_NODELAY);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for TCP_NODELAY (unknown to the C compiler).\")\n");
#endif
#ifdef IFNAMSIZ
    printf ("(cl:defconstant IFNAMSIZ %d \"NIL\")\n", IFNAMSIZ);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for IFNAMSIZ (unknown to the C compiler).\")\n");
#endif
#ifdef EADDRINUSE
    printf ("(cl:defconstant EADDRINUSE %d \"NIL\")\n", EADDRINUSE);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for EADDRINUSE (unknown to the C compiler).\")\n");
#endif
#ifdef EAGAIN
    printf ("(cl:defconstant EAGAIN %d \"NIL\")\n", EAGAIN);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for EAGAIN (unknown to the C compiler).\")\n");
#endif
#ifdef EBADF
    printf ("(cl:defconstant EBADF %d \"NIL\")\n", EBADF);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for EBADF (unknown to the C compiler).\")\n");
#endif
#ifdef ECONNREFUSED
    printf ("(cl:defconstant ECONNREFUSED %d \"NIL\")\n", ECONNREFUSED);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for ECONNREFUSED (unknown to the C compiler).\")\n");
#endif
#ifdef ETIMEDOUT
    printf ("(cl:defconstant ETIMEDOUT %d \"NIL\")\n", ETIMEDOUT);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for ETIMEDOUT (unknown to the C compiler).\")\n");
#endif
#ifdef EINTR
    printf ("(cl:defconstant EINTR %d \"NIL\")\n", EINTR);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for EINTR (unknown to the C compiler).\")\n");
#endif
#ifdef EINVAL
    printf ("(cl:defconstant EINVAL %d \"NIL\")\n", EINVAL);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for EINVAL (unknown to the C compiler).\")\n");
#endif
#ifdef ENOBUFS
    printf ("(cl:defconstant ENOBUFS %d \"NIL\")\n", ENOBUFS);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for ENOBUFS (unknown to the C compiler).\")\n");
#endif
#ifdef ENOMEM
    printf ("(cl:defconstant ENOMEM %d \"NIL\")\n", ENOMEM);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for ENOMEM (unknown to the C compiler).\")\n");
#endif
#ifdef EOPNOTSUPP
    printf ("(cl:defconstant EOPNOTSUPP %d \"NIL\")\n", EOPNOTSUPP);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for EOPNOTSUPP (unknown to the C compiler).\")\n");
#endif
#ifdef EPERM
    printf ("(cl:defconstant EPERM %d \"NIL\")\n", EPERM);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for EPERM (unknown to the C compiler).\")\n");
#endif
#ifdef EPROTONOSUPPORT
    printf ("(cl:defconstant EPROTONOSUPPORT %d \"NIL\")\n", EPROTONOSUPPORT);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for EPROTONOSUPPORT (unknown to the C compiler).\")\n");
#endif
#ifdef ESOCKTNOSUPPORT
    printf ("(cl:defconstant ESOCKTNOSUPPORT %d \"NIL\")\n", ESOCKTNOSUPPORT);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for ESOCKTNOSUPPORT (unknown to the C compiler).\")\n");
#endif
#ifdef ENETUNREACH
    printf ("(cl:defconstant ENETUNREACH %d \"NIL\")\n", ENETUNREACH);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for ENETUNREACH (unknown to the C compiler).\")\n");
#endif
#ifdef ENOTCONN
    printf ("(cl:defconstant ENOTCONN %d \"NIL\")\n", ENOTCONN);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for ENOTCONN (unknown to the C compiler).\")\n");
#endif
#ifdef NETDB_INTERNAL
    printf ("(cl:defconstant NETDB-INTERNAL %d \"See errno.\")\n", NETDB_INTERNAL);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for NETDB_INTERNAL (unknown to the C compiler).\")\n");
#endif
#ifdef NETDB_SUCCESS
    printf ("(cl:defconstant NETDB-SUCCESS %d \"No problem.\")\n", NETDB_SUCCESS);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for NETDB_SUCCESS (unknown to the C compiler).\")\n");
#endif
#ifdef HOST_NOT_FOUND
    printf ("(cl:defconstant HOST-NOT-FOUND %d \"Authoritative Answer Host not found.\")\n", HOST_NOT_FOUND);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for HOST_NOT_FOUND (unknown to the C compiler).\")\n");
#endif
#ifdef TRY_AGAIN
    printf ("(cl:defconstant TRY-AGAIN %d \"Non-Authoritative Host not found, or SERVERFAIL.\")\n", TRY_AGAIN);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for TRY_AGAIN (unknown to the C compiler).\")\n");
#endif
#ifdef NO_RECOVERY
    printf ("(cl:defconstant NO-RECOVERY %d \"Non recoverable errors, FORMERR, REFUSED, NOTIMP.\")\n", NO_RECOVERY);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for NO_RECOVERY (unknown to the C compiler).\")\n");
#endif
#ifdef NO_DATA
    printf ("(cl:defconstant NO-DATA %d \"Valid name, no data record of requested type.\")\n", NO_DATA);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for NO_DATA (unknown to the C compiler).\")\n");
#endif
#ifdef NO_ADDRESS
    printf ("(cl:defconstant NO-ADDRESS %d \"No address, look for MX record.\")\n", NO_ADDRESS);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for NO_ADDRESS (unknown to the C compiler).\")\n");
#endif
#ifdef O_NONBLOCK
    printf ("(cl:defconstant O-NONBLOCK %d \"NIL\")\n", O_NONBLOCK);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for O_NONBLOCK (unknown to the C compiler).\")\n");
#endif
#ifdef F_GETFL
    printf ("(cl:defconstant F-GETFL %d \"NIL\")\n", F_GETFL);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for F_GETFL (unknown to the C compiler).\")\n");
#endif
#ifdef F_SETFL
    printf ("(cl:defconstant F-SETFL %d \"NIL\")\n", F_SETFL);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for F_SETFL (unknown to the C compiler).\")\n");
#endif
#ifdef MSG_OOB
    printf ("(cl:defconstant MSG-OOB %d \"NIL\")\n", MSG_OOB);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for MSG_OOB (unknown to the C compiler).\")\n");
#endif
#ifdef MSG_PEEK
    printf ("(cl:defconstant MSG-PEEK %d \"NIL\")\n", MSG_PEEK);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for MSG_PEEK (unknown to the C compiler).\")\n");
#endif
#ifdef MSG_TRUNC
    printf ("(cl:defconstant MSG-TRUNC %d \"NIL\")\n", MSG_TRUNC);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for MSG_TRUNC (unknown to the C compiler).\")\n");
#endif
#ifdef MSG_WAITALL
    printf ("(cl:defconstant MSG-WAITALL %d \"NIL\")\n", MSG_WAITALL);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for MSG_WAITALL (unknown to the C compiler).\")\n");
#endif
    printf ("(cl:eval-when (:compile-toplevel :load-toplevel :execute) (sb-alien:define-alien-type SOCKLEN-T (sb-alien:%ssigned %d)))\n", SIGNED_(socklen_t), (8*sizeof(socklen_t)));
    printf ("(cl:eval-when (:compile-toplevel :load-toplevel :execute) (sb-grovel::define-c-struct PROTOENT %d\n", sizeof(struct protoent));
    printf (" (NAME C-STRING-POINTER \"char *\"\n");
{ struct protoent t;
    printf ("  %d\n", ((unsigned long)&(t.p_name)) - ((unsigned long)&(t)));
}
{ struct protoent t;
    printf ("  %d)\n", sizeof(t.p_name));
}
    printf (" (ALIASES (* (* T)) \"char **\"\n");
{ struct protoent t;
    printf ("  %d\n", ((unsigned long)&(t.p_aliases)) - ((unsigned long)&(t)));
}
{ struct protoent t;
    printf ("  %d)\n", sizeof(t.p_aliases));
}
    printf (" (PROTO INTEGER \"int\"\n");
{ struct protoent t;
    printf ("  %d\n", ((unsigned long)&(t.p_proto)) - ((unsigned long)&(t)));
}
{ struct protoent t;
    printf ("  %d)\n", sizeof(t.p_proto));
}
    printf ("))\n");
    printf ("(cl:declaim (cl:inline GETPROTOBYNAME))\n");
    printf ("(sb-grovel::define-foreign-routine (\"getprotobyname\" GETPROTOBYNAME)\n");
    printf ("  (* PROTOENT)\n  (NAME C-STRING))\n");
#ifdef INADDR_ANY
    printf ("(cl:defconstant INADDR-ANY %d \"NIL\")\n", INADDR_ANY);
#else
    printf ("(sb-int:style-warn \"Couldn't grovel for INADDR_ANY (unknown to the C compiler).\")\n");
#endif
    printf ("(cl:eval-when (:compile-toplevel :load-toplevel :execute) (sb-grovel::define-c-struct IN-ADDR %d\n", sizeof(struct in_addr));
    printf (" (ADDR (ARRAY (UNSIGNED 8)) \"u_int32_t\"\n");
{ struct in_addr t;
    printf ("  %d\n", ((unsigned long)&(t.s_addr)) - ((unsigned long)&(t)));
}
{ struct in_addr t;
    printf ("  %d)\n", sizeof(t.s_addr));
}
    printf ("))\n");
    printf ("(cl:eval-when (:compile-toplevel :load-toplevel :execute) (sb-grovel::define-c-struct SOCKADDR-IN %d\n", sizeof(struct sockaddr_in));
    printf (" (FAMILY INTEGER \"sa_family_t\"\n");
{ struct sockaddr_in t;
    printf ("  %d\n", ((unsigned long)&(t.sin_family)) - ((unsigned long)&(t)));
}
{ struct sockaddr_in t;
    printf ("  %d)\n", sizeof(t.sin_family));
}
    printf (" (PORT (ARRAY (UNSIGNED 8)) \"u_int16_t\"\n");
{ struct sockaddr_in t;
    printf ("  %d\n", ((unsigned long)&(t.sin_port)) - ((unsigned long)&(t)));
}
{ struct sockaddr_in t;
    printf ("  %d)\n", sizeof(t.sin_port));
}
    printf (" (ADDR (ARRAY (UNSIGNED 8)) \"struct in_addr\"\n");
{ struct sockaddr_in t;
    printf ("  %d\n", ((unsigned long)&(t.sin_addr)) - ((unsigned long)&(t)));
}
{ struct sockaddr_in t;
    printf ("  %d)\n", sizeof(t.sin_addr));
}
    printf ("))\n");
    printf ("(cl:eval-when (:compile-toplevel :load-toplevel :execute) (sb-grovel::define-c-struct SOCKADDR-UN %d\n", sizeof(struct sockaddr_un));
    printf (" (FAMILY INTEGER \"sa_family_t\"\n");
{ struct sockaddr_un t;
    printf ("  %d\n", ((unsigned long)&(t.sun_family)) - ((unsigned long)&(t)));
}
{ struct sockaddr_un t;
    printf ("  %d)\n", sizeof(t.sun_family));
}
    printf (" (PATH C-STRING \"char\"\n");
{ struct sockaddr_un t;
    printf ("  %d\n", ((unsigned long)&(t.sun_path)) - ((unsigned long)&(t)));
}
{ struct sockaddr_un t;
    printf ("  %d)\n", sizeof(t.sun_path));
}
    printf ("))\n");
    printf ("(cl:eval-when (:compile-toplevel :load-toplevel :execute) (sb-grovel::define-c-struct HOSTENT %d\n", sizeof(struct hostent));
    printf (" (NAME C-STRING-POINTER \"char *\"\n");
{ struct hostent t;
    printf ("  %d\n", ((unsigned long)&(t.h_name)) - ((unsigned long)&(t)));
}
{ struct hostent t;
    printf ("  %d)\n", sizeof(t.h_name));
}
    printf (" (ALIASES (* C-STRING) \"char **\"\n");
{ struct hostent t;
    printf ("  %d\n", ((unsigned long)&(t.h_aliases)) - ((unsigned long)&(t)));
}
{ struct hostent t;
    printf ("  %d)\n", sizeof(t.h_aliases));
}
    printf (" (TYPE INTEGER \"int\"\n");
{ struct hostent t;
    printf ("  %d\n", ((unsigned long)&(t.h_addrtype)) - ((unsigned long)&(t)));
}
{ struct hostent t;
    printf ("  %d)\n", sizeof(t.h_addrtype));
}
    printf (" (LENGTH INTEGER \"int\"\n");
{ struct hostent t;
    printf ("  %d\n", ((unsigned long)&(t.h_length)) - ((unsigned long)&(t)));
}
{ struct hostent t;
    printf ("  %d)\n", sizeof(t.h_length));
}
    printf (" (ADDRESSES (* (* (UNSIGNED 8))) \"char **\"\n");
{ struct hostent t;
    printf ("  %d\n", ((unsigned long)&(t.h_addr_list)) - ((unsigned long)&(t)));
}
{ struct hostent t;
    printf ("  %d)\n", sizeof(t.h_addr_list));
}
    printf ("))\n");
    printf ("(cl:declaim (cl:inline SOCKET))\n");
    printf ("(sb-grovel::define-foreign-routine (\"socket\" SOCKET)\n");
    printf ("  INT\n  (DOMAIN INT)\n  (TYPE INT)\n  (PROTOCOL INT))\n");
    printf ("(cl:declaim (cl:inline BIND))\n");
    printf ("(sb-grovel::define-foreign-routine (\"bind\" BIND)\n");
    printf ("  INT\n  (SOCKFD INT)\n  (MY-ADDR (* T))\n  (ADDRLEN INT))\n");
    printf ("(cl:declaim (cl:inline LISTEN))\n");
    printf ("(sb-grovel::define-foreign-routine (\"listen\" LISTEN)\n");
    printf ("  INT\n  (SOCKET INT)\n  (BACKLOG INT))\n");
    printf ("(cl:declaim (cl:inline ACCEPT))\n");
    printf ("(sb-grovel::define-foreign-routine (\"accept\" ACCEPT)\n");
    printf ("  INT\n  (SOCKET INT)\n  (MY-ADDR (* T))\n  (ADDRLEN INT :IN-OUT))\n");
    printf ("(cl:declaim (cl:inline GETPEERNAME))\n");
    printf ("(sb-grovel::define-foreign-routine (\"getpeername\" GETPEERNAME)\n");
    printf ("  INT\n  (SOCKET INT)\n  (HER-ADDR (* T))\n  (ADDRLEN INT :IN-OUT))\n");
    printf ("(cl:declaim (cl:inline GETSOCKNAME))\n");
    printf ("(sb-grovel::define-foreign-routine (\"getsockname\" GETSOCKNAME)\n");
    printf ("  INT\n  (SOCKET INT)\n  (MY-ADDR (* T))\n  (ADDRLEN INT :IN-OUT))\n");
    printf ("(cl:declaim (cl:inline CONNECT))\n");
    printf ("(sb-grovel::define-foreign-routine (\"connect\" CONNECT)\n");
    printf ("  INT\n  (SOCKET INT)\n  (HIS-ADDR (* T))\n  (ADDRLEN INT))\n");
    printf ("(cl:declaim (cl:inline CLOSE))\n");
    printf ("(sb-grovel::define-foreign-routine (\"close\" CLOSE)\n");
    printf ("  INT\n  (FD INT))\n");
    printf ("(cl:declaim (cl:inline RECVFROM))\n");
    printf ("(sb-grovel::define-foreign-routine (\"recvfrom\" RECVFROM)\n");
    printf ("  INT\n  (SOCKET INT)\n  (BUF (* T))\n  (LEN INTEGER)\n  (FLAGS INT)\n  (SOCKADDR (* T))\n  (SOCKLEN (* SOCKLEN-T)))\n");
    printf ("(cl:declaim (cl:inline GETHOSTBYNAME))\n");
    printf ("(sb-grovel::define-foreign-routine (\"gethostbyname\" GETHOSTBYNAME)\n");
    printf ("  (* HOSTENT)\n  (NAME C-STRING))\n");
    printf ("(cl:declaim (cl:inline GETHOSTBYADDR))\n");
    printf ("(sb-grovel::define-foreign-routine (\"gethostbyaddr\" GETHOSTBYADDR)\n");
    printf ("  (* HOSTENT)\n  (ADDR (* T))\n  (LEN INT)\n  (AF INT))\n");
    printf ("(cl:declaim (cl:inline SETSOCKOPT))\n");
    printf ("(sb-grovel::define-foreign-routine (\"setsockopt\" SETSOCKOPT)\n");
    printf ("  INT\n  (SOCKET INT)\n  (LEVEL INT)\n  (OPTNAME INT)\n  (OPTVAL (* T))\n  (OPTLEN INT))\n");
    printf ("(cl:declaim (cl:inline FCNTL))\n");
    printf ("(sb-grovel::define-foreign-routine (\"fcntl\" FCNTL)\n");
    printf ("  INT\n  (FD INT)\n  (CMD INT)\n  (ARG LONG))\n");
    printf ("(cl:declaim (cl:inline GETSOCKOPT))\n");
    printf ("(sb-grovel::define-foreign-routine (\"getsockopt\" GETSOCKOPT)\n");
    printf ("  INT\n  (SOCKET INT)\n  (LEVEL INT)\n  (OPTNAME INT)\n  (OPTVAL (* T))\n  (OPTLEN (* INT)))\n");
return 0;
}
