Subversion Repositories RepoView

Rev

Rev 3 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 nishi 1
/* $Id: main.c 1 2024-08-20 19:18:25Z 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"
12
 
13
#include <stdlib.h>
14
 
15
char* postdata;
16
 
17
int main(){
18
	rv_check_sanity();
19
	rv_init_db();
20
	rv_parse_query(getenv("QUERY_STRING"));
21
	rv_save_query('Q');
22
	postdata = malloc(1);
23
	postdata[0] = 0;
24
	char cbuf[2];
25
	cbuf[1] = 0;
26
	while(1){
27
		fread(cbuf, 1, 1, stdin);
28
		if(feof(stdin)) break;
29
		char* tmp = postdata;
30
		postdata = rv_strcat(tmp, cbuf);
31
		free(tmp);
32
	}
33
	rv_parse_query(postdata);
34
	rv_save_query('P');
35
	rv_process_page();
36
	printf("Content-Type: text/html\r\n");
37
	printf("\r\n");
38
	rv_print_page();
39
	rv_free_query();
40
	rv_close_db();
41
}