Subversion Repositories IRCServ

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: check.c 3 2024-08-25 10:23:36Z nishi $ */
2
 
3
#include "config.h"
4
 
5
#include <stdio.h>
6
 
7
int check_log(void) {
8
	int count = 0;
9
	const char* name = "";
10
#ifdef USE_SYSLOG
11
	name = "Syslog";
12
	count++;
13
#endif
14
#ifdef USE_STDERR
15
	name = "stderr";
16
	count++;
17
#endif
18
	if(count == 0) {
19
		fprintf(stderr, "Select a logger\n");
20
		return 1;
21
	} else if(count > 1) {
22
		fprintf(stderr, "Too many loggers\n");
23
		return 1;
24
	} else {
25
		printf("Using %s for logging\n", name);
26
		return 0;
27
	}
28
}
29
 
3 nishi 30
int check_irc(void){
31
	int st = 0;
32
#ifndef IRC_SERVER
33
	fprintf(stderr, "Set a server IP\n");
34
	st = 1;
35
#endif
36
#ifndef IRC_PORT
37
	fprintf(stderr, "Set a server port\n");
38
	st = 1;
39
#endif
40
#ifndef IRC_SECRET
41
	fprintf(stderr, "Set a service password\n");
42
	st = 1;
43
#endif
44
#ifndef IRC_SERVICE
45
	fprintf(stderr, "Set a service name\n");
46
	st = 1;
47
#endif
48
	return st;
49
}
50
 
2 nishi 51
int main() {
52
	int st = 0;
53
	st = check_log();
54
	if(st != 0) goto cleanup;
3 nishi 55
	st = check_irc();
56
	if(st != 0) goto cleanup;
2 nishi 57
cleanup:
58
	return st;
59
}