Subversion Repositories Okuu

Rev

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

Rev 2 Rev 3
Line 1... Line 1...
1
/* $Id: main.c 2 2024-09-09 13:22:05Z nishi $ */
1
/* $Id: main.c 3 2024-09-10 19:21:48Z nishi $ */
-
 
2
 
-
 
3
#include "ok_bot.h"
-
 
4
 
-
 
5
#include "ok_news.h"
2
 
6
 
3
#include <stdio.h>
7
#include <stdio.h>
4
#include <stdlib.h>
8
#include <stdlib.h>
5
#include <stdbool.h>
9
#include <stdbool.h>
6
 
10
 
7
char* nntpserver;
11
char* nntpserver;
8
char* nntpuser;
12
char* nntpuser;
9
char* nntppass;
13
char* nntppass;
-
 
14
char* nntppath;
-
 
15
char* nntpcount;
10
int nntpport = 119;
16
int nntpport = 119;
11
 
17
 
12
char* ircserver;
18
char* ircserver;
-
 
19
char* ircchan;
-
 
20
char* ircuser;
-
 
21
char* ircnick;
-
 
22
char* ircreal;
-
 
23
char* ircpass;
13
int ircport = 6669;
24
int ircport = 6667;
14
 
25
 
15
int main(){
26
int main(){
16
	printf("Okuu starting up\n");
27
	printf("Okuu starting up\n");
17
 
28
 
18
	nntpserver = getenv("NNTPSERVER");
29
	nntpserver = getenv("NNTPSERVER");
19
	nntpuser = getenv("NNTPUSER");
30
	nntpuser = getenv("NNTPUSER");
20
	nntppass = getenv("NNTPPASS");
31
	nntppass = getenv("NNTPPASS");
-
 
32
	nntppath = getenv("NNTPPATH");
-
 
33
	nntpcount = getenv("NNTPCOUNT");
21
	ircserver = getenv("IRCSERVER");
34
	ircserver = getenv("IRCSERVER");
-
 
35
	ircchan = getenv("IRCCHAN");
-
 
36
	ircuser = getenv("IRCUSER");
-
 
37
	ircnick = getenv("IRCNICK");
-
 
38
	ircreal = getenv("IRCREAL");
-
 
39
	ircpass = getenv("IRCPASS");
22
	if(getenv("NNTPPORT") != NULL){
40
	if(getenv("NNTPPORT") != NULL){
23
		nntpport = atoi(getenv("NNTPPORT"));
41
		nntpport = atoi(getenv("NNTPPORT"));
24
	}
42
	}
25
	if(getenv("IRCPORT") != NULL){
43
	if(getenv("IRCPORT") != NULL){
26
		ircport = atoi(getenv("IRCPORT"));
44
		ircport = atoi(getenv("IRCPORT"));
Line 28... Line 46...
28
	bool bad = false;
46
	bool bad = false;
29
	if(nntpserver == NULL){
47
	if(nntpserver == NULL){
30
		fprintf(stderr, "Set NNTPSERVER\n");
48
		fprintf(stderr, "Set NNTPSERVER\n");
31
		bad = true;
49
		bad = true;
32
	}
50
	}
-
 
51
	if(nntppath == NULL){
-
 
52
		fprintf(stderr, "Set NNTPPATH\n");
-
 
53
		bad = true;
-
 
54
	}
-
 
55
	if(nntpcount == NULL){
-
 
56
		fprintf(stderr, "Set NNTPCOUNT\n");
-
 
57
		bad = true;
-
 
58
	}
33
	if(ircserver == NULL){
59
	if(ircserver == NULL){
34
		fprintf(stderr, "Set IRCSERVER\n");
60
		fprintf(stderr, "Set IRCSERVER\n");
35
		bad = true;
61
		bad = true;
36
	}
62
	}
-
 
63
	if(ircchan == NULL){
-
 
64
		fprintf(stderr, "Set IRCCHAN\n");
-
 
65
		bad = true;
-
 
66
	}
-
 
67
	if(ircuser == NULL){
-
 
68
		fprintf(stderr, "Set IRCUSER\n");
-
 
69
		bad = true;
-
 
70
	}
-
 
71
	if(ircnick == NULL) ircnick = ircuser;
-
 
72
	if(ircreal == NULL) ircreal = ircuser;
37
	if(bad){
73
	if(bad){
38
		return 1;
74
		return 1;
39
	}
75
	}
-
 
76
	ok_news_init();
-
 
77
	ok_bot();
40
}
78
}