(bind-func fleet_print_state
(lambda (host:i8* port:i32)
(let ((states (fleet_get_state_all_units host port)))
(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)))