summaryrefslogtreecommitdiff
path: root/archival/libunarchive/data_align.c
diff options
context:
space:
mode:
authorGlenn L McGrath2002-09-25 02:47:48 +0000
committerGlenn L McGrath2002-09-25 02:47:48 +0000
commit7ca04f328e22fcbee4659d73f9a72dfdf1dd6a23 (patch)
treef38c7ef4317eea28c6abdb0adbbb286fe041711e /archival/libunarchive/data_align.c
parentecfa290cfd4953598e6d91989bd66ac16e135f84 (diff)
downloadbusybox-7ca04f328e22fcbee4659d73f9a72dfdf1dd6a23.zip
busybox-7ca04f328e22fcbee4659d73f9a72dfdf1dd6a23.tar.gz
New common unarchive code.
Diffstat (limited to 'archival/libunarchive/data_align.c')
-rw-r--r--archival/libunarchive/data_align.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/archival/libunarchive/data_align.c b/archival/libunarchive/data_align.c
new file mode 100644
index 0000000..d6243bc
--- /dev/null
+++ b/archival/libunarchive/data_align.c
@@ -0,0 +1,13 @@
+#include <errno.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include "unarchive.h"
+#include "libbb.h"
+
+extern const unsigned short data_align(const int src_fd, const unsigned int offset, const unsigned short align_to)
+{
+ const unsigned short skip_amount = (align_to - (offset % align_to)) % align_to;
+ seek_sub_file(src_fd, skip_amount);
+
+ return(skip_amount);
+}