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

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



On Fri, Sep 04, 2009 at 06:38:29PM +0200, Matthias Bolte wrote:
> 2009/9/4 Daniel Veillard <veillard redhat com>:
> > 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 veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/


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