It's like strtou_(), but rejects negative input, instead of silently converting it to unsigned. Link: <https://softwareengineering.stackexchange.com/a/449060/332848> Signed-off-by: Alejandro Colomar <alx@kernel.org>
19 lines
522 B
C
19 lines
522 B
C
// SPDX-FileCopyrightText: 2023, Alejandro Colomar <alx@kernel.org>
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
|
|
#include <config.h>
|
|
|
|
#include "atoi/strtou_noneg.h"
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
extern inline uintmax_t strtou_noneg(const char *s, char **restrict endp,
|
|
int base, uintmax_t min, uintmax_t max, int *restrict status);
|
|
|
|
extern inline unsigned long strtoul_noneg(const char *s,
|
|
char **restrict endp, int base);
|
|
extern inline unsigned long long strtoull_noneg(const char *s,
|
|
char **restrict endp, int base);
|