[programs/regedit] Fix command line processing for /? patch

Tom Spear speeddymon at gmail.com
Fri Apr 27 14:58:26 CDT 2007


On 4/27/07, Tom Spear <speeddymon at gmail.com> wrote:
> On 4/27/07, Tom Spear <speeddymon at gmail.com> wrote:
> > On 4/27/07, Tom Spear <speeddymon at gmail.com> wrote:
> > > On 4/27/07, Alexandre Julliard <julliard at winehq.org> wrote:
> > > > You don't want to do that, even if you print usage, an invalid switch
> > > > needs to cause an error.
> > > So should we fprintf the usage statement and exit(1); or should we
> > > print both the usage, and the error for the invalid switch.
> > >
> > > Unfortunately I don't have a copy of win98's regedit, and winxp's
> > > regedit does not accept command line switches (I have tried), so I
> > > can't check (easily) how the native regedit that ours is supposed to
> > > be command-line compatible with, does it.
> >
> > Neither.  I just figured out why /? is not working.  I can't believe
> > that I did not think of this before.  The shell processes an unescaped
> > ?.  In order for it to work, I have to use /\? ..  If I just do /?
> > then s ends up being /c /d and so ch ends up being c, which makes chu
> > C (which is missing from the ignored switches if statement)..
> >
> > With the old code:
> >
> > regedit /c returns "regedit: Undefined switch /C!"
> > regedit /? returns "regedit: Undefined switch /C!"
> > regedit /C returns "regedit: Undefined switch /C!"
> >
> > The usage shows /c and /C as being valid switches.
> >
> > So.. I changed the line
> >
> > if (chu == 'S' || chu == 'V') {
> >
> > to
> >
> > if (chu == 'S' || chu == 'V' || chu == 'C') {
> >
> > and so now:
> >
> > regedit /c opens regedit
> > regedit /? shows the usage statement  !!!!!
> > regedit /C opens regedit
> >
> > Is this a proper fix?  Can I submit it?  The diff is attached..
> Further testing shows apparently not, because s is being shifted to the /d now.
>
> Any ideas on how to properly capture /? vs having to escape it like /\?      ??
And even more further testing shows that my distro is wonky.  echo /?
for me echos /c /d to my terminal....  Guess it's time to email Pat
Volkerding to find out if he can fix it for the next slack release.

-- 
Thanks

Tom

Check out this new 3D Instant Messenger called IMVU.  It's the best I
have seen yet!



http://imvu.com/catalog/web_invitation.php?userId=1547373&from=power-email



More information about the wine-devel mailing list