summaryrefslogtreecommitdiffstats
path: root/lib/libarchive/archive_string.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libarchive/archive_string.c')
-rw-r--r--lib/libarchive/archive_string.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/libarchive/archive_string.c b/lib/libarchive/archive_string.c
index 0e92836..b18f31d 100644
--- a/lib/libarchive/archive_string.c
+++ b/lib/libarchive/archive_string.c
@@ -96,3 +96,18 @@ __archive_strappend_char(struct archive_string *as, char c)
{
return (__archive_string_append(as, &c, 1));
}
+
+struct archive_string *
+__archive_strappend_int(struct archive_string *as, int d, int base)
+{
+ static const char *digits = "0123457890abcdef";
+
+ if (d < 0) {
+ __archive_strappend_char(as, '-');
+ d = -d;
+ }
+ if (d >= base)
+ __archive_strappend_int(as, d/base, base);
+ __archive_strappend_char(as, digits[d % base]);
+ return (as);
+}
OpenPOWER on IntegriCloud