Subversion Repositories RepoView

Rev

Rev 1 | Rev 5 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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