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.
18 long bb_xgetlarg(const char *arg, int base, long lower, long upper)
22 int errno_save = errno;
26 /* Don't allow leading whitespace.
27 * Wrap isspace in () to make sure we call the
28 * function rather than the macro. */
29 if ((isspace)(*arg)) {
34 result = strtol(arg, &endptr, base);
35 if (errno != 0 || *endptr!='\0' || endptr==arg || result < lower || result > upper)