ReactOS 0.4.16-dev-2359-g4b75ec5
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
char *CDECL fgets(char *s, int size, FILE *file)
Definition: file.c:3903
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
Definition: fci.c:127
wchar_t * a2w(char *a, wchar_t *w)
Definition: wmain.c:13

◆ main()

int main ( int  argc,
char argv[] 
)

hosttype.c Copyright (C) 2002 by Brian Palmer brian.nosp@m.p@sg.nosp@m.inet..nosp@m.com

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}
MonoAssembly int argc
Definition: metahost.c:107
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 1365 of file ipconfig.c.

1366{
1367 BOOL DoUsage=FALSE;
1368 BOOL DoAll=FALSE;
1369 BOOL DoRelease=FALSE;
1370 BOOL DoRenew=FALSE;
1371 BOOL DoFlushdns=FALSE;
1372 BOOL DoRegisterdns=FALSE;
1373 BOOL DoDisplaydns=FALSE;
1374 BOOL DoShowclassid=FALSE;
1375 BOOL DoSetclassid=FALSE;
1376
1377 /* Initialize the Console Standard Streams */
1379
1382
1383 /* Parse command line for options we have been given. */
1384 if ((argc > 1) && (argv[1][0] == L'/' || argv[1][0] == L'-'))
1385 {
1386 if (!_wcsicmp(&argv[1][1], L"?"))
1387 {
1388 DoUsage = TRUE;
1389 }
1390 else if (!_wcsnicmp(&argv[1][1], L"ALL", wcslen(&argv[1][1])))
1391 {
1392 DoAll = TRUE;
1393 }
1394 else if (!_wcsnicmp(&argv[1][1], L"RELEASE", wcslen(&argv[1][1])))
1395 {
1396 DoRelease = TRUE;
1397 }
1398 else if (!_wcsnicmp(&argv[1][1], L"RENEW", wcslen(&argv[1][1])))
1399 {
1400 DoRenew = TRUE;
1401 }
1402 else if (!_wcsnicmp(&argv[1][1], L"FLUSHDNS", wcslen(&argv[1][1])))
1403 {
1404 DoFlushdns = TRUE;
1405 }
1406 else if (!_wcsnicmp(&argv[1][1], L"FLUSHREGISTERDNS", wcslen(&argv[1][1])))
1407 {
1408 DoRegisterdns = TRUE;
1409 }
1410 else if (!_wcsnicmp(&argv[1][1], L"DISPLAYDNS", wcslen(&argv[1][1])))
1411 {
1412 DoDisplaydns = TRUE;
1413 }
1414 else if (!_wcsnicmp(&argv[1][1], L"SHOWCLASSID", wcslen(&argv[1][1])))
1415 {
1416 DoShowclassid = TRUE;
1417 }
1418 else if (!_wcsnicmp(&argv[1][1], L"SETCLASSID", wcslen(&argv[1][1])))
1419 {
1420 DoSetclassid = TRUE;
1421 }
1422 }
1423
1424 switch (argc)
1425 {
1426 case 1: /* Default behaviour if no options are given*/
1428 break;
1429 case 2: /* Process all the options that take no parameters */
1430 if (DoUsage)
1431 Usage(FALSE);
1432 else if (DoAll)
1433 ShowInfo(TRUE, TRUE);
1434 else if (DoRelease)
1435 Release(NULL);
1436 else if (DoRenew)
1437 Renew(NULL);
1438 else if (DoFlushdns)
1439 FlushDns();
1440 else if (DoRegisterdns)
1441 RegisterDns();
1442 else if (DoDisplaydns)
1443 DisplayDns();
1444 else
1445 Usage(TRUE);
1446 break;
1447 case 3: /* Process all the options that can have 1 parameter */
1448 if (DoRelease)
1449 Release(argv[2]);
1450 else if (DoRenew)
1451 Renew(argv[2]);
1452 else if (DoShowclassid)
1453 ShowClassId(argv[2]);
1454 else if (DoSetclassid)
1455 SetClassId(argv[2], NULL);
1456 else
1457 Usage(TRUE);
1458 break;
1459 case 4: /* Process all the options that can have 2 parameters */
1460 if (DoSetclassid)
1461 SetClassId(argv[2], argv[3]);
1462 else
1463 Usage(TRUE);
1464 break;
1465 default:
1466 Usage(TRUE);
1467 }
1468
1469 return 0;
1470}
#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
_ACRTIMP int __cdecl _wcsicmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:159
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2983
_ACRTIMP int __cdecl _wcsnicmp(const wchar_t *, const wchar_t *, size_t)
Definition: wcs.c:195
#define L(x)
Definition: resources.c:13
unsigned int BOOL
Definition: ntddk_ex.h:94
_Must_inspect_result_ _In_ USAGE _In_ USHORT _In_ USAGE Usage
Definition: hidpi.h:384
VOID Renew(LPWSTR pszAdapterName)
Definition: ipconfig.c:944
VOID RegisterDns(VOID)
Definition: ipconfig.c:1059
VOID ShowInfo(BOOL bShowHeader, BOOL bAll)
Definition: ipconfig.c:557
VOID FlushDns(VOID)
Definition: ipconfig.c:1043
HANDLE ProcessHeap
Definition: ipconfig.c:47
VOID SetClassId(LPWSTR pszAdapterName, LPWSTR pszClassId)
Definition: ipconfig.c:1237
HINSTANCE hInstance
Definition: ipconfig.c:46
VOID ShowClassId(LPWSTR pszAdapterName)
Definition: ipconfig.c:1230
VOID DisplayDns(VOID)
Definition: ipconfig.c:1195
#define GetModuleHandle
Definition: winbase.h:3576