Subversion Repositories Okuu

Rev

Rev 2 | Rev 5 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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