]> code.citadel.org Git - citadel.git/blobdiff - citadel/netpoll.c
* The size constant "256" which shows up everywhere as a buffer size has now
[citadel.git] / citadel / netpoll.c
index d9d018cefe73785c8da6f187343fec51f31eb60a..527c7610f2cec3d2b793ccdff0ba6af37a51cf0a 100644 (file)
@@ -1,12 +1,20 @@
-/* $Id$ */
+/* 
+ * $Id$
+ *
+ * Perform data transfer between our Citadel server and another.
+ *
+ */
+
 #include <stdlib.h>
 #include <unistd.h>
 #include <stdio.h>
 #include <fcntl.h>
 #include <string.h>
 #include <errno.h>
+#include <limits.h>
 #include "citadel.h"
 #include "tools.h"
+#include "ipc.h"
 
 /*
  * This variable defines the amount of network spool data that may be carried
@@ -18,7 +26,6 @@
 
 long atol(const char *);
 
-void attach_to_server(int argc, char **argv);
 void serv_read(char *buf, int bytes);
 void serv_write(char *buf, int nbytes);
 void get_config(void);
@@ -38,13 +45,13 @@ void receive_spool(void)
 {
        long download_len;
        long bytes_received;
-       char buf[256];
+       char buf[SIZ];
        static char pbuf[IGNET_PACKET_SIZE];
-       char tempfilename[64];
+       char tempfilename[PATH_MAX];
        long plen;
        FILE *fp;
 
-       sprintf(tempfilename, "/tmp/netpoll.%ld", (long) getpid());
+       strcpy(tempfilename, tmpnam(NULL));
        serv_puts("NDOP");
        serv_gets(buf);
        printf("%s\n", buf);
@@ -88,7 +95,7 @@ void receive_spool(void)
  */
 void transmit_spool(char *remote_nodename)
 {
-       char buf[256];
+       char buf[SIZ];
        char pbuf[4096];
        long plen;
        long bytes_to_write, thisblock;
@@ -141,7 +148,7 @@ ABORTUPL:
 
 int main(int argc, char **argv)
 {
-       char buf[256];
+       char buf[SIZ];
        char remote_nodename[32];
        int a;
 
@@ -153,7 +160,7 @@ int main(int argc, char **argv)
        }
        get_config();
 
-       attach_to_server(argc, argv);
+       attach_to_server(argc, argv, NULL, NULL);
        serv_gets(buf);
        printf("%s\n", buf);
        if ((buf[0] != '2') && (strncmp(buf, "551", 3))) {