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

Tom Spear speeddymon at gmail.com
Fri Apr 27 10:47:34 CDT 2007

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') {


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..



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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: regedit.cmdline.patch
Type: application/octet-stream
Size: 447 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20070427/dbcac261/regedit.cmdline-0001.obj

More information about the wine-devel mailing list