Re: [libvirt] [PATCH 1/7] VMware ESX: Fix VMX path parsing and URL encoding

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Sep 04, 2009 at 06:38:29PM +0200, Matthias Bolte wrote:
> 2009/9/4 Daniel Veillard <veillard@xxxxxxxxxx>:
> > On Thu, Sep 03, 2009 at 06:44:47PM +0200, Matthias Bolte wrote:
> >> * src/esx/esx_driver.c: handle spaces in VMX file path and use a
> >>   virBuffer to encode spaces correctly in the resulting URL
> >> * src/esx/esx_vi.c: include the URL in the error message in case
> >>   of a download error
> >
> >  Looks fine, ACK, pushed :-)
> > I'm just finding hard to understand the scanf pattern,
> >
> 
> Yes, that's a bit tricky. I'll add a comment to explain it.
> 
> sscanf() shall parse the string as '[<datastore>] <path>'. '%as' is
> similar to '%s', but sscanf() will allocate the memory for the string,
> so the caller doesn't need to preallocate a buffer that's large
> enough.
> 
> The s in '%as' can be replaced with a character set, e.g. [a-z].
> 
> '%a[^]%]' matches <datastore>. '[^]%]' excludes ']' from the accepted
> characters, otherwise sscanf() won't match what it should.
> 
> '%a[^\n]' matches <path>. '[^\n]' excludes '\n' from the accepted
> characters, otherwise sscanf() would only match up to the first space,
> but spaces are valid in <path>.

  Okay, thanks :-)

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel@xxxxxxxxxxxx  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]