mirror of
https://github.com/weechat/weechat.git
synced 2026-06-28 22:06:38 +02:00
exec: use util functions to parse integers
This commit is contained in:
@@ -185,8 +185,7 @@ exec_command_parse_options (struct t_exec_cmd_options *cmd_options,
|
||||
int argc, char **argv, int start_arg,
|
||||
int set_command_index)
|
||||
{
|
||||
int i, j, end, length, length_total;
|
||||
char *error;
|
||||
int i, j, end, length, length_total, timeout;
|
||||
|
||||
for (i = start_arg; i < argc; i++)
|
||||
{
|
||||
@@ -318,10 +317,9 @@ exec_command_parse_options (struct t_exec_cmd_options *cmd_options,
|
||||
if (i + 1 >= argc)
|
||||
return 0;
|
||||
i++;
|
||||
error = NULL;
|
||||
cmd_options->timeout = strtol (argv[i], &error, 10);
|
||||
if (!error || error[0])
|
||||
if (!weechat_util_parse_int (argv[i], 10, &timeout))
|
||||
return 0;
|
||||
cmd_options->timeout = timeout;
|
||||
}
|
||||
else if (weechat_strcmp (argv[i], "-name") == 0)
|
||||
{
|
||||
|
||||
@@ -85,15 +85,12 @@ struct t_exec_cmd *
|
||||
exec_search_by_id (const char *id)
|
||||
{
|
||||
struct t_exec_cmd* ptr_exec_cmd;
|
||||
char *error;
|
||||
long number;
|
||||
|
||||
if (!id)
|
||||
return NULL;
|
||||
|
||||
error = NULL;
|
||||
number = strtol (id, &error, 10);
|
||||
if (!error || error[0])
|
||||
if (!weechat_util_parse_long (id, 10, &number))
|
||||
number = -1;
|
||||
|
||||
for (ptr_exec_cmd = exec_cmds; ptr_exec_cmd;
|
||||
|
||||
Reference in New Issue
Block a user