strnum.c revision f1fab6f1b9c1e983577ff745d9b6e74a2d8c6634
7ef3553585e556f35d5919589cfdc1de3329e4bbTimo Sirainen/* Copyright (c) 2010-2014 Dovecot authors, see the included COPYING file */
7ef3553585e556f35d5919589cfdc1de3329e4bbTimo Sirainenbool str_is_numeric(const char *str, char end_char)
2753f93e5d9cd5fbd773540de3772d182fcced5eStephan Boschint str_to_uint(const char *str, unsigned int *num_r)
2753f93e5d9cd5fbd773540de3772d182fcced5eStephan Bosch *num_r = (unsigned int)l;
2753f93e5d9cd5fbd773540de3772d182fcced5eStephan Boschint str_to_ulong(const char *str, unsigned long *num_r)
c3c07d6527ad28c8546cbbf84c257d178e23c184Timo Sirainen if (l > (unsigned long)-1)
7ef3553585e556f35d5919589cfdc1de3329e4bbTimo Sirainen *num_r = (unsigned long)l;
uintmax_t l;
*num_r = (unsigned long long)l;
uintmax_t l;
uintmax_t l;
uintmax_t n = 0;
*num_r = n;
const char *endp;
uintmax_t n;
*num_r = n;
uintmax_t l; \
*num_r = l; \
intmax_t l;
*num_r = (int)l;
intmax_t l;
*num_r = (long)l;
intmax_t l;
*num_r = (long long)l;
uintmax_t l;
str++;
if (!neg) {
if (l > INTMAX_MAX)
unsigned int result_bits;
if ((l >> result_bits) != 0)
uintmax_t l;
uintmax_t l;
#ifndef __APPLE__
uintmax_t l;
uintmax_t l;
intmax_t l;
uintmax_t l;
return FALSE;
return l == num;