ReactOS  0.4.13-dev-235-g7373cb3
evtmsggen.c File Reference
#include <stdio.h>
Include dependency graph for evtmsggen.c:

Go to the source code of this file.

Macros

#define EOL   "\r\n"
 

Functions

static void usage (char *name)
 
int main (int argc, char *argv[])
 

Macro Definition Documentation

◆ EOL

#define EOL   "\r\n"

Definition at line 23 of file evtmsggen.c.

Function Documentation

◆ main()

int main ( int argc  ,
char argv[] 
)

Definition at line 31 of file evtmsggen.c.

32 {
33  FILE* outFile;
34  unsigned int id_min, id_max;
35  unsigned int i;
36 
37  /* Validate the arguments */
38  if (argc != 4)
39  {
40  usage(argv[0]);
41  return -1;
42  }
43 
44  id_min = (unsigned int)atoi(argv[1]);
45  id_max = (unsigned int)atoi(argv[2]);
46  if (id_min > id_max)
47  {
48  fprintf(stderr, "ERROR: Min ID %u cannot be strictly greater than Max ID %u !\n", id_min, id_max);
49  return -1;
50  }
51 
52  /* Open the file */
53  outFile = fopen(argv[3], "wb");
54  if (!outFile)
55  {
56  fprintf(stderr, "ERROR: Could not create output file '%s'.\n", argv[3]);
57  return -1;
58  }
59 
60  /* Generate the file */
61 
62  /* Write the header */
63  fprintf(outFile,
64  ";/*" EOL
65  "; * %s" EOL
66  "; * Contains event message string templates for the EventCreate Command." EOL
67  "; *" EOL
68  "; * This file is autogenerated, do not edit." EOL
69  "; * Generated with:" EOL
70  "; * %s %u %u %s" EOL
71  "; */" EOL
72  EOL
73 #ifdef ENGLISH
74  "LanguageNames=(English=0x409:MSG00409)" EOL
75 #else
76  "LanguageNames=(Neutral=0x0000:MSG00000)" EOL
77 #endif
78  "MessageIdTypedef=DWORD" EOL
79  EOL,
80  argv[3],
81  argv[0], id_min /* argv[1] */, id_max /* argv[2] */, argv[3]);
82 
83  /* Write the message string templates */
84  for (i = id_min; i <= id_max; ++i)
85  {
86  fprintf(outFile,
87  "MessageId=0x%X" EOL
88 #ifdef ENGLISH
89  "Language=English" EOL
90 #else
91  "Language=Neutral" EOL
92 #endif
93  "%%1" EOL
94  "." EOL
95  EOL,
96  i);
97  }
98 
99  /* Close the file */
100  fclose(outFile);
101 
102  return 0;
103 }
static int argc
Definition: ServiceArgs.c:12
#define EOL
Definition: evtmsggen.c:23
static void usage(char *name)
Definition: evtmsggen.c:26
#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
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
_Check_return_ _CRTIMP FILE *__cdecl fopen(_In_z_ const char *_Filename, _In_z_ const char *_Mode)
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
FILE * stderr
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

◆ usage()

static void usage ( char name)
static

Definition at line 26 of file evtmsggen.c.

27 {
28  fprintf(stdout, "Usage: %s ID_min ID_max outfile.mc\n", name);
29 }
FILE * stdout
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
Definition: name.c:36

Referenced by main().