mclu list: Ignore libguestfs temporary guestfs-* when displaying active guests.
[mclu.git] / utils.ml
index fd92b79..87c4002 100644 (file)
--- a/utils.ml
+++ b/utils.ml
@@ -33,6 +33,13 @@ let ( /^ ) = Int64.div
 let ( &^ ) = Int64.logand
 let ( ~^ ) = Int64.lognot
 
+let rec filter_map f = function
+  | [] -> []
+  | x :: xs ->
+      match f x with
+      | Some y -> y :: filter_map f xs
+      | None -> filter_map f xs
+
 let human_size i =
   let sign, i = if i < 0L then "-", Int64.neg i else "", i in