aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthe little girl <yui@blekksprut.net>2014-06-06 14:58:53 +0200
committerthe little girl <yui@blekksprut.net>2014-06-06 14:58:53 +0200
commitac0cdaf7a3db5c23ecfc0a844c1bd4daec160e04 (patch)
tree0c4106cf92cbcddddaa700f996ad33e57e2e2031
parent3f4676c3488e7fb065629029ad880f7d8a568200 (diff)
downloadukulele-ac0cdaf7a3db5c23ecfc0a844c1bd4daec160e04.tar.xz
orz-støtte og kakebakst
-rw-r--r--config.def.h2
-rw-r--r--wiki.c13
2 files changed, 10 insertions, 5 deletions
diff --git a/config.def.h b/config.def.h
index bd0acda..d83e046 100644
--- a/config.def.h
+++ b/config.def.h
@@ -1,3 +1,5 @@
+int orz = 0;
+
static char *title = "a wiki";
static char *id = "anonymous";
static char *home = "home";
diff --git a/wiki.c b/wiki.c
index cd92564..32f9a82 100644
--- a/wiki.c
+++ b/wiki.c
@@ -113,7 +113,10 @@ int edit(char *path) {
fp ? head(path, path, "vis") : head(path, NULL, NULL);
char buffer[sysconf(_SC_PAGESIZE)];
printf("<form method='post'>\n");
- printf("<p><textarea name=t rows=24 cols=72>");
+ printf("<p class='edit'>\n");
+ if(orz)
+ printf("<a id='orz' href='#'>@picto</a><br>\n");
+ printf("<textarea name=t rows=24 cols=72>");
if(fp)
while(fgets(buffer, sizeof(buffer), fp))
printf("%s", buffer);
@@ -212,11 +215,11 @@ int list(char *raw, int dir, int inc) {
return 0;
}
-int text(char *path) {
+int text(char *path, char *type) {
FILE *fp = fopen(path, "r");
if(fp) {
char buffer[sysconf(_SC_PAGESIZE)];
- printf("Content-Type: text/plain; charset=utf-8\n\n");
+ printf("Content-Type: %s; charset=utf-8\n\n", type);
while(fgets(buffer, sizeof(buffer), fp))
printf("%s", buffer);
}
@@ -291,8 +294,8 @@ int main(int argc, char **argv) {
while(qstr && *qstr) {
switch(*qstr) {
case 'e': return edit(page);
- case 't': return text(page);
- // case 'p': return
+ case 't': return text(page, "text/plain");
+ case 'c': return text(page, "text/css");
}
qstr++;
}