]> code.citadel.org Git - citadel.git/blobdiff - citadel/file_ops.c
* citadel.h: changed internal version number to 6.07
[citadel.git] / citadel / file_ops.c
index ca089bac18224577b25db8132f1f844810f38611..dd5f2bdbd5d871517034f0e9854e42d3c6af04f2 100644 (file)
@@ -16,6 +16,7 @@
 #include <fcntl.h>
 #include <sys/stat.h>
 #include <errno.h>
+#include <ctype.h>
 #include <string.h>
 #include <sys/stat.h>
 
@@ -33,7 +34,7 @@
 #include <limits.h>
 #include "citadel.h"
 #include "server.h"
-#include "dynloader.h"
+#include "serv_extensions.h"
 #include "config.h"
 #include "file_ops.h"
 #include "sysdep_decls.h"
@@ -393,7 +394,7 @@ void cmd_oimg(char *cmdbuf)
        char filename[SIZ];
        char pathname[SIZ];
        struct usersupp usbuf;
-       char which_user[32];
+       char which_user[USERNAME_SIZE];
        int which_floor;
        int a;
 
@@ -680,7 +681,8 @@ void cmd_ucls(char *cmd)
 void cmd_read(char *cmdbuf)
 {
        long start_pos;
-       int bytes;
+       size_t bytes;
+       size_t actual_bytes;
        char buf[4096];
 
        start_pos = extract_long(cmdbuf, 0);
@@ -692,16 +694,12 @@ void cmd_read(char *cmdbuf)
                return;
        }
 
-       if (bytes > 4096) {
-               cprintf("%d You may not read more than 4096 bytes.\n",
-                       ERROR);
-               return;
-       }
+       if (bytes > 4096) bytes = 4096;
 
        fseek(CC->download_fp, start_pos, 0);
-       fread(buf, bytes, 1, CC->download_fp);
-       cprintf("%d %d\n", BINARY_FOLLOWS, bytes);
-       client_write(buf, bytes);
+       actual_bytes = fread(buf, 1, bytes, CC->download_fp);
+       cprintf("%d %d\n", BINARY_FOLLOWS, (int)actual_bytes);
+       client_write(buf, actual_bytes);
 }