This seems like quite a specific function. Is there not an Augeas lens for this file. It would solve this more elegantly.
> +let split_key_value_strings lines = > + let lines = List.filter ((<>) "") lines in > + let lines = List.filter (fun s -> s.[0] <> '#') lines in > + List.map ( > + fun line -> > + let key, value = String.split "=" line in PCRE? Is whitespace significant? > + let value = > + let n = String.length value in > + if n >= 2 && value.[0] = '"' && value.[n-1] = '"' then > + String.sub value 1 (n-2) Maybe use shell_unquote from C_utils? Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top _______________________________________________ Libguestfs mailing list [email protected] https://www.redhat.com/mailman/listinfo/libguestfs
