> First of all, it's going to fail horribly if the options to the actual command include an '=' as in:
> <pre>
> /bin/env KEY=VALUE NAME=CONTENT command --option=enabled
> </pre>

This works fine. We stop at the first word that doesn't contain an equal sign. Any later word that contains it is never even scanned, since we stop before that.

> we need to keep track of whether last time round the loop we were looking at a space or an =

This is what ``eq_sign_found`` does.

You do have a point about the consecutive spaces. I can fix that real quick, but it's not going to be perfect (a quoted value containing spaces won't work, for example), but I think I prefer to keep it simple. It's mainly meant to scan command strings from package bodies, which are for the most part written by us, and since this is a stop gap solution for our existing package promises, I prefer simplicity over flexibility.