diff options
Diffstat (limited to 'wiki.c')
-rw-r--r-- | wiki.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -92,7 +92,10 @@ int redirect(char *path) { printf("Status: 303\n"); switch(*path) { case '?': printf("Location: %s\n\n", path); break; - // case '#': + case '#': + printf("Location: %s/%s?m=", script, path); + // skrive ut ++path + printf("\n"); default: printf("Location: %s/%s\n\n", script, path); break; } return 0; @@ -134,11 +137,11 @@ int store(char *raw, int len) { char *id = basename(strdup(raw)); if(chdir(dir)) return problem(404, "Not found"); - char path[strlen(id) + strlen(loft) + 256]; + char path[strlen(loft) + strlen(id) + 256]; int epoch = time(NULL); - snprintf(path, strlen(id) + strlen(loft) + 256, "%s/%s.%d", loft, id, epoch); + snprintf(path, strlen(loft) + strlen(id) + 256, "%s/%s.%d", loft, id, epoch); FILE *fp = fopen(path, "w"); - if(!fp) return redirect("#"); + if(!fp) return redirect("FFFF"); int pos = 0; unsigned int decoded; char buffer[3] = { 0 }; |