>>> On 21.12.18 at 00:40, <andrew.coop...@citrix.com> wrote: > @@ -271,6 +272,26 @@ int parse_boolean(const char *name, const char *s, const > char *e) > return -1; > } > > +int cmdline_strcmp(const char *frag, const char *name)
__init ? > +{ > + while ( 1 ) > + { > + int res = (*frag - *name); > + > + if ( res || *name == '\0' ) > + { > + /* NUL in 'name' matching punctuation in 'frag' implies success. > */ > + if ( *name == '\0' && ispunct(*frag) ) > + res = 0; Isn't ispunct() true for dashes and perhaps also underscores? I don't think it can be this generic, the more that ... > --- a/xen/include/xen/lib.h > +++ b/xen/include/xen/lib.h > @@ -79,6 +79,13 @@ int parse_bool(const char *s, const char *e); > */ > int parse_boolean(const char *name, const char *s, const char *e); > > +/** > + * Very similar to strcmp(), but will declare a match if the NUL in 'name' > + * lines up with punctuationin 'frag'. Designed for picking exact string > + * matches out of a comma-separated command line fragment. > + */ > +int cmdline_strcmp(const char *frag, const char *name); ... you talk of commas only here. Jan _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel