This is getting a little too nasty to implement portably, similar to the solutions I'd come up with. Portability is an issue, so the /proc/self/cmdline option's out.
I think the best solution is Randal's "strategy rethink". What else did I have to do today, anyway? :)
Comment on RE: Re: Getting a script's original command line