[PATCH] modprobe and multiple options to modules

Yann E. MORIN yann.morin.1998 at anciens.enib.fr
Fri Sep 30 06:30:27 UTC 2005


Hi!

Quoting Rob Landley <rob at landley.net>:
> Sounds like you've got a good handle on things.  I look forward to seeing the
> result...

Hmm. Looks like not to me. As of now, I've broken the string parsing into
finding the begining of an argument (the first char in the string that is not
a space), and the end of the argument (the next first char that is not escaped
and not between quotes). Single- and double-quotes evaluation (not yet fully
compliant to traditional sh I guess...) Plus some escaping evaluation ('\"',
'\'', '\ ', plus all the \a\b\t\n\v\f\r\0.

So far the original command string was modified by the function, and I don't
find it very interesting because when we want variables expansion, then we
would need to expand/shrink the string at will. So I started xstrdup'ing the
original string to get a working copy of the current argument (with trailing
garbage being the remaining args).

It is the responsibility of the caller to iterate over the arguments, and
free the xstrdup'ed arguments. And I conditionned the memory freeing to
CONFIG_FEATURE_CLEAN_UP being defined (or we leak memory when looping for
dependencies).

But for now it dumps core... :-(

static char* parse_command_string( char* src, char **dst );
/*   src: pointer to string containing options
 *   dst: pointer to where to store the parsed option
 *   return value: the pointer to the first char after the parsed option,
 *                 NULL if there was no option parsed (only trailing spaces).
 *   Note that memory is allocated with bb_xstrdup when a new argument
 *   was parsed. Don't forget to free it!
 */

Tonight for a status update (or earlier when I have something working!).

Regards,
Yann.

--
Yann E. MORIN
Roaming in the world...



More information about the busybox mailing list