diff options
Diffstat (limited to 'src/commonlib/bsd/string.c')
-rw-r--r-- | src/commonlib/bsd/string.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/commonlib/bsd/string.c b/src/commonlib/bsd/string.c new file mode 100644 index 0000000000..3286d41b1c --- /dev/null +++ b/src/commonlib/bsd/string.c @@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ + +#include <commonlib/bsd/string.h> +#include <ctype.h> + +unsigned int skip_atoi(char **ptr) +{ + unsigned int result = 0; + char *str; + + for (str = *ptr; isdigit(str[0]); str++) + result = result * 10 + (str[0] - '0'); + *ptr = str; + return result; +} |