regedit: Add support for 'regedit -' for feeding regedit from stdin.

This commit is contained in:
Francois Gouget 2007-10-09 21:04:28 +02:00 committed by Alexandre Julliard
parent 01e7891d48
commit 09641eeddb

View File

@ -138,7 +138,15 @@ static BOOL PerformRegAction(REGEDIT_ACTION action, LPSTR s)
while(filename[0]) { while(filename[0]) {
char* realname = NULL; char* realname = NULL;
if (strcmp(filename, "-") == 0)
{
reg_file=stdin;
}
else
{
int size; int size;
size=SearchPath(NULL, filename, NULL,0, NULL, NULL); size=SearchPath(NULL, filename, NULL,0, NULL, NULL);
if (size>0) if (size>0)
{ {
@ -158,6 +166,7 @@ static BOOL PerformRegAction(REGEDIT_ACTION action, LPSTR s)
fprintf(stderr,"%s: Can't open file \"%s\"\n", getAppName(), filename); fprintf(stderr,"%s: Can't open file \"%s\"\n", getAppName(), filename);
exit(1); exit(1);
} }
}
processRegLines(reg_file); processRegLines(reg_file);
if (realname) if (realname)
{ {
@ -240,6 +249,12 @@ BOOL ProcessCmdLine(LPSTR lpCmdLine)
s++; s++;
ch = *s; ch = *s;
if (!ch || isspace(ch))
{
/* '-' is a file name. It indicates we should use stdin */
s--;
break;
}
ch2 = *(s+1); ch2 = *(s+1);
chu = toupper(ch); chu = toupper(ch);
if (!ch2 || isspace(ch2)) { if (!ch2 || isspace(ch2)) {