test/kw2xrf: use fmt_is_number()
This commit is contained in:
parent
ca1fd87c9b
commit
fd34b5cfd8
@ -2,6 +2,7 @@ include ../Makefile.tests_common
|
|||||||
|
|
||||||
USEMODULE += auto_init_gnrc_netif
|
USEMODULE += auto_init_gnrc_netif
|
||||||
USEMODULE += gnrc_netdev_default
|
USEMODULE += gnrc_netdev_default
|
||||||
|
USEMODULE += fmt
|
||||||
USEMODULE += shell
|
USEMODULE += shell
|
||||||
USEMODULE += shell_commands
|
USEMODULE += shell_commands
|
||||||
USEMODULE += ps
|
USEMODULE += ps
|
||||||
|
|||||||
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "fmt.h"
|
||||||
#include "shell.h"
|
#include "shell.h"
|
||||||
#include "kw2xrf.h"
|
#include "kw2xrf.h"
|
||||||
#include "shell_commands.h"
|
#include "shell_commands.h"
|
||||||
@ -32,21 +33,10 @@
|
|||||||
#include "kw2xrf_tm.h"
|
#include "kw2xrf_tm.h"
|
||||||
|
|
||||||
/* utility functions */
|
/* 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)
|
static void _set_test_mode(int argc, char **argv, uint8_t mode)
|
||||||
{
|
{
|
||||||
(void) argc;
|
(void) argc;
|
||||||
if (_is_number(argv[1])) {
|
if (fmt_is_number(argv[1])) {
|
||||||
kernel_pid_t dev = atoi(argv[1]);
|
kernel_pid_t dev = atoi(argv[1]);
|
||||||
|
|
||||||
if (gnrc_netif_get_by_pid(dev)) {
|
if (gnrc_netif_get_by_pid(dev)) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user