ReactOS  0.4.13-dev-257-gfabbd7c
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 }
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
#define wchar_t
Definition: wchar.h:102
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204

Referenced by fgetws(), and main().

◆ 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 }
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLenum GLuint GLsizei bufsize
Definition: glext.h:7473
smooth NULL
Definition: ftsmooth.c:416
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
_Check_return_opt_ _CRTIMP char *__cdecl fgets(_Out_writes_z_(_MaxCount) char *_Buf, _In_ int _MaxCount, _Inout_ FILE *_File)
Definition: fci.c:126
wchar_t * a2w(char *a, wchar_t *w)
Definition: wmain.c:13

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

◆ 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 }
static int argc
Definition: ServiceArgs.c:12
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
#define argv
Definition: mplay32.c:18
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 wmain(int argc, wchar_t *argv[])
Definition: tracert.cpp:556
smooth NULL
Definition: ftsmooth.c:416
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
wchar_t * a2w(char *a, wchar_t *w)
Definition: wmain.c:13

◆ wmain()

int wmain ( int  argc,
wchar_t argv[] 
)

Main entry point

Definition at line 556 of file tracert.cpp.

557 {
558 #ifdef USE_CONUTILS
559  /* Initialize the Console Standard Streams */
561 #endif
562 
563  Info.ResolveAddresses = true;
564  Info.MaxHops = 30;
565  Info.Timeout = 4000;
566  Info.Family = AF_UNSPEC;
567 
568  if (!ParseCmdline(argc, argv))
569  {
570  return 1;
571  }
572 
573  WSADATA WsaData;
574  if (WSAStartup(MAKEWORD(2, 2), &WsaData))
575  {
576  return 1;
577  }
578 
579  bool Success;
581 
582  WSACleanup();
583 
584  return Success ? 0 : 1;
585 }
static int argc
Definition: ServiceArgs.c:12
#define MAKEWORD(a, b)
Definition: typedefs.h:247
static bool RunTraceRoute()
Definition: tracert.cpp:369
INT WSAAPI WSACleanup(VOID)
Definition: startup.c:60
#define argv
Definition: mplay32.c:18
struct TraceInfo Info
#define ConInitStdStreams()
Definition: stream.h:122
INT WINAPI WSAStartup(IN WORD wVersionRequested, OUT LPWSADATA lpWSAData)
Definition: startup.c:113
#define AF_UNSPEC
Definition: winsock.h:344
static bool ParseCmdline(int argc, wchar_t *argv[])
Definition: tracert.cpp:499

Referenced by main().