/*
+ * $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
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
- 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>
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 */
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);
int i, f = 0, decoding = FALSE;
char *cp, opt;
+ fi = stdin;
+ fo = stdout;
+
for (i = 1; i < argc; i++) {
cp = argv[i];
if (*cp == '-') {