summaryrefslogtreecommitdiff
path: root/include/tarfn.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/tarfn.h')
-rw-r--r--include/tarfn.h57
1 files changed, 57 insertions, 0 deletions
diff --git a/include/tarfn.h b/include/tarfn.h
new file mode 100644
index 000000000..5e387b07b
--- /dev/null
+++ b/include/tarfn.h
@@ -0,0 +1,57 @@
+#ifndef _TAR_FUNCTION_H_
+#define _TAR_FUNCTION_H_
+
+/*
+ * Functions for extracting tar archives.
+ * Bruce Perens, April-May 1995
+ * Copyright (C) 1995 Bruce Perens
+ * This is free software under the GNU General Public License.
+ */
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+enum TarFileType {
+ NormalFile0 = '\0', /* For compatibility with decades-old bug */
+ NormalFile1 = '0',
+ HardLink = '1',
+ SymbolicLink = '2',
+ CharacterDevice = '3',
+ BlockDevice = '4',
+ Directory = '5',
+ FIFO = '6'
+};
+typedef enum TarFileType TarFileType;
+
+struct TarInfo {
+ void * UserData; /* User passed this in as argument */
+ char * Name; /* File name */
+ mode_t Mode; /* Unix mode, including device bits. */
+ size_t Size; /* Size of file */
+ time_t ModTime; /* Last-modified time */
+ TarFileType Type; /* Regular, Directory, Special, Link */
+ char * LinkName; /* Name for symbolic and hard links */
+ dev_t Device; /* Special device for mknod() */
+ uid_t UserID; /* Numeric UID */
+ gid_t GroupID; /* Numeric GID */
+};
+typedef struct TarInfo TarInfo;
+
+typedef int (*TarReadFunction)(void * userData, char * buffer, int length);
+
+typedef int (*TarFunction)(TarInfo * h);
+
+struct TarFunctions {
+ TarReadFunction Read;
+ TarFunction ExtractFile;
+ TarFunction MakeDirectory;
+ TarFunction MakeHardLink;
+ TarFunction MakeSymbolicLink;
+ TarFunction MakeSpecialFile;
+};
+typedef struct TarFunctions TarFunctions;
+
+extern int TarExtractor(void * userData, const TarFunctions * functions);
+
+#endif