diff options
author | the little girl <yui@blekksprut.net> | 2013-12-13 17:46:59 +0100 |
---|---|---|
committer | the little girl <yui@blekksprut.net> | 2013-12-13 17:46:59 +0100 |
commit | 2fc72187ec46064ee9d96570851993ff13f2fe49 (patch) | |
tree | beeb0537c4d369429504179f6806ed0952936c6a | |
parent | d1140db2972796f190b64d0b59698d44df4c23fd (diff) | |
download | ukulele-2fc72187ec46064ee9d96570851993ff13f2fe49.tar.xz |
vise hele path for ting i mapper, finere dir listan
-rw-r--r-- | wiki.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -37,9 +37,9 @@ void head(char *page, char *link, char *what) { printf("<title>%s ยท %s</title>\n", title, page); printf("<link rel='stylesheet' href='%s/wiki.css'>\n", base); if(link && what && !strcmp(what, "rediger")) - printf("<h1><a data-text='%s' href='%s' >%s</a></h1>\n", what, link, page); + printf("<h1><a data-text='%s' href='%s'>%s</a></h1>\n", what, link, page); else if(link && what) - printf("<h1><a data-text='%s' href='%s/%s' >%s</a></h1>\n", what, base, link, page); + printf("<h1><a data-text='%s' href='%s/%s'>%s</a></h1>\n", what, base, link, page); else printf("<h1>%s</h1>\n", page); } @@ -104,7 +104,7 @@ int edit(char *path) { if(!writable(path)) return unauthorized(403); FILE *fp = fopen(path, "r"); char *page = clean(path); - fp ? head(page, path, "vis") : head(page, NULL, NULL); + fp ? head(path, path, "vis") : head(path, NULL, NULL); char buffer[sysconf(_SC_PAGESIZE)]; printf("<form method='post' enctype='text/plain'>\n"); printf("<p><textarea name=text rows=24 cols=72>"); @@ -140,6 +140,8 @@ int post(char *path) { int list(char *raw, int dir) { int len = strlen(raw); char *pattern = malloc(len + 3); + if(len > 0 && raw[len - 1] == '/') + raw[len - 1] = '\0'; if(dir) snprintf(pattern, len + 3, "%s/*", raw); else @@ -184,7 +186,7 @@ int view(char *path) { FILE *fp = fopen(path, "r"); if(!fp) return redirect("?e"); char *page = clean(path); - writable(path) ? head(page, "?e", "rediger") : head(page, NULL, NULL); + writable(path) ? head(path, "?e", "rediger") : head(path, NULL, NULL); marxup(fp, stdout, NULL); foot(1); return 0; |