aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthe little girl <yui@blekksprut.net>2014-09-05 20:29:48 +0900
committerthe little girl <yui@blekksprut.net>2014-09-05 20:29:48 +0900
commitb1788b537345bd3742459f9d474d101b686d71d9 (patch)
tree13474818a1f0feac2f275ced3153a8ee4251b809
parenta484c4e818bef249a8af571a0f0725bd9d128ff9 (diff)
downloadukulele-b1788b537345bd3742459f9d474d101b686d71d9.tar.xz
fikse alle de små tingene
-rw-r--r--Makefile2
-rw-r--r--wiki.c11
2 files changed, 8 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index a8cd978..0b7ccbf 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
all: wiki.cgi
wiki.cgi: config.h wiki.c
- ${CC} -std=c11 -Os -o $@ wiki.c -lmarxup
+ ${CC} -std=c99 -pedantic -Os -o $@ wiki.c -lmarxup
config.h:
cp config.def.h $@
diff --git a/wiki.c b/wiki.c
index bfb384a..c72b2db 100644
--- a/wiki.c
+++ b/wiki.c
@@ -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 };