1 /* vi: set sw=4 ts=4: */
3 * Copyright (C) 2003-2004 Erik Andersen <andersen@codepoet.org>
5 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
17 long bb_xgetlarg(const char *arg, int base, long lower, long upper)
21 int errno_save = errno;
25 /* Don't allow leading whitespace.
26 * Wrap isspace in () to make sure we call the
27 * function rather than the macro. */
28 if ((isspace)(*arg)) {
33 result = strtol(arg, &endptr, base);
34 if (errno != 0 || *endptr!='\0' || endptr==arg || result < lower || result > upper)