regedit: Add support for 'regedit -' for feeding regedit from stdin.
This commit is contained in:
parent
01e7891d48
commit
09641eeddb
|
@ -138,17 +138,25 @@ 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)
|
||||||
{
|
{
|
||||||
realname=HeapAlloc(GetProcessHeap(),0,size);
|
realname=HeapAlloc(GetProcessHeap(), 0, size);
|
||||||
size=SearchPath(NULL,filename,NULL,size,realname,NULL);
|
size=SearchPath(NULL, filename, NULL, size, realname, NULL);
|
||||||
}
|
}
|
||||||
if (size==0)
|
if (size==0)
|
||||||
{
|
{
|
||||||
fprintf(stderr,"%s: File not found \"%s\" (%d)\n",
|
fprintf(stderr, "%s: File not found \"%s\" (%d)\n",
|
||||||
getAppName(),filename,GetLastError());
|
getAppName(), filename, GetLastError());
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
reg_file = fopen(realname, "r");
|
reg_file = fopen(realname, "r");
|
||||||
|
@ -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)) {
|
||||||
|
|
Loading…
Reference in New Issue