diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-09-26 09:22:12 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-09-26 09:22:12 +0000 |
commit | a552eeb498e0270ae9c87ef707865a764df99fb6 (patch) | |
tree | 1a385f7c6f1eab36fb66278e48840fe7fdc0b882 /libbb | |
parent | 3312c989e6a145dc38e5bb874e713aa92b2b0698 (diff) | |
download | busybox-a552eeb498e0270ae9c87ef707865a764df99fb6.tar.gz |
wget: add (configurable) large file support. Run tested.
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/safe_strtol.c | 34 |
1 files changed, 34 insertions, 0 deletions
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 + |