X-Git-Url: https://code.citadel.org/?p=citadel.git;a=blobdiff_plain;f=webcit%2Ftcp_sockets.c;h=698bc6835fddd05d9d3522153fb3f679de9a8597;hp=9771fec8f75f2e03847e0e32f4787f897b559ab8;hb=128b2597ff8c0d205b95b54d42c0886105172e05;hpb=97c1253a62acb5a06ca5248ea621628a57a6fb62 diff --git a/webcit/tcp_sockets.c b/webcit/tcp_sockets.c index 9771fec8f..698bc6835 100644 --- a/webcit/tcp_sockets.c +++ b/webcit/tcp_sockets.c @@ -3,8 +3,7 @@ * * TCP socket module for WebCit * - * version 1.3 - * + * $Id$ */ #include @@ -14,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -29,21 +29,14 @@ extern int errno; int serv_sock; -#ifndef DONT_PROTO_HTONS -u_short htons(); -#endif -u_long inet_addr(); - -void timeout() { +void timeout(int signum) { printf("\rConnection timed out.\n"); exit(3); } -int connectsock(host,service,protocol) -char *host; -char *service; -char *protocol; { +int connectsock(char *host, char *service, char *protocol) +{ struct hostent *phe; struct servent *pse; struct protoent *ppe; @@ -112,9 +105,8 @@ char *protocol; { /* * Input binary data from socket */ -void serv_read(buf,bytes) -char buf[]; -int bytes; { +void serv_read(char *buf, int bytes) +{ int len,rlen; len = 0; @@ -135,9 +127,9 @@ int bytes; { /* * input string from pipe */ -void serv_gets(strbuf) -char strbuf[]; { - int ch,len,rlen; +void serv_gets(char *strbuf) +{ + int ch,len; char buf[2]; len = 0; @@ -156,9 +148,8 @@ char strbuf[]; { /* * Attach to a Citadel server */ -void attach_to_server(argc,argv) -int argc; -char *argv[]; { +void attach_to_server(int argc, char **argv) +{ if (argc==1) { server_is_local = 1; serv_sock = connectsock("localhost","citadel","tcp"); @@ -177,9 +168,8 @@ char *argv[]; { /* * send binary to server */ -void serv_write(buf, nbytes) -char buf[]; -int nbytes; { +void serv_write(char *buf, int nbytes) +{ int bytes_written = 0; int retval; while (bytes_written < nbytes) { @@ -200,8 +190,8 @@ int nbytes; { /* * send line to server */ -void serv_puts(string) -char *string; { +void serv_puts(char *string) +{ char buf[256]; sprintf(buf,"%s\n",string);