(bind-func fleet_print_state
(lambda (host:i8* port:i32 unit_name:i8*)
(let ((states (fleet_get_state_for_unit host port unit_name)))
(if (or (null? states) (= (json_array_size states) 0))
(println "Fleet: no states available.")
(doloop (i (json_array_size states))
(let ((state (json_array_get states i)))
(printf "[%lld]\n" i)
(fleet_print_unit_state state))))
(if (not (null? states))
(json_decref states))
void)))