add a --process parameter to redirect stdout to dbgout

usage: dbgprint --process version_winetest.exe

svn path=/trunk/; revision=35920
This commit is contained in:
Christoph von Wittich 2008-09-04 07:58:28 +00:00
parent 0f370b9bf7
commit a073152ea9

View file

@ -5,11 +5,13 @@
* FILE: tools/dbgprint/dbgprint.c
* PURPOSE: outputs a text via DbgPrint API
* PROGRAMMERS: Johannes Anderwald (johannes.anderwald@student.tugraz.at)
* Christoph von Wittich (Christoph_vW@ReactOS.org)
*/
#include <windows.h>
#include <tchar.h>
#include <debug.h>
#include <stdio.h>
int _tmain(int argc, TCHAR ** argv)
{
@ -29,6 +31,23 @@ int _tmain(int argc, TCHAR ** argv)
return -1;
}
if (_tcsstr(argv[1], "--process") && (argc == 3))
{
char psBuffer[128];
FILE *pPipe;
pPipe = _tpopen(argv[2], "r");
if (pPipe != NULL)
{
while(fgets(psBuffer, 128, pPipe))
{
OutputDebugStringA(psBuffer);
}
_pclose(pPipe);
}
}
else
{
buf = HeapAlloc(GetProcessHeap(), 0, (bufsize+1) * sizeof(TCHAR));
if (!buf)
{
@ -54,5 +73,6 @@ int _tmain(int argc, TCHAR ** argv)
}
OutputDebugString(buf);
HeapFree(GetProcessHeap(), 0, buf);
}
return 0;
}