$Log$
+Revision 400.88 2003/01/29 22:32:07 ajc
+* Shuffled some code and comments around; minor cleanup
+
Revision 400.87 2003/01/28 15:37:12 ajc
* All functions which read binary data from the server now make use of the
read_server_binary() function in tools.c
1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
* webserver.c: warning fix
+
-/* $Id$ */
-
-
+/*
+ * serv_func.c
+ *
+ * Handles various types of data transfer operations with the Citadel service.
+ *
+ * $Id$
+ */
#include <ctype.h>
#include <stdlib.h>
#include <pthread.h>
#include <signal.h>
#include "webcit.h"
-
-
-
-
-
-
+#include "webserver.h"
struct serv_info serv_info;
-
-
/*
* Transmit message text (in memory) to the server.
* If convert_to_html is set to 1, the message is converted into something
-
-
-
/*
* translate server message output to text
* (used for editing room info files and such)
++count;
}
}
+
+
+
+/*
+ * Read binary data from server into memory using a series of
+ * server READ commands.
+ */
+void read_server_binary(char *buffer, size_t total_len) {
+ char buf[SIZ];
+ size_t bytes = 0;
+ size_t thisblock = 0;
+
+ memset(buffer, 0, total_len);
+ while (bytes < total_len) {
+ thisblock = 4095;
+ if ((total_len - bytes) < thisblock) {
+ thisblock = total_len - bytes;
+ if (thisblock == 0) return;
+ }
+ serv_printf("READ %d|%d", (int)bytes, (int)thisblock);
+ serv_gets(buf);
+ if (buf[0] == '6') {
+ thisblock = (size_t)atoi(&buf[4]);
+ serv_read(&buffer[bytes], thisblock);
+ bytes += thisblock;
+ }
+ else {
+ lprintf(3, "Error: %s\n", &buf[4]);
+ return;
+ }
+ }
+}
+
+
* tools.c -- Miscellaneous routines
*/
-
-
#include <ctype.h>
#include <stdlib.h>
#include <unistd.h>
}
-
-/*
- * Read binary data from server into memory using a series of
- * server READ commands.
- */
-void read_server_binary(char *buffer, size_t total_len) {
- char buf[SIZ];
- size_t bytes = 0;
- size_t thisblock = 0;
-
- memset(buffer, 0, total_len);
- while (bytes < total_len) {
- thisblock = 4095;
- if ((total_len - bytes) < thisblock) {
- thisblock = total_len - bytes;
- if (thisblock == 0) return;
- }
- serv_printf("READ %d|%d", (int)bytes, (int)thisblock);
- serv_gets(buf);
- if (buf[0] == '6') {
- thisblock = (size_t)atoi(&buf[4]);
- serv_read(&buffer[bytes], thisblock);
- bytes += thisblock;
- }
- else {
- lprintf(3, "Error: %s<BR>\n", &buf[4]);
- return;
- }
- }
-}
-
-
-
/*
* Strip a boundarized substring out of a string (for example, remove
* parentheses and anything inside them).
}
/* Tell 'em who's in da house */
lprintf(1, SERVER "\n"
-"Copyright (C) 1996-2002 by the Citadel/UX development team.\n"
+"Copyright (C) 1996-2003 by the Citadel/UX development team.\n"
"This software is distributed under the terms of the GNU General Public\n"
"License. If you paid for this software, someone is ripping you off.\n\n");