Subversion Repositories RepoView

Rev

Rev 1 | Rev 5 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 nishi 1
/* $Id: main.c 3 2024-08-20 21:05:24Z nishi $ */
2
 
3
#include <stdio.h>
4
 
5
#include "../config.h"
6
 
7
#include "rv_sanity.h"
8
#include "rv_query.h"
9
#include "rv_page.h"
10
#include "rv_util.h"
11
#include "rv_db.h"
3 nishi 12
#include "rv_auth.h"
1 nishi 13
 
14
#include <stdlib.h>
15
 
16
char* postdata;
17
 
3 nishi 18
int main() {
1 nishi 19
	rv_check_sanity();
20
	rv_init_db();
21
	rv_parse_query(getenv("QUERY_STRING"));
22
	rv_save_query('Q');
23
	postdata = malloc(1);
24
	postdata[0] = 0;
25
	char cbuf[2];
26
	cbuf[1] = 0;
3 nishi 27
	while(1) {
1 nishi 28
		fread(cbuf, 1, 1, stdin);
29
		if(feof(stdin)) break;
30
		char* tmp = postdata;
31
		postdata = rv_strcat(tmp, cbuf);
32
		free(tmp);
33
	}
34
	rv_parse_query(postdata);
35
	rv_save_query('P');
36
	rv_process_page();
37
	printf("Content-Type: text/html\r\n");
38
	printf("\r\n");
39
	rv_print_page();
3 nishi 40
	rv_logged_in();
41
	rv_load_query('Q');
1 nishi 42
	rv_free_query();
3 nishi 43
	rv_load_query('P');
44
	rv_free_query();
1 nishi 45
	rv_close_db();
3 nishi 46
	rv_free_auth();
1 nishi 47
}