#endif
#include "sysdep.h"
+#include <stdlib.h>
+#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
/*
- * decode_base64() and encode_base64() are adaptations of code by
+ * CtdlDecodeBase64() and encode_base64() are adaptations of code by
* John Walker, found in full in the file "base64.c" included with this
* distribution. The difference between those functions and these is that
* these are intended to encode/decode small string buffers, and those are
* Convert base64-encoded to binary. Returns the length of the decoded data.
* It will stop after reading 'length' bytes.
*/
-int decode_base64(char *dest, char *source, size_t length)
+int CtdlDecodeBase64(char *dest, char *source, size_t length)
{
int i, c;
int dpos = 0;
}
+/*
+ * Citadelian replacement for tmpnam()
+ */
+char *CtdlTempFileName(char *prefix1, int prefix2) {
+ static int seq = 0;
+ static char buf[SIZ];
+
+ sprintf(buf, "/tmp/Citadel-%s-%d-%04x-%04x",
+ prefix1,
+ prefix2,
+ (int)getpid(),
+ ++seq
+ );
+
+ return(buf);
+}
+
+
+/*
+ * Citadelian replacement for tmpfile()
+ */
+FILE *CtdlTempFile(void) {
+ char filename[SIZ];
+ FILE *fp;
+
+ strcpy(filename, tmpnam(NULL));
+ fp = fopen(filename, "w+b");
+ unlink(filename);
+ return(fp);
+}