aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthe little girl <yui@blekksprut.net>2017-10-12 20:56:44 +0000
committerthe little girl <yui@blekksprut.net>2017-10-12 20:56:44 +0000
commite2aa008fbc899d78c4ea3a5348551f1b3a256acd (patch)
tree2a6644910b88045a5f56cfe41fe45887e4d15cb5
parente9782b99805f83553940a19062288a3d23765158 (diff)
downloadukulele-e2aa008fbc899d78c4ea3a5348551f1b3a256acd.tar.xz
ryddet i ukulele.c og et forsøk på å kommentere config.def.h
-rw-r--r--config.def.h25
-rw-r--r--ukulele.c10
2 files changed, 16 insertions, 19 deletions
diff --git a/config.def.h b/config.def.h
index 09a60d7..6a4bc2d 100644
--- a/config.def.h
+++ b/config.def.h
@@ -1,23 +1,22 @@
-int dirlist = 0;
+static char *script; // bytter ut SCRIPT_NAME
+static char *base; // prefiks før all css/js
-static char *orz = 0;
+static char *title = "ukulele"; // hva heter wikien?
+static char *name = "nobody"; // navn hvis ingenting annet endrer det
+static char *home = "home"; // roten, roten!
-static char *title = "a wiki";
-static char *id = "anonymous";
-static char *home = "home";
+static char *orz = 0; // url til en orz for å enkelt legge til bilder og video
-static char *pages = "pages";
-static char *loft = ".loft";
-
-static char *realm = "wiki";
+static char *pages = "pages"; // mappen der wikisidene skal havne
+static char *loft = ".loft"; // mappen der gamle versjoner av sider puttes
+// lenker til footer~
static char *links[][2] = {
{ "home", "home" },
- { "planer", "planer" },
{ 0 }
};
-static char *(*authenticate)() = NULL;
+static char *realm = "ukulele"; // realm for http auth
+static char *(*authenticate)() = 0; // http auth-funksjon, må håndtere env
-static char *script;
-static char *base;
+int dirlist = 0; // vis innhold i mapper automatisk
diff --git a/ukulele.c b/ukulele.c
index 056bfbf..2e676c7 100644
--- a/ukulele.c
+++ b/ukulele.c
@@ -113,7 +113,6 @@ int redirect(char *path, char *prefix) {
case '?': printf("Location: %s\n\n", path); break;
case '#':
printf("Location: %s/%s?m=", script, path);
- // skrive ut ++path
printf("\n");
default:
if(prefix) {
@@ -165,7 +164,7 @@ int store(char *raw, int len) {
time_t epoch = time(0);
snprintf(path, siz, "%s/%s.%d", loft, id, (int) epoch);
FILE *fp = fopen(path, "w");
- if(!fp) return redirect("fff", 0);
+ if(!fp) return problem(403, "Can't find the loft.");
int pos = 0;
unsigned int decoded;
char buffer[3] = { 0 };
@@ -208,7 +207,6 @@ int post(char *path) {
return redirect(path, 0);
}
-// gjør denne penere!
int list(char *raw, int dir, int inc) {
int len = strlen(raw);
char *pattern = malloc(len + 3);
@@ -229,7 +227,7 @@ int list(char *raw, int dir, int inc) {
if(!inc)
head("treff", 0, 0);
char *path;
- printf("<ul class='glob'>");
+ printf("<ul class=glob>");
for(int i = 0; i < res.gl_pathc; i++) {
path = res.gl_pathv[i];
if(*path == '.' && *path + 1 == '/') path += 2;
@@ -290,7 +288,7 @@ void include(FILE *out, char *path) {
void magic(FILE *out, char *line) {
switch(*line++) {
case 'i': include(out, line); break;
- default: fprintf(out, "WHAT: %s\n", line); return;
+ default: fprintf(out, "%s\n", line); return;
}
}
@@ -334,7 +332,7 @@ int main(int argc, char **argv) {
setenv("MARXUP_NOREFERRER", "1", 1);
if(chdir(pages))
- return problem(503, "Service unavailable");
+ return problem(500, "Where are the pages?");
if(!strncmp(verb, "POST", 4)) return post(page);
if(strchr(page, '*'))