[ground_segment] sane error when launching settings without specifying aircraft

This commit is contained in:
Felix Ruess
2013-10-21 18:00:06 +02:00
parent 74cee625a4
commit e08d1bdf35
+12 -3
View File
@@ -80,11 +80,20 @@ let _ =
let ivy_bus = ref Defivybus.default_ivy_bus in
let acs = ref [] in
Arg.parse
let anon_fun = (fun x -> prerr_endline ("WARNING: don't do anything with "^x)) in
let speclist =
[ "-b", Arg.String (fun x -> ivy_bus := x), (sprintf "<ivy bus> Default is %s" !ivy_bus);
"-ac", Arg.String (fun x -> acs := x :: !acs), "A/C name"]
(fun x -> prerr_endline ("WARNING: don't do anything with "^x))
"Usage: ";
and usage_msg = "Usage: " in
Arg.parse speclist anon_fun usage_msg;
if List.length !acs = 0 then begin
prerr_endline "Error: Specify at least one Aircraft for which to display the settings!";
Arg.usage speclist usage_msg;
exit 1
end;
(** Connect to the Ivy bus *)
Ivy.init "Paparazzi settings" "READY" (fun _ _ -> ());