diff options
author | John Ankarström <john@ankarstrom.se> | 2021-09-18 02:10:30 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2021-09-18 02:10:30 +0200 |
commit | c1e3206968f9878f8b7883cc7c313cd930c86d04 (patch) | |
tree | f279f343bd27b6fd5d338636138f17c071290016 | |
parent | 24bf14f6653ebf1c1ba79b9f212d35417bb6acbf (diff) | |
download | cforum-c1e3206968f9878f8b7883cc7c313cd930c86d04.tar.gz |
Add README, fix C89 compliance
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | README | 28 | ||||
-rw-r--r-- | cforum.c | 2 | ||||
-rw-r--r-- | ctl.c | 6 | ||||
-rw-r--r-- | mktpl/Makefile | 3 | ||||
-rwxr-xr-x | mktpl/mktpl | bin | 23988 -> 23988 bytes | |||
-rw-r--r-- | mktpl/mktpl.c | 1 | ||||
-rw-r--r-- | mktpl/mktpl.lex | 1 | ||||
-rw-r--r-- | t/front.t | 3 | ||||
-rw-r--r-- | t/front.tc | 3 | ||||
-rw-r--r-- | t/post.t | 2 | ||||
-rw-r--r-- | t/post.tc | 2 |
12 files changed, 43 insertions, 13 deletions
@@ -1,3 +1,4 @@ +CFLAGS += -std=c89 -Wall -pedantic -Wno-parentheses LDLIBS += -lsqlite3 C = $(shell ls *.c) H = $(shell ls *.h) @@ -8,6 +9,10 @@ TPL = $(shell ls t/*.t | sed 's/$$/c/') cforum: $(C) $(H) $(TPL) $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o cforum $(C) +clean: + rm cforum + rm $(TPL) + .t.tc: mktpl/mktpl <$< mktpl/mktpl >$@ @@ -0,0 +1,28 @@ + README + +`cforum' is a CGI-based web forum software written in C. It uses +SQLite as its database. It is designed to be a simple, fast and +reliable alternative to software like phpBB. Written in portable +C89, it can be run on practically any UNIX system. + +`cforum' is also small: + + $ wc -l *.c *.h t/*.t */*.lex + 96 cforum.c + 96 ctl.c + 121 db.c + 12 err.c + 106 query.c + 3 ctl.h + 34 db.h + 0 err.h + 14 query.h + 2 site.h + 3 t/err.t + 1 t/foot.t + 17 t/front.t + 6 t/head.t + 35 t/post.t + 2 t/user.t + 86 mktpl/mktpl.lex + 634 total @@ -14,7 +14,7 @@ int main(int argc, char *argv[]) { - char err[MAXERR], *p, *qs, *v; + char err[MAXERR], *p, *v; int attachmentid, postid, userid; sqlite3_stmt *stmt; @@ -2,6 +2,7 @@ #include <stdlib.h> #include <string.h> #include <time.h> +#include "err.h" #include "db.h" #include "query.h" #include "site.h" @@ -36,6 +37,8 @@ void showfront() { char *title; + struct post *post; + struct user *user; sqlite3_stmt *stmt; if(sqlite3_prepare(db, @@ -54,6 +57,7 @@ void showpost(int id) { char *title; + struct attachment *attachment; struct post *post; struct user *user; sqlite3_stmt *stmt; @@ -78,7 +82,7 @@ showpost(int id) void showuser(int id) { - char s[128], *title; + char *title; struct user *user; if(!(user = getuser(byid("users", id), 1))){ diff --git a/mktpl/Makefile b/mktpl/Makefile index 0e7363b..f413714 100644 --- a/mktpl/Makefile +++ b/mktpl/Makefile @@ -1,6 +1,7 @@ +CFLAGS += -std=c89 -Wall -pedantic -Wno-parentheses LDLIBS += -lfl mktpl: mktpl.c mktpl.c: mktpl.lex - flex -omktpl.c mktpl.lex + flex -omktpl.c mktpl.lex
\ No newline at end of file diff --git a/mktpl/mktpl b/mktpl/mktpl Binary files differindex 415d645..cc26132 100755 --- a/mktpl/mktpl +++ b/mktpl/mktpl diff --git a/mktpl/mktpl.c b/mktpl/mktpl.c index e806bef..485d209 100644 --- a/mktpl/mktpl.c +++ b/mktpl/mktpl.c @@ -1568,6 +1568,7 @@ main(int argc, char *argv[]) err(1, "malloc"); yylex(); + return 0; } void diff --git a/mktpl/mktpl.lex b/mktpl/mktpl.lex index 1940f02..f0674b7 100644 --- a/mktpl/mktpl.lex +++ b/mktpl/mktpl.lex @@ -40,6 +40,7 @@ main(int argc, char *argv[]) err(1, "malloc"); yylex(); + return 0; } void @@ -3,9 +3,6 @@ <h3>Latest posts</h3> <table border="1"> <% - struct post *post; - struct user *user; - while(post = getpost(stmt, 0)){ user = getuser(byid("users", post->user), 1); %> @@ -2,9 +2,6 @@ printf("\n<h1>"); printf("%s", site.name ); printf("</h1>\n<h3>Latest posts</h3>\n<table border=\"1\">\n "); - struct post *post; - struct user *user; - while(post = getpost(stmt, 0)){ user = getuser(byid("users", post->user), 1); @@ -14,8 +14,6 @@ <%= post->text %> </pre> <% -struct attachment *attachment; - if(attachment = getattachment(stmt, 0)){ %> <h3>Attachments</h3> @@ -31,8 +31,6 @@ printf("</a>\n"); printf("\n<pre>\n"); printf("%s", post->text ); printf("\n</pre>\n"); -struct attachment *attachment; - if(attachment = getattachment(stmt, 0)){ printf("\n<h3>Attachments</h3>\n<table border=\"1\">\n "); |