summaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenis Vlasenko2006-09-26 09:22:12 +0000
committerDenis Vlasenko2006-09-26 09:22:12 +0000
commita552eeb498e0270ae9c87ef707865a764df99fb6 (patch)
tree1a385f7c6f1eab36fb66278e48840fe7fdc0b882 /libbb
parent3312c989e6a145dc38e5bb874e713aa92b2b0698 (diff)
downloadbusybox-a552eeb498e0270ae9c87ef707865a764df99fb6.zip
busybox-a552eeb498e0270ae9c87ef707865a764df99fb6.tar.gz
wget: add (configurable) large file support. Run tested.
Diffstat (limited to 'libbb')
-rw-r--r--libbb/safe_strtol.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/libbb/safe_strtol.c b/libbb/safe_strtol.c
index ecc1667..2e8fa95 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
+