On Mon, Sep 21, 2009 at 05:14:49PM +0100, Richard W.M. Jones wrote:
On Mon, Sep 21, 2009 at 05:50:18PM +0200, Jim Meyering wrote:
> snprintf (append, sizeof append,
> LINUX_CMDLINE
> "%s " /* (selinux) */
> "%s " /* (verbose) */
> "%s", /* (append) */
> g->selinux ? "selinux=1 enforcing=0" :
"selinux=0",
> g->verbose ? "guestfs_verbose=1" : "",
> g->append ? g->append : "");
I will have a think if there's a clearer way to do this, including
handling the contents of LINUX_CMDLINE which is also space-separated.
I had a look at this code but I could really come up with
anything cleaner. One would either end up doing lots of
small allocations or lots of 'strcpy', and the code to keep
track of it all seems far more complex than just keeping track
of the spaces. Oh well ...
Rich.
--
Richard Jones, Emerging Technologies, Red Hat
http://et.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines. Boot with a
live CD or over the network (PXE) and turn machines into Xen guests.
http://et.redhat.com/~rjones/virt-p2v