]> code.citadel.org Git - citadel.git/blobdiff - citadel/base64.c
* Replaced all "Citadel/UX" references with "Citadel"
[citadel.git] / citadel / base64.c
index 5925f977ac3b61342db75bdbcfe4361279cd6d16..c9717d145bb788d9456981c25160f23364311835 100644 (file)
@@ -1,15 +1,12 @@
 /*
+ * $Id$
+ *
+ * Encode or decode file as MIME base64 (RFC 1341)
+ * Public domain by John Walker, August 11 1997
+ * Modified slightly for the Citadel system, June 1999
+ *
+ */
 
-          Encode or decode file as MIME base64 (RFC 1341)
-
-                           by John Walker
-                      http://www.fourmilab.ch/
-
-               This program is in the public domain.
-
-*/
-
-#define REVDATE "11th August 1997"
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -23,8 +20,8 @@
 
 typedef unsigned char byte;          /* Byte type */
 
-static FILE *fi = stdin;             /* Input file */
-static FILE *fo = stdout;            /* Output file */
+FILE *fi;                            /* Input file */
+FILE *fo;                            /* Output file */
 static byte iobuf[256];              /* I/O buffer */
 static int iolen = 0;                /* Bytes left in I/O buffer */
 static int iocp = 256;               /* Character removal pointer */
@@ -43,7 +40,7 @@ static int inbuf(void)
     if (ateof) {
        return FALSE;
     }
-    l = fread(iobuf, 1, 256, fi);     /* Read input buffer */
+    l = fread(iobuf, 1, sizeof iobuf, fi);     /* Read input buffer */
     if (l <= 0) {
        if (ferror(fi)) {
            exit(1);
@@ -245,6 +242,9 @@ int main(int argc, char *argv[])
     int i, f = 0, decoding = FALSE;
     char *cp, opt;
 
+    fi = stdin;
+    fo = stdout;
+
     for (i = 1; i < argc; i++) {
        cp = argv[i];
         if (*cp == '-') {