This commit is contained in:
Joe Kearney 2026-03-01 16:17:04 -06:00
parent 8547b74c3e
commit a65c53f4b2

View file

@ -29,12 +29,14 @@
#include "esp_log.h" #include "esp_log.h"
#include "SystemK.h" #include "SystemK.h"
uint32_t parse_uint32(const char *str, bool *ok) { static uint32_t parse_uint32(const char *str, bool *ok)
{
char *end; char *end;
errno = 0; errno = 0;
unsigned long val = strtoul(str, &end, 10); unsigned long val = strtoul(str, &end, 10);
if (errno != 0 || end == str || *end != '\0' || val > UINT32_MAX) { if (errno != 0 || end == str || *end != '\0' || val > UINT32_MAX)
{
*ok = false; *ok = false;
return 0; return 0;
} }
@ -48,7 +50,7 @@ static void print_usage(void)
printf( printf(
"Usage:\n" "Usage:\n"
" KEvent <Event ID> <Event Data>\n" " KEvent <Event ID> <Event Data>\n"
" (Note that IDs may be SystemK version-dependant.)\n"); " (Note that IDs may be SystemK version-dependent.)\n");
} }
static int cmd_KEvent(int argc, char **argv) static int cmd_KEvent(int argc, char **argv)
@ -75,13 +77,13 @@ static int cmd_KEvent(int argc, char **argv)
else else
{ {
printf("ERROR: Couldn't parse data!"); printf("ERROR: Couldn't parse data!");
return(-1); return (-1);
} }
} }
else else
{ {
printf("ERROR: Couldn't parse SystemK event!"); printf("ERROR: Couldn't parse SystemK event!");
return(-1); return (-1);
} }
} }