ReactOS 0.4.15-dev-7942-gd23573b
wmain.c File Reference
#include <stdio.h>
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
Include dependency graph for wmain.c:

Go to the source code of this file.

Functions

int wmain (int argc, wchar_t *argv[])
 
wchar_ta2w (char *a, wchar_t *w)
 
wchar_tfgetws (wchar_t *buf, int bufsize, FILE *file)
 
int main (int argc, char *argv[])
 

Function Documentation

◆ a2w()

wchar_t * a2w ( char a,
wchar_t w 
)

Definition at line 13 of file wmain.c.

14{
15 wchar_t * ww = w;
16 while (*a) *w++ = (wchar_t) *a++;
17 *w = 0;
18 return ww;
19}
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
#define wchar_t
Definition: wchar.h:102

Referenced by fgetws(), main(), and START_TEST().

◆ fgetws()

wchar_t * fgetws ( wchar_t buf,
int  bufsize,
FILE file 
)

Definition at line 22 of file wmain.c.

23{
24 char * abuf = GlobalAlloc(bufsize,0);
25 if (!buf)return NULL;
26 fgets(abuf,bufsize,file);
27 a2w(abuf,buf);
28 GlobalFree(abuf);
29 return buf;
30}
#define NULL
Definition: types.h:112
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLenum GLuint GLsizei bufsize
Definition: glext.h:7473
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
_Check_return_opt_ _CRTIMP char *__cdecl fgets(_Out_writes_z_(_MaxCount) char *_Buf, _In_ int _MaxCount, _Inout_ FILE *_File)
Definition: fci.c:127
wchar_t * a2w(char *a, wchar_t *w)
Definition: wmain.c:13

Referenced by DosBIOSInitialize(), FindString(), InterpretInteractive(), InterpretMain(), LoadBootIni(), LoadIniFile(), LoadSystemIni(), ReadFromFile(), RunScript(), test_fgetwc(), test_file_put_get(), test_fileops(), wmain(), and XCOPY_ProcessExcludeFile().

◆ main()

int main ( int argc  ,
char argv[] 
)

Definition at line 32 of file wmain.c.

33{
34 wchar_t ** wargv;
35 int i;
36 int ec;
37
38 wargv = (wchar_t **) GlobalAlloc(
39 sizeof(void*) * argc,
40 0
41 );
42 for(i=0;i<argc;++i)
43 {
44 wargv[i] = (wchar_t*) GlobalAlloc(
45 sizeof(wchar_t) * (1+lstrlenA(argv[i])),
46 0
47 );
48 a2w(argv[i],wargv[i]);
49 }
50 wargv[i] = NULL;
51 ec = wmain(argc,wargv);
52 for (i=0;wargv[i];++i) GlobalFree(wargv[i]);
53 return ec;
54}
static int argc
Definition: ServiceArgs.c:12
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
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
#define argv
Definition: mplay32.c:18
int wmain()

◆ wmain()

int wmain ( int  argc,
wchar_t argv[] 
)

Main entry point

Definition at line 1215 of file ipconfig.c.

1216{
1217 BOOL DoUsage=FALSE;
1218 BOOL DoAll=FALSE;
1219 BOOL DoRelease=FALSE;
1220 BOOL DoRenew=FALSE;
1221 BOOL DoFlushdns=FALSE;
1222 BOOL DoRegisterdns=FALSE;
1223 BOOL DoDisplaydns=FALSE;
1224 BOOL DoShowclassid=FALSE;
1225 BOOL DoSetclassid=FALSE;
1226
1227 /* Initialize the Console Standard Streams */
1229
1232
1233 /* Parse command line for options we have been given. */
1234 if ((argc > 1) && (argv[1][0]=='/' || argv[1][0]=='-'))
1235 {
1236 if (!_tcsicmp(&argv[1][1], _T("?")))
1237 {
1238 DoUsage = TRUE;
1239 }
1240 else if (!_tcsnicmp(&argv[1][1], _T("ALL"), _tcslen(&argv[1][1])))
1241 {
1242 DoAll = TRUE;
1243 }
1244 else if (!_tcsnicmp(&argv[1][1], _T("RELEASE"), _tcslen(&argv[1][1])))
1245 {
1246 DoRelease = TRUE;
1247 }
1248 else if (!_tcsnicmp(&argv[1][1], _T("RENEW"), _tcslen(&argv[1][1])))
1249 {
1250 DoRenew = TRUE;
1251 }
1252 else if (!_tcsnicmp(&argv[1][1], _T("FLUSHDNS"), _tcslen(&argv[1][1])))
1253 {
1254 DoFlushdns = TRUE;
1255 }
1256 else if (!_tcsnicmp(&argv[1][1], _T("FLUSHREGISTERDNS"), _tcslen(&argv[1][1])))
1257 {
1258 DoRegisterdns = TRUE;
1259 }
1260 else if (!_tcsnicmp(&argv[1][1], _T("DISPLAYDNS"), _tcslen(&argv[1][1])))
1261 {
1262 DoDisplaydns = TRUE;
1263 }
1264 else if (!_tcsnicmp(&argv[1][1], _T("SHOWCLASSID"), _tcslen(&argv[1][1])))
1265 {
1266 DoShowclassid = TRUE;
1267 }
1268 else if (!_tcsnicmp(&argv[1][1], _T("SETCLASSID"), _tcslen(&argv[1][1])))
1269 {
1270 DoSetclassid = TRUE;
1271 }
1272 }
1273
1274 switch (argc)
1275 {
1276 case 1: /* Default behaviour if no options are given*/
1278 break;
1279 case 2: /* Process all the options that take no parameters */
1280 if (DoUsage)
1281 Usage();
1282 else if (DoAll)
1283 ShowInfo(TRUE, TRUE);
1284 else if (DoRelease)
1285 Release(NULL);
1286 else if (DoRenew)
1287 Renew(NULL);
1288 else if (DoFlushdns)
1289 FlushDns();
1290 else if (DoRegisterdns)
1291 RegisterDns();
1292 else if (DoDisplaydns)
1293 DisplayDns();
1294 else
1295 Usage();
1296 break;
1297 case 3: /* Process all the options that can have 1 parameter */
1298 if (DoRelease)
1299 Release(argv[2]);
1300 else if (DoRenew)
1301 Renew(argv[2]);
1302 else if (DoShowclassid)
1303 _tprintf(_T("\nSorry /showclassid adapter is not implemented yet\n"));
1304 else if (DoSetclassid)
1305 _tprintf(_T("\nSorry /setclassid adapter is not implemented yet\n"));
1306 else
1307 Usage();
1308 break;
1309 case 4: /* Process all the options that can have 2 parameters */
1310 if (DoSetclassid)
1311 _tprintf(_T("\nSorry /setclassid adapter [classid]is not implemented yet\n"));
1312 else
1313 Usage();
1314 break;
1315 default:
1316 Usage();
1317 }
1318
1319 return 0;
1320}
#define ConInitStdStreams()
Definition: fc.c:13
_In_ BOOLEAN Release
Definition: cdrom.h:920
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define GetProcessHeap()
Definition: compat.h:736
unsigned int BOOL
Definition: ntddk_ex.h:94
_Must_inspect_result_ _In_ USAGE _In_ USHORT _In_ USAGE Usage
Definition: hidpi.h:384
#define _tprintf
Definition: tchar.h:506
VOID Renew(LPWSTR pszAdapterName)
Definition: ipconfig.c:931
VOID RegisterDns(VOID)
Definition: ipconfig.c:1040
VOID ShowInfo(BOOL bShowHeader, BOOL bAll)
Definition: ipconfig.c:532
VOID FlushDns(VOID)
Definition: ipconfig.c:1024
HANDLE ProcessHeap
Definition: ipconfig.c:43
HINSTANCE hInstance
Definition: ipconfig.c:42
VOID DisplayDns(VOID)
Definition: ipconfig.c:1176
#define _T(x)
Definition: vfdio.h:22
#define GetModuleHandle
Definition: winbase.h:3827
#define _tcsnicmp
Definition: xmlstorage.h:207
#define _tcslen
Definition: xmlstorage.h:198
#define _tcsicmp
Definition: xmlstorage.h:205