Subversion Repositories Okuu

Rev

Rev 5 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5 Rev 11
Line 1... Line 1...
1
/* $Id: main.c 5 2024-09-11 00:26:25Z nishi $ */
1
/* $Id: main.c 11 2024-09-11 10:24:20Z nishi $ */
2
 
2
 
3
#include "ok_bot.h"
3
#include "ok_bot.h"
4
 
4
 
5
#include "ok_news.h"
5
#include "ok_news.h"
6
 
6
 
Line 23... Line 23...
23
char* ircnick;
23
char* ircnick;
24
char* ircreal;
24
char* ircreal;
25
char* ircpass;
25
char* ircpass;
26
int ircport = 6667;
26
int ircport = 6667;
27
 
27
 
28
int main(){
28
int main() {
29
	printf("Okuu starting up\n");
29
	printf("Okuu starting up\n");
30
 
30
 
31
	nntpserver = getenv("NNTPSERVER");
31
	nntpserver = getenv("NNTPSERVER");
32
	nntpuser = getenv("NNTPUSER");
32
	nntpuser = getenv("NNTPUSER");
33
	nntppass = getenv("NNTPPASS");
33
	nntppass = getenv("NNTPPASS");
Line 39... Line 39...
39
	ircchan = getenv("IRCCHAN");
39
	ircchan = getenv("IRCCHAN");
40
	ircuser = getenv("IRCUSER");
40
	ircuser = getenv("IRCUSER");
41
	ircnick = getenv("IRCNICK");
41
	ircnick = getenv("IRCNICK");
42
	ircreal = getenv("IRCREAL");
42
	ircreal = getenv("IRCREAL");
43
	ircpass = getenv("IRCPASS");
43
	ircpass = getenv("IRCPASS");
44
	if(getenv("NNTPPORT") != NULL){
44
	if(getenv("NNTPPORT") != NULL) {
45
		nntpport = atoi(getenv("NNTPPORT"));
45
		nntpport = atoi(getenv("NNTPPORT"));
46
	}
46
	}
47
	if(getenv("IRCPORT") != NULL){
47
	if(getenv("IRCPORT") != NULL) {
48
		ircport = atoi(getenv("IRCPORT"));
48
		ircport = atoi(getenv("IRCPORT"));
49
	}
49
	}
50
	bool bad = false;
50
	bool bad = false;
51
	if(nntpserver == NULL){
51
	if(nntpserver == NULL) {
52
		fprintf(stderr, "Set NNTPSERVER\n");
52
		fprintf(stderr, "Set NNTPSERVER\n");
53
		bad = true;
53
		bad = true;
54
	}
54
	}
55
	if(nntppath == NULL){
55
	if(nntppath == NULL) {
56
		fprintf(stderr, "Set NNTPPATH\n");
56
		fprintf(stderr, "Set NNTPPATH\n");
57
		bad = true;
57
		bad = true;
58
	}
58
	}
59
	if(nntpcount == NULL){
59
	if(nntpcount == NULL) {
60
		fprintf(stderr, "Set NNTPCOUNT\n");
60
		fprintf(stderr, "Set NNTPCOUNT\n");
61
		bad = true;
61
		bad = true;
62
	}
62
	}
63
	if(nntpfrom == NULL){
63
	if(nntpfrom == NULL) {
64
		fprintf(stderr, "Set NNTPFROM\n");
64
		fprintf(stderr, "Set NNTPFROM\n");
65
		bad = true;
65
		bad = true;
66
	}
66
	}
67
	if(nntpgroup == NULL){
67
	if(nntpgroup == NULL) {
68
		fprintf(stderr, "Set NNTPGROUP\n");
68
		fprintf(stderr, "Set NNTPGROUP\n");
69
		bad = true;
69
		bad = true;
70
	}
70
	}
71
	if(ircserver == NULL){
71
	if(ircserver == NULL) {
72
		fprintf(stderr, "Set IRCSERVER\n");
72
		fprintf(stderr, "Set IRCSERVER\n");
73
		bad = true;
73
		bad = true;
74
	}
74
	}
75
	if(ircchan == NULL){
75
	if(ircchan == NULL) {
76
		fprintf(stderr, "Set IRCCHAN\n");
76
		fprintf(stderr, "Set IRCCHAN\n");
77
		bad = true;
77
		bad = true;
78
	}
78
	}
79
	if(ircuser == NULL){
79
	if(ircuser == NULL) {
80
		fprintf(stderr, "Set IRCUSER\n");
80
		fprintf(stderr, "Set IRCUSER\n");
81
		bad = true;
81
		bad = true;
82
	}
82
	}
83
	if(ircnick == NULL) ircnick = ircuser;
83
	if(ircnick == NULL) ircnick = ircuser;
84
	if(ircreal == NULL) ircreal = ircuser;
84
	if(ircreal == NULL) ircreal = ircuser;
85
	if(bad){
85
	if(bad) {
86
		return 1;
86
		return 1;
87
	}
87
	}
88
	ok_news_init();
88
	ok_news_init();
89
	ok_bot();
89
	ok_bot();
90
}
90
}