test/kw2xrf: use fmt_is_number()

This commit is contained in:
Hauke Petersen 2019-12-05 13:59:54 +01:00
parent ca1fd87c9b
commit fd34b5cfd8
2 changed files with 3 additions and 12 deletions

View File

@ -2,6 +2,7 @@ include ../Makefile.tests_common
USEMODULE += auto_init_gnrc_netif
USEMODULE += gnrc_netdev_default
USEMODULE += fmt
USEMODULE += shell
USEMODULE += shell_commands
USEMODULE += ps

View File

@ -19,6 +19,7 @@
#include <stdio.h>
#include "fmt.h"
#include "shell.h"
#include "kw2xrf.h"
#include "shell_commands.h"
@ -32,21 +33,10 @@
#include "kw2xrf_tm.h"
/* utility functions */
static bool _is_number(char *str)
{
for (; *str; str++) {
if (*str < '0' || *str > '9') {
return false;
}
}
return true;
}
static void _set_test_mode(int argc, char **argv, uint8_t mode)
{
(void) argc;
if (_is_number(argv[1])) {
if (fmt_is_number(argv[1])) {
kernel_pid_t dev = atoi(argv[1]);
if (gnrc_netif_get_by_pid(dev)) {