Subversion Repositories MLServ

Rev

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

Rev 4 Rev 5
Line 1... Line 1...
1
/* $Id: main.c 4 2024-09-24 18:35:15Z nishi $ */
1
/* $Id: main.c 5 2024-09-25 00:19:35Z nishi $ */
2
 
2
 
3
#include <stdio.h>
3
#include <stdio.h>
4
#include <string.h>
4
#include <string.h>
5
 
5
 
6
#include "ms_newlist.h"
6
#include "ms_newlist.h"
7
#include "ms_server.h"
7
#include "ms_server.h"
8
 
8
 
-
 
9
#include <cm_crypt.h>
9
#include <cm_version.h>
10
#include <cm_version.h>
10
 
11
 
-
 
12
extern const char* cm_crypt_methods[];
-
 
13
 
11
int main(int argc, char** argv) {
14
int main(int argc, char** argv) {
12
	int i;
15
	int i;
13
	int startsub = 0;
16
	int startsub = 0;
14
	const char* option = NULL;
17
	const char* option = NULL;
15
	for(i = 1; i < argc; i++) {
18
	for(i = 1; i < argc; i++) {
Line 40... Line 43...
40
		fprintf(stderr, "Specify subcommand\n");
43
		fprintf(stderr, "Specify subcommand\n");
41
		return 1;
44
		return 1;
42
	} else if(strcmp(option, "newlist") == 0) {
45
	} else if(strcmp(option, "newlist") == 0) {
43
		return ms_handle_newlist(argc, argv, startsub);
46
		return ms_handle_newlist(argc, argv, startsub);
44
	} else if(strcmp(option, "server") == 0) {
47
	} else if(strcmp(option, "server") == 0) {
-
 
48
		int m;
-
 
49
		if((m = cm_crypt_init()) < 0) {
-
 
50
			fprintf(stderr, "No crypt() method available\n");
-
 
51
			return 1;
-
 
52
		}
-
 
53
		printf("Using %s as the default crypt() method\n", cm_crypt_methods[m]);
45
		return ms_handle_server(argc, argv, startsub);
54
		return ms_handle_server(argc, argv, startsub);
46
	} else {
55
	} else {
47
		fprintf(stderr, "Invalid subcommand: %s\n", option);
56
		fprintf(stderr, "Invalid subcommand: %s\n", option);
48
		return 1;
57
		return 1;
49
	}
58
	}