vsys. first checkin
[vsys.git] / main.ml
1 open Globals
2 open Printf
3 open Inotify
4 open Backend
5 open Frontend
6 open Fifowatcher
7
8 let input_file_list = ref []
9 let cur_dir = ref ""
10 let cur_slice = ref ""
11
12 let cmdspeclist =
13   [
14     ("-backend",Arg.Set_string(Globals.backend), "Backend directory");
15     ("-frontend",Arg.Tuple[Arg.String(fun s->cur_dir:=s);Arg.String(fun s->cur_slice:=s;input_file_list:=(!cur_dir,!cur_slice)::!input_file_list)], "frontendN,slicenameN")
16   ]
17
18 let cont = ref true
19
20 let _ =
21   printf "Vsys v0.3\n";flush stdout;
22   Arg.parse cmdspeclist (fun x->()) "Usage: vsys <list of mount points>";  
23   if (!Globals.backend == "" || !input_file_list == []) then
24       printf "Try vsys --help\n"
25   else
26     begin
27     Dirwatcher.initialize ();
28     Fifowatcher.initialize ();
29     let felst = List.map (fun lst->new frontendHandler lst) !input_file_list in
30         let _ = new backendHandler !Globals.backend felst in
31          Fdwatcher.start_watch ()
32     end