strtonum.c revision 580374daba2ab2c6075a7d0de9512abff133e2e9
/*
SSSD
SSSD Utility functions
Copyright (C) Stephen Gallagher <sgallagh@redhat.com> 2009
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <ctype.h>
#include <stdlib.h>
#include <errno.h>
#include "config.h"
#include "util/strtonum.h"
/* strtoint32 */
{
long long ret = 0;
errno = 0;
return INT32_MAX;
}
return INT32_MIN;
}
/* If errno was set by strtoll, we'll pass it back as-is */
}
/* strtouint32 */
{
unsigned long long ret = 0;
errno = 0;
if (ret > UINT32_MAX) {
return UINT32_MAX;
}
/* If errno was set by strtoll, we'll pass it back as-is */
}