13
13
#define CONFIG_LOGGER "config"
14
14
15
15
static logger_id_t logger_id ;
16
- // FIXME: We need further improvements without depending on temporary variables
17
- static int tmp_argc ;
18
16
19
17
int get_conf_key (char const * const key ) {
20
18
for (int i = 0 ; i < cli_cmd_num ; ++ i ) {
@@ -26,19 +24,6 @@ int get_conf_key(char const* const key) {
26
24
return 0 ;
27
25
}
28
26
29
- static void remove_nonvalue_dash (int argc , char * * argv ) {
30
- for (int i = 1 ; i < argc ; i ++ ) {
31
- if ((strlen (argv [i ]) == 2 ) && (!strncmp (argv [i ], "--" , 2 ))) {
32
- argc -- ;
33
- if (argc == (i + 1 )) {
34
- break ;
35
- }
36
- memmove (argv + i , argv + (i + 1 ), (argc - i ) * sizeof (char * ));
37
- }
38
- }
39
- tmp_argc = argc ;
40
- }
41
-
42
27
struct option * cli_build_options () {
43
28
struct option * long_options = (struct option * )malloc (cli_cmd_num * sizeof (struct option ));
44
29
for (int i = 0 ; i < cli_cmd_num ; ++ i ) {
@@ -205,9 +190,6 @@ status_t ta_core_file_init(ta_core_t* const core, int argc, char** argv) {
205
190
goto done ;
206
191
}
207
192
208
- // remove `--` from argv
209
- remove_nonvalue_dash (argc , argv );
210
-
211
193
// Loop through the CLI arguments for first time to find the configuration file path
212
194
while ((key = getopt_long (argc , argv , "hv" , long_options , NULL )) != -1 ) {
213
195
switch (key ) {
@@ -295,10 +277,7 @@ status_t ta_core_cli_init(ta_core_t* const core, int argc, char** argv) {
295
277
status_t ret = SC_OK ;
296
278
struct option * long_options = cli_build_options ();
297
279
298
- // remove `--` from argv
299
- remove_nonvalue_dash (tmp_argc , argv );
300
-
301
- while ((key = getopt_long (tmp_argc , argv , "hv" , long_options , NULL )) != -1 ) {
280
+ while ((key = getopt_long (argc , argv , "hv" , long_options , NULL )) != -1 ) {
302
281
switch (key ) {
303
282
case ':' :
304
283
ret = SC_CONF_MISSING_ARGUMENT ;
0 commit comments