Subversion Repositories Mokou

Rev

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

Rev 3 Rev 4
Line 1... Line 1...
1
/* $Id: main.c 3 2024-09-06 09:21:55Z nishi $ */
1
/* $Id: main.c 4 2024-09-06 09:55:53Z nishi $ */
2
 
2
 
3
#include <stdio.h>
3
#include <stdio.h>
4
#include <unistd.h>
4
#include <unistd.h>
5
#include <stdlib.h>
5
#include <stdlib.h>
-
 
6
#include <string.h>
-
 
7
#include <stdbool.h>
6
 
8
 
7
#include "mk_service.h"
9
#include "mk_service.h"
8
#include "mk_log.h"
10
#include "mk_log.h"
9
#include "mk_util.h"
11
#include "mk_util.h"
10
#include "mk_version.h"
12
#include "mk_version.h"
11
 
13
 
-
 
14
extern bool mk_syslog;
-
 
15
 
12
int main(int argc, char** argv){
16
int main(int argc, char** argv){
-
 
17
	int i;
-
 
18
	for(i = 1; i < argc; i++){
-
 
19
		if(argv[i][0] == '-'){
-
 
20
			if(strcmp(argv[i], "--stderr") == 0 || strcmp(argv[i], "-S") == 0){
-
 
21
				mk_syslog = false;
-
 
22
			}else{
-
 
23
				fprintf(stderr, "%s: %s: unknown flag\n", argv[0], argv[i]);
-
 
24
				return 1;
-
 
25
			}
-
 
26
		}
-
 
27
	}
13
	if(getuid() != 0){
28
	if(getuid() != 0){
14
		fprintf(stderr, "Run me as root.\n");
29
		fprintf(stderr, "Run me as root.\n");
15
		return 1;
30
		return 1;
16
	}
31
	}
17
	char* log = mk_strcat3("Mokou version ", mk_get_version(), " starting up");
32
	char* log = mk_strcat3("Mokou version ", mk_get_version(), " starting up");