static void FAST_FUNC conv_strtoull(const char *arg, void *result)
{
+ /* Allow leading '+' - bb_strtoull() by itself does not allow it,
+ * and probably shouldn't (other callers might require purely numeric
+ * inputs to be allowed.
+ */
+ if (arg[0] == '+')
+ arg++;
*(unsigned long long*)result = bb_strtoull(arg, NULL, 0);
/* both coreutils 6.10 and bash 3.2:
* $ printf '%x\n' -2
}
static void FAST_FUNC conv_strtoll(const char *arg, void *result)
{
+ if (arg[0] == '+')
+ arg++;
*(long long*)result = bb_strtoll(arg, NULL, 0);
}
static void FAST_FUNC conv_strtod(const char *arg, void *result)
/* Check for the weird "feature":
* a "-" string is apparently a valid "number" for strto[u]l[l]!
* It returns zero and errno is 0! :( */
- first = (arg[0] != '-' && arg[0] != '+' ? arg[0] : arg[1]);
+ first = (arg[0] != '-' ? arg[0] : arg[1]);
if (!isalnum(first)) return ret_ERANGE();
errno = 0;