helper/options: simplify the code using command_run_linef()
Thanks to command_run_linef() there is no need to pre-build the command using alloc_printf(). Change-Id: Iccfebd6063d1ac162f090fe2309b1f51bebf0214 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5226 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>bscan_optimization
parent
77a8914b7f
commit
a521d93b7a
|
@ -269,19 +269,14 @@ int parse_cmdline_args(struct command_context *cmd_ctx, int argc, char *argv[])
|
||||||
break;
|
break;
|
||||||
case 'd': /* --debug | -d */
|
case 'd': /* --debug | -d */
|
||||||
{
|
{
|
||||||
char *command = alloc_printf("debug_level %s", optarg ? optarg : "3");
|
int retval = command_run_linef(cmd_ctx, "debug_level %s", optarg ? optarg : "3");
|
||||||
int retval = command_run_line(cmd_ctx, command);
|
|
||||||
free(command);
|
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK)
|
||||||
return retval;
|
return retval;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'l': /* --log_output | -l */
|
case 'l': /* --log_output | -l */
|
||||||
if (optarg) {
|
if (optarg)
|
||||||
char *command = alloc_printf("log_output %s", optarg);
|
command_run_linef(cmd_ctx, "log_output %s", optarg);
|
||||||
command_run_line(cmd_ctx, command);
|
|
||||||
free(command);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 'c': /* --command | -c */
|
case 'c': /* --command | -c */
|
||||||
if (optarg)
|
if (optarg)
|
||||||
|
|
Loading…
Reference in New Issue