From a552eeb498e0270ae9c87ef707865a764df99fb6 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Tue, 26 Sep 2006 09:22:12 +0000 Subject: wget: add (configurable) large file support. Run tested. --- libbb/safe_strtol.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'libbb') diff --git a/libbb/safe_strtol.c b/libbb/safe_strtol.c index ecc1667db..2e8fa9558 100644 --- a/libbb/safe_strtol.c +++ b/libbb/safe_strtol.c @@ -74,3 +74,37 @@ int safe_strtoul(char *arg, unsigned long* value) } #endif +#ifdef L_safe_strtoll +int safe_strtoll(char *arg, long long* value) +{ + char *endptr; + int errno_save = errno; + + assert(arg!=NULL); + errno = 0; + *value = strtoll(arg, &endptr, 0); + if (errno != 0 || *endptr!='\0' || endptr==arg) { + return 1; + } + errno = errno_save; + return 0; +} +#endif + +#ifdef L_safe_strtoull +int safe_strtoull(char *arg, unsigned long long* value) +{ + char *endptr; + int errno_save = errno; + + assert(arg!=NULL); + errno = 0; + *value = strtoull(arg, &endptr, 0); + if (errno != 0 || *endptr!='\0' || endptr==arg) { + return 1; + } + errno = errno_save; + return 0; +} +#endif + -- cgit v1.2.3