ReactOS 0.4.16-dev-106-g10b08aa
dbgprint.c File Reference
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <tchar.h>
#include <stdio.h>
Include dependency graph for dbgprint.c:

Go to the source code of this file.

Functions

int _tmain (int argc, TCHAR **argv)
 

Function Documentation

◆ _tmain()

int _tmain ( int  argc,
TCHAR **  argv 
)

Definition at line 17 of file dbgprint.c.

18{
19 TCHAR * buf;
20 size_t bufsize;
21 int i;
22 size_t offset;
23
24 bufsize = 0;
25 for(i = 1; i < argc; i++)
26 {
27 bufsize += _tcslen(argv[i]) + 1;
28 }
29
30 if (!bufsize)
31 {
32 return -1;
33 }
34
35 if (_tcsstr(argv[1], "--winetest") && (argc == 3))
36 {
37 char psBuffer[128];
38 char psBuffer2[128];
39 char *nlptr2;
40 char cmd[255];
41 char test[300];
42 FILE *pPipe;
43 FILE *pPipe2;
44
45 /* get available tests */
46 strcpy(cmd, argv[2]);
47 strcat(cmd, " --list");
48 pPipe = _tpopen(cmd, "r");
49 if (pPipe != NULL)
50 {
51 while(fgets(psBuffer, 128, pPipe))
52 {
53 if (psBuffer[0] == ' ')
54 {
55 strcpy(cmd, argv[2]);
56 strcat(cmd, " ");
57 strcat(cmd, psBuffer+4);
58 /* run the current test */
59 strcpy(test, "\n\nRunning ");
60 strcat(test, cmd);
62 pPipe2 = _popen(cmd, "r");
63 if (pPipe2 != NULL)
64 {
65 while(fgets(psBuffer2, 128, pPipe2))
66 {
67 nlptr2 = strchr(psBuffer2, '\n');
68 if (nlptr2)
69 *nlptr2 = '\0';
70 puts(psBuffer2);
71 if (nlptr2)
72 *nlptr2 = '\n';
73 OutputDebugStringA(psBuffer2);
74 }
75 _pclose(pPipe2);
76 }
77 }
78 }
79 _pclose(pPipe);
80 }
81 }
82 else if (_tcsstr(argv[1], "--process") && (argc == 3))
83 {
84 char psBuffer[128];
85 FILE *pPipe;
86
87 pPipe = _tpopen(argv[2], "r");
88 if (pPipe != NULL)
89 {
90 while(fgets(psBuffer, 128, pPipe))
91 {
92 puts(psBuffer);
93 OutputDebugStringA(psBuffer);
94 }
95 _pclose(pPipe);
96 }
97 }
98 else
99 {
100 buf = HeapAlloc(GetProcessHeap(), 0, (bufsize+1) * sizeof(TCHAR));
101 if (!buf)
102 {
103 return -1;
104 }
105
106 offset = 0;
107 for(i = 1; i < argc; i++)
108 {
109 size_t length = _tcslen(argv[i]);
111 offset += length;
112 if (i + 1 < argc)
113 {
114 buf[offset] = _T(' ');
115 }
116 else
117 {
118 buf[offset] = _T('\n');
119 buf[offset+1] = _T('\0');
120 }
121 offset++;
122 }
123 _putts(buf);
126 }
127 return 0;
128}
static int argc
Definition: ServiceArgs.c:12
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
char * strchr(const char *String, int ch)
Definition: utclib.c:501
int puts(const char *string)
Definition: crtsupp.c:23
#define NULL
Definition: types.h:112
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
GLenum GLuint GLsizei bufsize
Definition: glext.h:7473
GLintptr offset
Definition: glext.h:5920
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
void WINAPI SHIM_OBJ_NAME() OutputDebugStringA(LPCSTR lpOutputString)
Definition: ignoredbgout.c:18
_Check_return_opt_ _CRTIMP int __cdecl _pclose(_Inout_ FILE *_File)
_Check_return_opt_ _CRTIMP char *__cdecl fgets(_Out_writes_z_(_MaxCount) char *_Buf, _In_ int _MaxCount, _Inout_ FILE *_File)
_Check_return_ _CRTIMP FILE *__cdecl _popen(_In_z_ const char *_Command, _In_z_ const char *_Mode)
#define _tcsncpy
Definition: tchar.h:1410
#define _tpopen
Definition: tchar.h:698
#define _putts
Definition: tchar.h:587
#define argv
Definition: mplay32.c:18
#define test
Definition: rosglue.h:37
Definition: ftp_var.h:139
#define _T(x)
Definition: vfdio.h:22
#define OutputDebugString
Definition: winbase.h:3890
char TCHAR
Definition: xmlstorage.h:189
#define _tcsstr
Definition: xmlstorage.h:199
#define _tcslen
Definition: xmlstorage.h:198