-
Notifications
You must be signed in to change notification settings - Fork 0
/
fss.c
67 lines (56 loc) · 1.59 KB
/
fss.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
* fss - File Synchronization System , detect file changes under
* specific directory on one client then synchronize to other
* client via a centralized server
*
* Copyright (c) 2010, 2011 lxd <i@lxd.me>
*
* This file is part of File Synchronization System(fss).
*
* fss is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License,
* (at your option) any later version.
*
* fss is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with fss. If not, see <http://www.gnu.org/licenses/>.
*/
#include "log.h"
#include "utils.h"
#include "options.h"
#include "path.h"
#include "io.h"
#include "setsignal.h"
#include <stdlib.h>
#include "server.h"
#include "client.h"
#include <errno.h>
extern int errno;
static void test_network(struct options* o)
{
if (o->mode == MODE_CLIENT)
entry_client(o);
else
entry_server(o);
}
int main(int argc, char *argv[])
{
struct options o;
set0(o);
init_log();
load_default_options(&o);
parse_config_file(&o);
parse_argv(argc, argv, &o);
reinit_log(&o);
set_basepath(o.path); // for path.c/h
set_umask(o.umask); // for fs.c/h
/* set SIGINT SIGTREM to die routine */
set_int_term();
test_network(&o);
die(DIE_SUCCESS);
}