Subversion Repositories RepoView

Rev

Rev 3 | Rev 6 | 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 5 2024-08-20 22:43:56Z 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>
5 nishi 15
#include <time.h>
1 nishi 16
 
17
char* postdata;
18
 
3 nishi 19
int main() {
5 nishi 20
	srand(time(NULL));
1 nishi 21
	rv_check_sanity();
22
	rv_init_db();
23
	rv_parse_query(getenv("QUERY_STRING"));
24
	rv_save_query('Q');
25
	postdata = malloc(1);
26
	postdata[0] = 0;
27
	char cbuf[2];
28
	cbuf[1] = 0;
3 nishi 29
	while(1) {
1 nishi 30
		fread(cbuf, 1, 1, stdin);
31
		if(feof(stdin)) break;
32
		char* tmp = postdata;
33
		postdata = rv_strcat(tmp, cbuf);
34
		free(tmp);
35
	}
36
	rv_parse_query(postdata);
37
	rv_save_query('P');
5 nishi 38
	rv_init_auth();
1 nishi 39
	rv_process_page();
40
	printf("Content-Type: text/html\r\n");
41
	printf("\r\n");
42
	rv_print_page();
3 nishi 43
	rv_logged_in();
44
	rv_load_query('Q');
1 nishi 45
	rv_free_query();
3 nishi 46
	rv_load_query('P');
47
	rv_free_query();
1 nishi 48
	rv_close_db();
3 nishi 49
	rv_free_auth();
1 nishi 50
}