ReactOS  0.4.14-dev-55-g2da92ac
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: netstat.c:611
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 611 of file netstat.c.

612 {
613  BOOL Success;
614  WSADATA wsaData;
615 
616  /* Initialize the Console Standard Streams */
618 
619  if (!ParseCmdline(argc, argv))
620  return EXIT_FAILURE;
621 
622  if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0)
623  {
625  return EXIT_FAILURE;
626  }
627 
629  while (bLoopOutput && Success)
630  {
631  Sleep(Interval*1000);
633  }
634 
635  WSACleanup();
636  return (Success ? EXIT_SUCCESS : EXIT_FAILURE);
637 }
static int argc
Definition: ServiceArgs.c:12
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
#define MAKEWORD(a, b)
Definition: typedefs.h:247
INT WSAAPI WSACleanup(VOID)
Definition: startup.c:60
#define argv
Definition: mplay32.c:18
#define EXIT_SUCCESS
Definition: rdjpgcom.c:55
#define ConInitStdStreams()
Definition: stream.h:122
unsigned int BOOL
Definition: ntddk_ex.h:94
INT WINAPI WSAStartup(IN WORD wVersionRequested, OUT LPWSADATA lpWSAData)
Definition: startup.c:113
INT __cdecl ConResPrintf(IN PCON_STREAM Stream, IN UINT uID,...)
Definition: outstream.c:781
DWORD Interval
Definition: netstat.c:33
INT WSAAPI WSAGetLastError(VOID)
Definition: dllmain.c:112
BOOL ParseCmdline(int argc, wchar_t *argv[])
Definition: netstat.c:69
#define EXIT_FAILURE
Definition: jerror.c:33
#define StdErr
Definition: stream.h:77
#define IDS_ERROR_WSA_START
Definition: resource.h:12
BOOL DisplayOutput(VOID)
Definition: netstat.c:168
BOOL bLoopOutput
Definition: netstat.h:18

Referenced by main().