#include <stdio.h>
#include <string.h>
#include <errno.h>
+#include <libcitadel.h>
#include "citadel.h"
#include "citadel_ipc.h"
-#include "tools.h"
+#include "citadel_dirs.h"
void logoff(int code)
{
static void escapize(char *buf, size_t n) {
char hold[512];
- int i;
+ int i, len;
+ size_t tmp;
strcpy(hold, buf);
strcpy(buf, "");
-
- for (i=0; i<strlen(hold); ++i) {
- size_t tmp = strlen(buf);
-
- if (hold[i]=='<')
+ tmp = 0;
+ len = strlen(hold);
+ for (i=0; i<len; ++i) {
+ if (hold[i]=='<') {
snprintf(&buf[tmp], n - tmp, "<");
- else if (hold[i]=='>')
+ tmp += 4;
+ }
+ else if (hold[i]=='>'){
snprintf(&buf[tmp], n - tmp, ">");
- else if (hold[i]==34)
+ tmp += 4;
+ }
+ else if (hold[i]==34){
snprintf(&buf[tmp], n - tmp, """);
- else
+ tmp += 6;
+ }
+ else{
snprintf(&buf[tmp], n - tmp, "%c", hold[i]);
+ tmp ++;
+ }
}
}
time_t timenow;
char *listing = NULL;
CtdlIPC *ipc = NULL;
+ int relh=0;
+ int home=0;
+ char relhome[PATH_MAX]="";
+ char ctdldir[PATH_MAX]=CTDLDIR;
+
+ CtdlInitBase64Table();
+
+ calc_dirs_n_files(relh, home, relhome, ctdldir, 0);
/* If this environment variable is set, we assume that the program
* is being called as a cgi-bin from a webserver and will output
}
- while (strlen(listing) > 0) {
+ while (!IsEmptyStr(listing)) {
extract_token(buf, listing, 0, '\n', sizeof buf);
remove_token(listing, 0, '\n');