Re: [programs/regedit] Fix command line processing for /? patch
"Tom Spear" <speeddymon(a)gmail.com> writes:
--- programs/regedit/regedit.c.old 2007-04-25 11:53:24.000000000 -0500 +++ programs/regedit/regedit.c 2007-04-25 11:57:30.000000000 -0500 @@ -104,13 +104,10 @@ case 'E': action = ACTION_EXPORT; break; - case '?': + default: fprintf(stderr,usage); exit(0); break; - default: - error_unknown_switch(chu, s); - break;
You don't want to do that, even if you print usage, an invalid switch needs to cause an error. -- Alexandre Julliard julliard(a)winehq.org
On 4/27/07, Alexandre Julliard <julliard(a)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. -- 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
On 4/27/07, Tom Spear <speeddymon(a)gmail.com> wrote:
On 4/27/07, Alexandre Julliard <julliard(a)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.. -- 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
On 4/27/07, Tom Spear <speeddymon(a)gmail.com> wrote:
On 4/27/07, Tom Spear <speeddymon(a)gmail.com> wrote:
On 4/27/07, Alexandre Julliard <julliard(a)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 /\? ?? -- 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
On 4/27/07, Tom Spear <speeddymon(a)gmail.com> wrote:
On 4/27/07, Tom Spear <speeddymon(a)gmail.com> wrote:
On 4/27/07, Tom Spear <speeddymon(a)gmail.com> wrote:
On 4/27/07, Alexandre Julliard <julliard(a)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
On 27.04.2007 21:58, Tom Spear wrote:
On 4/27/07, Tom Spear <speeddymon(a)gmail.com> wrote:
On 4/27/07, Tom Spear <speeddymon(a)gmail.com> wrote:
On 4/27/07, Tom Spear <speeddymon(a)gmail.com> wrote:
On 4/27/07, Alexandre Julliard <julliard(a)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.
That is expected if you have one-letter directories in your root folder. Try echo "/?" Regards, Carl-Daniel
On 4/27/07, Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006(a)gmx.net> wrote:
On 27.04.2007 21:58, Tom Spear wrote:
On 4/27/07, Tom Spear <speeddymon(a)gmail.com> wrote:
On 4/27/07, Tom Spear <speeddymon(a)gmail.com> wrote:
On 4/27/07, Tom Spear <speeddymon(a)gmail.com> wrote:
On 4/27/07, Alexandre Julliard <julliard(a)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.
That is expected if you have one-letter directories in your root folder. Try echo "/?" Wonderful. Thanks for that. Now I have renamed my symlinks to ~/.wine/drive_c and mnt/d so that they are no longer one letter, and regedit works as it should! All this trouble over a stupid directory name.. Although I do understand why and how it works, now.. That is extremely annoying, but since regedit is the only wine program that I know of that uses /? it's not too big of a deal..
-- 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
participants (3)
-
Alexandre Julliard -
Carl-Daniel Hailfinger -
Tom Spear