Subversion Repositories IRCServ

Rev

Rev 3 | Rev 7 | 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 5 2024-08-25 11:58:10Z nishi $ */
2
 
3
#include "is_version.h"
5 nishi 4
#include "is_util.h"
5
#include "is_log.h"
2 nishi 6
 
3 nishi 7
#include <stdio.h>
5 nishi 8
#include <stdlib.h>
9
#include <unistd.h>
10
#include <stdbool.h>
11
#include <string.h>
3 nishi 12
 
13
int main(int argc, char** argv) {
5 nishi 14
	bool daemon = true;
15
	printf("IRCServ version %s\n", is_get_version());
16
	int i;
17
	for(i = 1; i < argc; i++) {
18
		if(strcmp(argv[i], "-D") == 0) {
19
			daemon = false;
20
			break;
21
		}
22
	}
23
	pid_t pid = 0;
24
	if(daemon) {
25
		pid = fork();
26
	}
27
	if(pid == 0) {
28
		char* str;
29
 
30
		str = is_strcat("IRCServ version ", is_get_version());
31
		is_log(str);
32
		free(str);
33
 
34
		return 0;
35
	} else {
36
		return 0;
37
	}
3 nishi 38
}