let n = String.length prefix in
String.length str >= n && String.sub str 0 n = prefix
+let rec string_find s sub =
+ let len = String.length s in
+ let sublen = String.length sub in
+ let rec loop i =
+ if i <= len-sublen then (
+ let rec loop2 j =
+ if j < sublen then (
+ if s.[i+j] = sub.[j] then loop2 (j+1)
+ else -1
+ ) else
+ i (* found *)
+ in
+ let r = loop2 0 in
+ if r = -1 then loop (i+1) else r
+ ) else
+ -1 (* not found *)
+ in
+ loop 0
+
let string_random8 =
let chars = "abcdefghijklmnopqrstuvwxyz0123456789" in
fun () ->
Use C<output-format> as the format for the destination image. If this
is not specified, then the input format is used.
-Supported and known-working output formats are: C<raw>, C<qcow2>.
+Supported and known-working output formats are: C<raw>, C<qcow2>, C<vdi>.
You can also use any format supported by the L<qemu-img(1)> program,
-eg. C<vdi> or C<vmdk>, but support for other formats is reliant on
-qemu.
+eg. C<vmdk>, but support for other formats is reliant on qemu.
Specifying the I<--convert> option is usually a good idea, because
then virt-sparsify doesn't need to try to guess the input format.