ReactOS 0.4.15-dev-7711-g5627da4
options.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int optionInit (int argc, const char **argv)
 
int optionParse (int argc, const char **argv)
 

Variables

charoptchars
 
int opt_buffered
 
int opt_help
 
int opt_force
 
int opt_exit
 
int opt_verbose
 
int opt_console
 
int opt_mark
 
int opt_Mark
 
charopt_Pipe
 
int opt_quit
 
int opt_cli
 
int opt_raw
 
int opt_stats
 
int opt_Source
 
int opt_SrcPlus
 
int opt_twice
 
int opt_Twice
 
int opt_undo
 
int opt_redo
 
char opt_dir []
 
char opt_logFile []
 
charopt_mod
 
char opt_7z []
 
char opt_scanned []
 
char opt_SourcesPath []
 

Function Documentation

◆ optionInit()

int optionInit ( int  argc,
const char **  argv 
)

Definition at line 50 of file options.c.

51{
52 int i;
53 char *s;
54
55 opt_mod = "a";
56 strcpy(opt_dir, "");
60 if ((s = getenv(SOURCES_ENV)))
62
64
65 //The user introduced "log2lines.exe" or "log2lines.exe /?"
66 //Let's help the user
67 if ((argc == 1) ||
68 ((argc == 2) && (argv[1][0] == '/') && (argv[1][1] == '?')))
69 {
70 opt_help++;
71 usage(1);
72 return -1;
73 }
74
75 for (i = 1; i < argc; i++)
76 {
77
78 if ((argv[i][0] == '-') && (i+1 < argc))
79 {
80 //Because these arguments can contain spaces we cant use getopt(), a known bug:
81 switch (argv[i][1])
82 {
83 case 'd':
84 strcpy(opt_dir, argv[i+1]);
85 break;
86 case 'L':
87 opt_mod = "w";
88 //fall through
89 case 'l':
91 break;
92 case 'P':
93 if (!opt_Pipe)
95 strcpy(opt_Pipe, argv[i+1]);
96 break;
97 case 'z':
98 strcpy(opt_7z, argv[i+1]);
99 break;
100 }
101 }
102
104 strcat(opt_scanned, " ");
105 }
106
107 l2l_dbg(4,"opt_scanned=[%s]\n",opt_scanned);
108
109 return 0;
110}
static int argc
Definition: ServiceArgs.c:12
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define LINESIZE
Definition: chargen.c:18
#define malloc
Definition: debug_ros.c:4
GLdouble s
Definition: gl.h:2039
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
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_ char *__cdecl getenv(_In_z_ const char *_VarName)
#define argv
Definition: mplay32.c:18
#define SOURCES_ENV
Definition: config.h:9
#define CMD_7Z
Definition: config.h:18
char opt_SourcesPath[LINESIZE]
Definition: options.c:45
char * opt_Pipe
Definition: options.c:29
int opt_help
Definition: options.c:22
char * opt_mod
Definition: options.c:42
char opt_scanned[LINESIZE]
Definition: options.c:44
char opt_dir[PATH_MAX]
Definition: options.c:40
char opt_7z[PATH_MAX]
Definition: options.c:43
char opt_logFile[PATH_MAX]
Definition: options.c:41
#define l2l_dbg(level,...)
Definition: util.h:35

Referenced by main().

◆ optionParse()

int optionParse ( int  argc,
const char **  argv 
)

Definition at line 112 of file options.c.

113{
114 int i;
115 int optCount = 0;
116 int opt;
117
118 while (-1 != (opt = getopt(argc, (char **const)argv, optchars)))
119 {
120 switch (opt)
121 {
122 case 'b':
123 opt_buffered++;
124 break;
125 case 'c':
126 opt_console++;
127 break;
128 case 'd':
129 optCount++;
130 //just count, see optionInit()
131 break;
132 case 'f':
133 opt_force++;
134 break;
135 case 'h':
136 opt_help++;
137 usage(1);
138 return -1;
139 break;
140 case 'F':
141 opt_exit++;
142 opt_force++;
143 break;
144 case 'l':
145 optCount++;
146 //just count, see optionInit()
147 break;
148 case 'm':
149 opt_mark++;
150 break;
151 case 'M':
152 opt_Mark++;
153 break;
154 case 'r':
155 opt_raw++;
156 break;
157 case 'P':
158 optCount++;
159 //just count, see optionInit()
160 break;
161 case 's':
162 opt_stats++;
163 break;
164 case 'S':
165 optCount++;
167 if (i == 1)
168 sscanf(optarg, "%*d,%s", opt_SourcesPath);
169 l2l_dbg(3, "Sources option parse result: %d+%d,\"%s\"\n", opt_Source, opt_SrcPlus, opt_SourcesPath);
170 if (opt_Source)
171 {
172 /* need to retranslate for source info: */
173 opt_undo++;
174 opt_redo++;
175 }
176 break;
177 case 't':
178 opt_twice++;
179 break;
180 case 'T':
181 opt_twice++;
182 opt_Twice++;
183 break;
184 case 'u':
185 opt_undo++;
186 break;
187 case 'U':
188 opt_undo++;
189 opt_redo++;
190 break;
191 case 'v':
192 opt_verbose++;
193 break;
194 case 'z':
195 optCount++;
197 break;
198 default:
199 usage(0);
200 return -2;
201 break;
202 }
203 optCount++;
204 }
205 if(opt_console)
206 {
207 l2l_dbg(2, "Note: use 's' command in console mode. Statistics option disabled\n");
208 opt_stats = 0;
209 }
210 if (opt_SourcesPath[0])
211 {
213 }
214 if (!opt_dir[0])
215 {
218 }
219
220 return optCount;
221}
int getopt(int nargc, char *const *nargv, const char *ostr)
Definition: getopt.c:55
const char * optarg
Definition: getopt.c:49
_Check_return_ _CRTIMP int __cdecl sscanf(_In_z_ const char *_Src, _In_z_ _Scanf_format_string_ const char *_Format,...)
#define PATH_STR
Definition: compat.h:31
#define DEF_OPT_DIR
Definition: config.h:8
int opt_undo
Definition: options.c:38
int opt_redo
Definition: options.c:39
int opt_SrcPlus
Definition: options.c:35
int opt_raw
Definition: options.c:32
int opt_verbose
Definition: options.c:25
char * optchars
Definition: options.c:20
int opt_force
Definition: options.c:23
int opt_mark
Definition: options.c:27
int opt_Mark
Definition: options.c:28
int opt_twice
Definition: options.c:36
int opt_console
Definition: options.c:26
int opt_stats
Definition: options.c:33
int opt_buffered
Definition: options.c:21
int opt_exit
Definition: options.c:24
int opt_Source
Definition: options.c:34
int opt_Twice
Definition: options.c:37

Referenced by main().

Variable Documentation

◆ opt_7z

char opt_7z[]
extern

Definition at line 43 of file options.c.

Referenced by check_directory(), handle_escape_cmd(), optionInit(), optionParse(), and unpack_iso().

◆ opt_buffered

int opt_buffered
extern

Definition at line 21 of file options.c.

Referenced by handle_escape_cmd(), optionParse(), and set_LogFile().

◆ opt_cli

int opt_cli
extern

Definition at line 31 of file options.c.

Referenced by handle_escape_cmd().

◆ opt_console

int opt_console
extern

Definition at line 26 of file options.c.

Referenced by handle_escape_cmd(), optionParse(), and translate_files().

◆ opt_dir

char opt_dir[]
extern

◆ opt_exit

int opt_exit
extern

Definition at line 24 of file options.c.

Referenced by main(), and optionParse().

◆ opt_force

int opt_force
extern

Definition at line 23 of file options.c.

Referenced by main(), and optionParse().

◆ opt_help

int opt_help
extern

Definition at line 22 of file options.c.

Referenced by optionInit(), and optionParse().

◆ opt_logFile

char opt_logFile[]
extern

Definition at line 41 of file options.c.

Referenced by handle_escape_cmd(), optionInit(), and set_LogFile().

◆ opt_mark

int opt_mark
extern

Definition at line 27 of file options.c.

Referenced by optionParse(), and translate_line().

◆ opt_Mark

int opt_Mark
extern

Definition at line 28 of file options.c.

Referenced by handle_escape_cmd(), optionParse(), and translate_line().

◆ opt_mod

char* opt_mod
extern

Definition at line 42 of file options.c.

Referenced by handle_escape_cmd(), optionInit(), and set_LogFile().

◆ opt_Pipe

char* opt_Pipe
extern

Definition at line 29 of file options.c.

Referenced by handle_escape_cmd(), main(), and optionInit().

◆ opt_quit

int opt_quit
extern

Definition at line 30 of file options.c.

Referenced by handle_escape_cmd(), and translate_files().

◆ opt_raw

int opt_raw
extern

Definition at line 32 of file options.c.

Referenced by handle_escape_cmd(), optionParse(), and translate_files().

◆ opt_redo

int opt_redo
extern

Definition at line 39 of file options.c.

Referenced by handle_escape_cmd(), optionParse(), and translate_line().

◆ opt_scanned

char opt_scanned[]
extern

Definition at line 44 of file options.c.

Referenced by optionInit(), and stat_print().

◆ opt_Source

int opt_Source
extern

Definition at line 34 of file options.c.

Referenced by handle_escape_cmd(), log_file(), optionParse(), and reportSource().

◆ opt_SourcesPath

char opt_SourcesPath[]
extern

Definition at line 45 of file options.c.

Referenced by handle_escape_cmd(), log_file(), optionInit(), and optionParse().

◆ opt_SrcPlus

int opt_SrcPlus
extern

Definition at line 35 of file options.c.

Referenced by handle_escape_cmd(), log_file(), and optionParse().

◆ opt_stats

int opt_stats
extern

Definition at line 33 of file options.c.

Referenced by optionParse(), and translate_files().

◆ opt_twice

int opt_twice
extern

Definition at line 36 of file options.c.

Referenced by handle_escape_cmd(), optionParse(), and print_offset().

◆ opt_Twice

int opt_Twice
extern

Definition at line 37 of file options.c.

Referenced by handle_escape_cmd(), optionParse(), and print_offset().

◆ opt_undo

int opt_undo
extern

Definition at line 38 of file options.c.

Referenced by handle_escape_cmd(), optionParse(), and translate_line().

◆ opt_verbose

int opt_verbose
extern

Definition at line 25 of file options.c.

Referenced by handle_escape_cmd(), and optionParse().

◆ optchars

char* optchars
extern

Definition at line 20 of file options.c.

Referenced by handle_escape_cmd(), optionParse(), and usage().