2
* Copyright (C) 2006-2009 Citrix Systems Inc.
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU Lesser General Public License as published
6
* by the Free Software Foundation; version 2.1 only. with the special
7
* exception on linking described in file LICENSE.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU Lesser General Public License for more details.
16
module Protocol = Gtcomms.Make_Protocol (struct type t=Gtmessages.message end)
17
module Client = Gtcomms.Client (Protocol)
18
module Server = Gtcomms.Server (Protocol)
23
if n=0 then l else nthtl (List.tl l) (n-1)
26
let addr = Sys.argv.(1) in
28
match Sys.argv.(2) with
30
| "shutdown" -> Shutdown (int_of_string Sys.argv.(3))
31
| "reboot" -> Reboot (int_of_string Sys.argv.(3))
33
| "checkcd" -> CheckCD (nthtl (Array.to_list Sys.argv) 3)
34
| "checkcdfail" -> CheckCDFail (nthtl (Array.to_list Sys.argv) 3)
35
| "checkvif" -> CheckVIF Sys.argv.(3)
36
| "checkdisks" -> CheckDisks (nthtl (Array.to_list Sys.argv) 3)
37
| "checkmountdisk" -> CheckMountDisks (nthtl (Array.to_list Sys.argv) 3)
38
| "setuptestdisk" -> SetupTestDisk Sys.argv.(3)
39
| _ -> raise (Failure "Unknown command!")
42
let ans = Client.emit_answer addr 8085 msg in
44
CmdResult str -> print_endline str
48
Printf.printf "Exception trapped: %s\n" (Printexc.to_string exc);