Subversion Repositories RepoView

Rev

Rev 1 | Rev 8 | 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: check.c 1 2024-08-20 19:18:25Z nishi $ */
1
/* $Id: check.c 3 2024-08-20 21:05:24Z nishi $ */
2
 
2
 
3
#include "config.h"
3
#include "config.h"
4
 
4
 
5
#include <stdio.h>
5
#include <stdio.h>
6
 
6
 
7
int check_db(void){
7
int check_db(void) {
8
	int counter = 0;
8
	int counter = 0;
9
	const char* db = "";
9
	const char* db = "";
10
#ifdef USE_SQLITE
10
#ifdef USE_SQLITE
11
	counter++;
11
	counter++;
12
	db = "SQLite";
12
	db = "SQLite";
Line 17... Line 17...
17
#endif
17
#endif
18
#ifdef USE_NDBM
18
#ifdef USE_NDBM
19
	counter++;
19
	counter++;
20
	db = "NDBM";
20
	db = "NDBM";
21
#endif
21
#endif
22
	if(counter > 1){
22
	if(counter > 1) {
23
		fprintf(stderr, "You cannot use multiple database types at once.\n");
23
		fprintf(stderr, "You cannot use multiple database types at once.\n");
24
		return 1;
24
		return 1;
25
	}else if(counter == 0){
25
	} else if(counter == 0) {
26
		fprintf(stderr, "You must select a database type.\n");
26
		fprintf(stderr, "You must select a database type.\n");
27
		return 1;
27
		return 1;
28
	}else{
28
	} else {
29
		printf("Database type is %s\n", db);
29
		printf("Database type is %s\n", db);
30
	}
30
	}
31
	return 0;
31
	return 0;
32
}
32
}
33
 
33
 
34
int check_theme(void){
34
int check_theme(void) {
35
	int counter = 0;
35
	int counter = 0;
36
	const char* theme = "";
36
	const char* theme = "";
37
#ifdef USE_MODERN
37
#ifdef USE_MODERN
38
	counter++;
38
	counter++;
39
	theme = "Modern";
39
	theme = "Modern";
40
#endif
40
#endif
41
#ifdef USE_OPTIMIZED
41
#ifdef USE_OPTIMIZED
42
	counter++;
42
	counter++;
43
	theme = "Optimized";
43
	theme = "Optimized";
44
#endif
44
#endif
45
	if(counter > 1){
45
	if(counter > 1) {
46
		fprintf(stderr, "You cannot use multiple themes at once.\n");
46
		fprintf(stderr, "You cannot use multiple themes at once.\n");
47
		return 1;
47
		return 1;
48
	}else if(counter == 0){
48
	} else if(counter == 0) {
49
		fprintf(stderr, "You must select a theme.\n");
49
		fprintf(stderr, "You must select a theme.\n");
50
		return 1;
50
		return 1;
51
	}else{
51
	} else {
52
		printf("Theme is %s\n", theme);
52
		printf("Theme is %s\n", theme);
53
	}
53
	}
54
	return 0;
54
	return 0;
55
}
55
}
56
 
56
 
57
int check_auth(void){
57
int check_auth(void) {
58
	int counter = 0;
58
	int counter = 0;
59
	const char* method = "";
59
	const char* method = "";
60
#ifdef USE_COOKIE
60
#ifdef USE_COOKIE
61
	counter++;
61
	counter++;
62
	method = "Cookie";
62
	method = "Cookie";
63
#endif
63
#endif
64
	if(counter > 1){
64
	if(counter > 1) {
65
		fprintf(stderr, "You cannot use multiple authentication methods at once.\n");
65
		fprintf(stderr, "You cannot use multiple authentication methods at once.\n");
66
		return 1;
66
		return 1;
67
	}else if(counter == 0){
67
	} else if(counter == 0) {
68
		fprintf(stderr, "You must select an authentication method.\n");
68
		fprintf(stderr, "You must select an authentication method.\n");
69
		return 1;
69
		return 1;
70
	}else{
70
	} else {
71
		printf("Authentication method is %s\n", method);
71
		printf("Authentication method is %s\n", method);
72
	}
72
	}
73
	return 0;
73
	return 0;
74
}
74
}
75
 
75
 
76
int main(){
76
int main() {
77
	int st;
77
	int st;
78
	st = check_db();
78
	st = check_db();
79
	if(st != 0) goto fail;
79
	if(st != 0) goto fail;
80
	st = check_auth();
80
	st = check_auth();
81
	if(st != 0) goto fail;
81
	if(st != 0) goto fail;