tarruby 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. data/README.txt +99 -0
  2. data/ext/extconf.rb +19 -0
  3. data/ext/libtar/COPYRIGHT +35 -0
  4. data/ext/libtar/ChangeLog +243 -0
  5. data/ext/libtar/ChangeLog-1.0.x +141 -0
  6. data/ext/libtar/INSTALL +183 -0
  7. data/ext/libtar/Makefile.in +51 -0
  8. data/ext/libtar/README +121 -0
  9. data/ext/libtar/TODO +10 -0
  10. data/ext/libtar/autoconf/ac_path_generic.m4 +136 -0
  11. data/ext/libtar/autoconf/aclocal.m4 +199 -0
  12. data/ext/libtar/autoconf/encap.m4 +133 -0
  13. data/ext/libtar/autoconf/install-sh +251 -0
  14. data/ext/libtar/autom4te.cache/output.0 +8102 -0
  15. data/ext/libtar/autom4te.cache/requests +112 -0
  16. data/ext/libtar/autom4te.cache/traces.0 +382 -0
  17. data/ext/libtar/compat/ChangeLog +31 -0
  18. data/ext/libtar/compat/README +12 -0
  19. data/ext/libtar/compat/TODO +4 -0
  20. data/ext/libtar/compat/basename.c +91 -0
  21. data/ext/libtar/compat/compat.h +260 -0
  22. data/ext/libtar/compat/dirname.c +96 -0
  23. data/ext/libtar/compat/fnmatch.c +237 -0
  24. data/ext/libtar/compat/gethostbyname_r.c +41 -0
  25. data/ext/libtar/compat/gethostname.c +36 -0
  26. data/ext/libtar/compat/getservbyname_r.c +41 -0
  27. data/ext/libtar/compat/glob.c +898 -0
  28. data/ext/libtar/compat/inet_aton.c +27 -0
  29. data/ext/libtar/compat/module.ac +591 -0
  30. data/ext/libtar/compat/snprintf.c +788 -0
  31. data/ext/libtar/compat/strdup.c +62 -0
  32. data/ext/libtar/compat/strlcat.c +72 -0
  33. data/ext/libtar/compat/strlcpy.c +68 -0
  34. data/ext/libtar/compat/strmode.c +199 -0
  35. data/ext/libtar/compat/strrstr.c +40 -0
  36. data/ext/libtar/compat/strsep.c +87 -0
  37. data/ext/libtar/config.h.in +187 -0
  38. data/ext/libtar/configure +8102 -0
  39. data/ext/libtar/configure.ac +114 -0
  40. data/ext/libtar/doc/Makefile.in +152 -0
  41. data/ext/libtar/doc/tar_append_file.3 +50 -0
  42. data/ext/libtar/doc/tar_block_read.3 +24 -0
  43. data/ext/libtar/doc/tar_extract_all.3 +43 -0
  44. data/ext/libtar/doc/tar_extract_file.3 +84 -0
  45. data/ext/libtar/doc/tar_open.3 +97 -0
  46. data/ext/libtar/doc/th_get_pathname.3 +63 -0
  47. data/ext/libtar/doc/th_print_long_ls.3 +22 -0
  48. data/ext/libtar/doc/th_read.3 +34 -0
  49. data/ext/libtar/doc/th_set_from_stat.3 +45 -0
  50. data/ext/libtar/lib/Makefile.in +92 -0
  51. data/ext/libtar/lib/append.c +272 -0
  52. data/ext/libtar/lib/block.c +384 -0
  53. data/ext/libtar/lib/decode.c +130 -0
  54. data/ext/libtar/lib/encode.c +237 -0
  55. data/ext/libtar/lib/extract.c +656 -0
  56. data/ext/libtar/lib/handle.c +150 -0
  57. data/ext/libtar/lib/internal.h +46 -0
  58. data/ext/libtar/lib/libtar.h +311 -0
  59. data/ext/libtar/lib/output.c +146 -0
  60. data/ext/libtar/lib/util.c +153 -0
  61. data/ext/libtar/lib/wrapper.c +175 -0
  62. data/ext/libtar/libtar/Makefile.in +73 -0
  63. data/ext/libtar/libtar/libtar.c +363 -0
  64. data/ext/libtar/listhash/ChangeLog +15 -0
  65. data/ext/libtar/listhash/TODO +21 -0
  66. data/ext/libtar/listhash/hash.c.in +344 -0
  67. data/ext/libtar/listhash/hash_new.3.in +74 -0
  68. data/ext/libtar/listhash/list.c.in +458 -0
  69. data/ext/libtar/listhash/list_new.3.in +86 -0
  70. data/ext/libtar/listhash/listhash.h.in +196 -0
  71. data/ext/libtar/listhash/module.ac +21 -0
  72. data/ext/libtar/win32/config.h +190 -0
  73. data/ext/libtar/win32/dirent.c +115 -0
  74. data/ext/libtar/win32/dirent.h +24 -0
  75. data/ext/libtar/win32/grp.h +4 -0
  76. data/ext/libtar/win32/listhash/libtar_hash.c +344 -0
  77. data/ext/libtar/win32/listhash/libtar_list.c +458 -0
  78. data/ext/libtar/win32/listhash/libtar_listhash.h +196 -0
  79. data/ext/libtar/win32/pwd.h +4 -0
  80. data/ext/libtar/win32/sys/param.h +8 -0
  81. data/ext/libtar/win32/tar.h +35 -0
  82. data/ext/libtar/win32/utime.h +6 -0
  83. data/ext/libtar/win32/win32/types.h +10 -0
  84. data/ext/tarruby.c +648 -0
  85. metadata +150 -0
@@ -0,0 +1,114 @@
1
+ dnl ### Normal initialization. ######################################
2
+ AC_INIT([libtar], [1.2.11])
3
+ AC_PREREQ([2.57])
4
+ AC_CONFIG_AUX_DIR([autoconf])
5
+ AC_CONFIG_HEADERS([config.h])
6
+ AC_COPYRIGHT([[
7
+ Copyright (c) 1998-2003 University of Illinois Board of Trustees
8
+ Copyright (c) 1998-2003 Mark D. Roth
9
+ All rights reserved.
10
+ ]])
11
+ AC_CONFIG_SRCDIR([lib/libtar.h])
12
+ ENCAP_PKG([], [postinstall-encap])
13
+
14
+
15
+ dnl ### Load subdirectory modules. ##################################
16
+ PSG_MODULE([compat])
17
+ PSG_MODULE([listhash], [libtar])
18
+
19
+
20
+ dnl ### Set some option defaults. ###################################
21
+ if test -z "$CFLAGS"; then
22
+ CFLAGS="-O"
23
+ fi
24
+ MKDIR="mkdir -p -m 755"
25
+ AC_SUBST([MKDIR])
26
+
27
+
28
+ dnl ### Check for compiler et al. ###################################
29
+ AC_PROG_CC
30
+ AC_PROG_RANLIB
31
+ AC_PROG_INSTALL
32
+ AC_PROG_LN_S
33
+ AC_PROG_MAKE_SET
34
+
35
+
36
+ dnl ### Compiler characteristics. ##################################
37
+ AC_AIX
38
+ AC_C_CONST
39
+
40
+
41
+ dnl ### Checks for header files. ###################################
42
+ AC_HEADER_STDC
43
+ AC_CHECK_HEADERS([unistd.h])
44
+ AC_HEADER_MAJOR
45
+ PSG_REPLACE_TYPE([major_t], [unsigned int], [
46
+ #include <sys/types.h>
47
+ #ifdef MAJOR_IN_MKDEV
48
+ # include <sys/mkdev.h>
49
+ #else
50
+ # ifdef MAJOR_IN_SYSMACROS
51
+ # include <sys/sysmacros.h>
52
+ # endif
53
+ #endif
54
+ ])
55
+ PSG_REPLACE_TYPE([minor_t], [unsigned int], [
56
+ #include <sys/types.h>
57
+ #ifdef MAJOR_IN_MKDEV
58
+ # include <sys/mkdev.h>
59
+ #else
60
+ # ifdef MAJOR_IN_SYSMACROS
61
+ # include <sys/sysmacros.h>
62
+ # endif
63
+ #endif
64
+ ])
65
+ PSG_REPLACE_TYPE([dev_t], [unsigned long], [
66
+ #include <sys/types.h>
67
+ #ifdef MAJOR_IN_MKDEV
68
+ # include <sys/mkdev.h>
69
+ #else
70
+ # ifdef MAJOR_IN_SYSMACROS
71
+ # include <sys/sysmacros.h>
72
+ # endif
73
+ #endif
74
+ ])
75
+ PSG_REPLACE_TYPE([socklen_t], [unsigned long], [
76
+ #include <sys/types.h>
77
+ #include <sys/socket.h>
78
+ ])
79
+ PSG_REPLACE_TYPE([uint64_t], [long long])
80
+ AC_TYPE_MODE_T
81
+ AC_TYPE_OFF_T
82
+ AC_TYPE_SIZE_T
83
+ AC_TYPE_UID_T
84
+ PSG_REPLACE_TYPE([nlink_t], [unsigned short])
85
+
86
+
87
+ dnl ### Check for needed functions. ################################
88
+ COMPAT_FUNC_BASENAME
89
+ COMPAT_FUNC_DIRNAME
90
+ COMPAT_FUNC_FNMATCH
91
+ AC_CHECK_FUNCS([lchown])
92
+ COMPAT_FUNC_MAKEDEV
93
+ COMPAT_FUNC_SNPRINTF
94
+ COMPAT_FUNC_STRDUP
95
+ AC_FUNC_STRFTIME
96
+ COMPAT_FUNC_STRLCPY
97
+ COMPAT_FUNC_STRMODE
98
+ COMPAT_FUNC_STRSEP
99
+
100
+
101
+ dnl ### Check for libraries. #######################################
102
+ AC_ARG_WITH([zlib],
103
+ [ --without-zlib Use external gzip binary instead of zlib],
104
+ [],
105
+ [with_zlib=yes])
106
+ if test "$with_zlib" = "yes"; then
107
+ AC_CHECK_LIB([z], [gzread])
108
+ fi
109
+
110
+
111
+ dnl ### Create output files. #######################################
112
+ AC_CONFIG_FILES([Makefile lib/Makefile libtar/Makefile doc/Makefile])
113
+ AC_OUTPUT
114
+
@@ -0,0 +1,152 @@
1
+ # @configure_input@
2
+
3
+ ### Path settings
4
+ srcdir = @srcdir@
5
+ top_srcdir = @top_srcdir@
6
+ prefix = @prefix@
7
+ exec_prefix = @exec_prefix@
8
+ bindir = @bindir@
9
+ mandir = @mandir@
10
+ libdir = @libdir@
11
+ includedir = @includedir@
12
+
13
+ PACKAGE_NAME = @PACKAGE_NAME@
14
+ PACKAGE_VERSION = @PACKAGE_VERSION@
15
+
16
+ @ENCAP_DEFS@
17
+
18
+ ### Installation programs and flags
19
+ INSTALL = @INSTALL@
20
+ INSTALL_PROGRAM = @INSTALL_PROGRAM@ -s
21
+ INSTALL_DATA = @INSTALL_DATA@
22
+ LN_S = @LN_S@
23
+ MKDIR = @MKDIR@
24
+ @SET_MAKE@
25
+
26
+
27
+ ### Makefile rules - no user-servicable parts below
28
+
29
+ TAR_OPEN_SO = tar_fdopen \
30
+ tar_fd \
31
+ tar_close
32
+ TAR_APPEND_FILE_SO = tar_append_eof \
33
+ tar_append_regfile
34
+ TAR_BLOCK_READ_SO = tar_block_write
35
+ TH_READ_SO = th_write
36
+ TH_SET_FROM_STAT_SO = th_finish \
37
+ th_set_device \
38
+ th_set_group \
39
+ th_set_link \
40
+ th_set_mode \
41
+ th_set_path \
42
+ th_set_type \
43
+ th_set_user
44
+ TAR_EXTRACT_FILE_SO = tar_extract_blockdev \
45
+ tar_extract_chardev \
46
+ tar_extract_dir \
47
+ tar_extract_fifo \
48
+ tar_extract_hardlink \
49
+ tar_extract_regfile \
50
+ tar_extract_symlink \
51
+ tar_skip_regfile \
52
+ tar_set_file_perms
53
+ TH_GET_PATHNAME_SO = TH_ISBLK \
54
+ TH_ISCHR \
55
+ TH_ISDIR \
56
+ TH_ISFIFO \
57
+ TH_ISLNK \
58
+ TH_ISLONGLINK \
59
+ TH_ISLONGNAME \
60
+ TH_ISREG \
61
+ TH_ISSYM \
62
+ th_get_crc \
63
+ th_get_devmajor \
64
+ th_get_devminor \
65
+ th_get_gid \
66
+ th_get_linkname \
67
+ th_get_mode \
68
+ th_get_mtime \
69
+ th_get_size \
70
+ th_get_uid
71
+ TH_PRINT_LONG_LS_SO = th_print
72
+ TAR_EXTRACT_ALL_SO = tar_extract_glob \
73
+ tar_append_tree
74
+ @LISTHASH_PREFIX@_HASH_NEW_SO = \
75
+ @LISTHASH_PREFIX@_hash_free \
76
+ @LISTHASH_PREFIX@_hash_next \
77
+ @LISTHASH_PREFIX@_hash_prev \
78
+ @LISTHASH_PREFIX@_hash_search \
79
+ @LISTHASH_PREFIX@_hash_add \
80
+ @LISTHASH_PREFIX@_hash_getkey \
81
+ @LISTHASH_PREFIX@_hash_del
82
+ @LISTHASH_PREFIX@_LIST_NEW_SO = \
83
+ @LISTHASH_PREFIX@_list_free \
84
+ @LISTHASH_PREFIX@_list_next \
85
+ @LISTHASH_PREFIX@_list_prev \
86
+ @LISTHASH_PREFIX@_list_search \
87
+ @LISTHASH_PREFIX@_list_add \
88
+ @LISTHASH_PREFIX@_list_add_str \
89
+ @LISTHASH_PREFIX@_list_del \
90
+ @LISTHASH_PREFIX@_list_dup \
91
+ @LISTHASH_PREFIX@_list_merge
92
+
93
+ DISTCLEANFILES = ../listhash/@LISTHASH_PREFIX@_hash_new.3 \
94
+ ../listhash/@LISTHASH_PREFIX@_list_new.3
95
+
96
+
97
+ all:
98
+
99
+ .PHONY: clean distclean install
100
+
101
+ clean:
102
+
103
+ distclean: clean
104
+ rm -f Makefile ${DISTCLEANFILES}
105
+
106
+ install: all
107
+ ${MKDIR} ${DESTDIR}${mandir}/man3
108
+ ${INSTALL_DATA} ${srcdir}/tar_open.3 ${DESTDIR}${mandir}/man3
109
+ for i in ${TAR_OPEN_SO}; do \
110
+ echo ".so man3/tar_open.3" > ${DESTDIR}${mandir}/man3/$${i}.3; \
111
+ done
112
+ ${INSTALL_DATA} ${srcdir}/tar_append_file.3 ${DESTDIR}${mandir}/man3
113
+ for i in ${TAR_APPEND_FILE_SO}; do \
114
+ echo ".so man3/tar_append_file.3" > ${DESTDIR}${mandir}/man3/$${i}.3; \
115
+ done
116
+ ${INSTALL_DATA} ${srcdir}/tar_block_read.3 ${DESTDIR}${mandir}/man3
117
+ for i in ${TAR_BLOCK_READ_SO}; do \
118
+ echo ".so man3/tar_block_read.3" > ${DESTDIR}${mandir}/man3/$${i}.3; \
119
+ done
120
+ ${INSTALL_DATA} ${srcdir}/th_read.3 ${DESTDIR}${mandir}/man3
121
+ for i in ${TH_READ_SO}; do \
122
+ echo ".so man3/th_read.3" > ${DESTDIR}${mandir}/man3/$${i}.3; \
123
+ done
124
+ ${INSTALL_DATA} ${srcdir}/th_set_from_stat.3 ${DESTDIR}${mandir}/man3
125
+ for i in ${TH_SET_FROM_STAT_SO}; do \
126
+ echo ".so man3/th_set_from_stat.3" > ${DESTDIR}${mandir}/man3/$${i}.3; \
127
+ done
128
+ ${INSTALL_DATA} ${srcdir}/tar_extract_file.3 ${DESTDIR}${mandir}/man3
129
+ for i in ${TAR_EXTRACT_FILE_SO}; do \
130
+ echo ".so man3/tar_extract_file.3" > ${DESTDIR}${mandir}/man3/$${i}.3; \
131
+ done
132
+ ${INSTALL_DATA} ${srcdir}/th_get_pathname.3 ${DESTDIR}${mandir}/man3
133
+ for i in ${TH_GET_PATHNAME_SO}; do \
134
+ echo ".so man3/th_get_pathname.3" > ${DESTDIR}${mandir}/man3/$${i}.3; \
135
+ done
136
+ ${INSTALL_DATA} ${srcdir}/th_print_long_ls.3 ${DESTDIR}${mandir}/man3
137
+ for i in ${TH_PRINT_LONG_LS_SO}; do \
138
+ echo ".so man3/th_print_long_ls.3" > ${DESTDIR}${mandir}/man3/$${i}.3; \
139
+ done
140
+ ${INSTALL_DATA} ${srcdir}/tar_extract_all.3 ${DESTDIR}${mandir}/man3
141
+ for i in ${TAR_EXTRACT_ALL_SO}; do \
142
+ echo ".so man3/tar_extract_all.3" > ${DESTDIR}${mandir}/man3/$${i}.3; \
143
+ done
144
+ ${INSTALL_DATA} ../listhash/@LISTHASH_PREFIX@_hash_new.3 ${DESTDIR}${mandir}/man3
145
+ for i in ${@LISTHASH_PREFIX@_HASH_NEW_SO}; do \
146
+ echo ".so man3/@LISTHASH_PREFIX@_hash_new.3" > ${DESTDIR}${mandir}/man3/$${i}.3; \
147
+ done
148
+ ${INSTALL_DATA} ../listhash/@LISTHASH_PREFIX@_list_new.3 ${DESTDIR}${mandir}/man3
149
+ for i in ${@LISTHASH_PREFIX@_LIST_NEW_SO}; do \
150
+ echo ".so man3/@LISTHASH_PREFIX@_list_new.3" > ${DESTDIR}${mandir}/man3/$${i}.3; \
151
+ done
152
+
@@ -0,0 +1,50 @@
1
+ .TH tar_append_file 3 "Jan 2001" "University of Illinois" "C Library Calls"
2
+ .SH NAME
3
+ tar_append_file, tar_append_eof, tar_append_regfile \- append data to tar archives
4
+ .SH SYNOPSIS
5
+ .B #include <libtar.h>
6
+ .P
7
+ .BI "int tar_append_file(TAR *" t ", char *" realname ","
8
+ .BI "char *" savename ");"
9
+
10
+ .BI "int tar_append_regfile(TAR *" t ", char *" realname ");"
11
+
12
+ .BI "int tar_append_eof(TAR *" t ");"
13
+ .SH VERSION
14
+ This man page documents version 1.2 of \fBlibtar\fP.
15
+ .SH DESCRIPTION
16
+ The \fBtar_append_file\fP() function creates a tar file header block
17
+ describing the file named by the \fIrealname\fP argument, but with
18
+ the encoded filename of \fIsavename\fP. It then sets the current
19
+ header associated with the \fITAR\fP handle \fIt\fP to the newly created
20
+ header block, and writes this block to the tar archive associated with
21
+ \fIt\fP. If the file named by \fIrealname\fP is a regular file (and
22
+ is not encoded as a hard link), \fBtar_append_file\fP() will call
23
+ \fBtar_append_regfile\fP() to append the contents of the file.
24
+
25
+ The \fBtar_append_regfile\fP() function appends the contents of a regular
26
+ file to the tar archive associated with \fIt\fP. Since this function is
27
+ called by \fBtar_append_file\fP(), it should only be necessary for
28
+ applications that construct and write the tar file header on their own.
29
+
30
+ The \fBtar_append_eof\fP() function writes an EOF marker (two blocks of
31
+ all zeros) to the tar file associated with \fIt\fP.
32
+ .SH RETURN VALUES
33
+ On successful completion, these functions will return 0. On failure,
34
+ they will return -1 and set \fIerrno\fP to an appropriate value.
35
+ .SH ERRORS
36
+ The \fBtar_append_*\fP() functions will fail if:
37
+ .IP \fBEINVAL\fP
38
+ Less than \fBT_BLOCKSIZE\fP bytes were written to the tar archive.
39
+ .IP \fBEINVAL\fP
40
+ Less than \fBT_BLOCKSIZE\fP bytes were read from the \fIrealname\fP file.
41
+ .PP
42
+ They may also fail if any of the following functions fail: \fBlstat\fP(),
43
+ \fBmalloc\fP(), \fBopen\fP(), \fBread\fP(), \fBth_write\fP(), or the
44
+ write function for the file type associated with the \fITAR\fP handle
45
+ \fIt\fP.
46
+ .SH SEE ALSO
47
+ .BR read (2),
48
+ .BR open (2),
49
+ .BR lstat (2),
50
+ .BR th_write (3)
@@ -0,0 +1,24 @@
1
+ .TH tar_block_read 3 "Jan 2001" "University of Illinois" "C Library Calls"
2
+ .SH NAME
3
+ tar_block_read, tar_block_write \- macros to call read and write functions
4
+ for the correct tar archive type
5
+ .SH SYNOPSIS
6
+ .B #include <libtar.h>
7
+ .P
8
+ .BI "int tar_block_read(TAR *" t ", char *" buf ");"
9
+
10
+ .BI "int tar_block_write(TAR *" t ", char *" buf ");"
11
+ .SH VERSION
12
+ This man page documents version 1.2 of \fBlibtar\fP.
13
+ .SH DESCRIPTION
14
+ The \fBtar_block_read\fP() and \fBtar_block_write\fP() macros call
15
+ the read and write functions for the tar archive type associated with the
16
+ \fITAR\fP handle \fIt\fP. This type is set when the \fITAR\fP handle
17
+ is created using \fBtar_open\fP().
18
+ .SH RETURN VALUE
19
+ These macros return the same values as the corresponding read and write
20
+ functions.
21
+ .SH SEE ALSO
22
+ .BR read (2),
23
+ .BR write (2),
24
+ .BR tar_open (3)
@@ -0,0 +1,43 @@
1
+ .TH tar_extract_all 3 "Jan 2001" "University of Illinois" "C Library Calls"
2
+ .SH NAME
3
+ tar_extract_all, tar_extract_glob, tar_append_tree \- high-level tar
4
+ archive manipulation functions
5
+ .SH SYNOPSIS
6
+ .B #include <libtar.h>
7
+ .P
8
+ .BI "int tar_extract_all(TAR *" t ", char *" prefix ");"
9
+
10
+ .BI "int tar_extract_glob(TAR *" t ", char *" globname ","
11
+ .BI "char *" prefix ");"
12
+
13
+ .BI "int tar_append_tree(TAR *" t ", char *" realdir ","
14
+ .BI "char *" savedir ");"
15
+ .SH VERSION
16
+ This man page documents version 1.2 of \fBlibtar\fP.
17
+ .SH DESCRIPTION
18
+ The \fBtar_extract_all\fP() function extracts all files from the tar
19
+ archive associated with the \fITAR\fP handle \fIt\fP into the path
20
+ named by the \fIprefix\fP argument.
21
+
22
+ The \fBtar_extract_glob\fP() function extracts all files matching
23
+ the given \fIglob\fP pattern from the tar archive associated with the
24
+ \fITAR\fP handle \fIt\fP into the path named by the \fIprefix\fP argument.
25
+
26
+ The \fBtar_append_tree\fP() function appends all files from the
27
+ directory tree named by \fIrealdir\fP to the tar archive associated with
28
+ the \fITAR\fP handle \fIt\fP. The pathnames stored in the tar archive
29
+ are modified by replacing \fIrealdir\fP with \fIsavedir\fP, so that the
30
+ files will be extracted into \fIsavedir\fP.
31
+ .SH RETURN VALUES
32
+ On successful completion, these functions will return 0. On failure,
33
+ they will return -1 and set \fIerrno\fP to an appropriate value.
34
+ .SH ERRORS
35
+ These functions will fail under the same conditions that the
36
+ \fBtar_skip_regfile\fP(), \fBtar_extract_regfile\fP(), \fBopendir\fP(),
37
+ \fBlstat\fP(), or \fBtar_append_file\fP() functions fail.
38
+ .SH SEE ALSO
39
+ .BR opendir (2),
40
+ .BR lstat (2),
41
+ .BR tar_skip_regfile (3),
42
+ .BR tar_extract_regfile (3),
43
+ .BR tar_append_file (3)
@@ -0,0 +1,84 @@
1
+ .TH tar_extract_file 3 "Jan 2001" "University of Illinois" "C Library Calls"
2
+ .SH NAME
3
+ tar_extract_file, tar_extract_regfile, tar_extract_hardlink,
4
+ tar_extract_symlink, tar_extract_chardev, tar_extract_blockdev,
5
+ tar_extract_dir, tar_extract_fifo, tar_skip_regfile, tar_set_file_perms \-
6
+ extract files from a tar archive
7
+ .SH SYNOPSIS
8
+ .B #include <libtar.h>
9
+ .P
10
+ .BI "int tar_extract_file(TAR *" t ", char *" realname ");"
11
+
12
+ .BI "int tar_extract_regfile(TAR *" t ", char *" realname ");"
13
+
14
+ .BI "int tar_skip_regfile(TAR *" t ");"
15
+
16
+ .BI "int tar_extract_dir(TAR *" t ", char *" realname ");"
17
+
18
+ .BI "int tar_extract_hardlink(TAR *" t ", char *" realname ");"
19
+
20
+ .BI "int tar_extract_symlink(TAR *" t ", char *" realname ");"
21
+
22
+ .BI "int tar_extract_blockdev(TAR *" t ", char *" realname ");"
23
+
24
+ .BI "int tar_extract_chardev(TAR *" t ", char *" realname ");"
25
+
26
+ .BI "int tar_extract_fifo(TAR *" t ", char *" realname ");"
27
+
28
+ .BI "int tar_set_file_perms(TAR *" t ", char *" realname ");"
29
+ .SH VERSION
30
+ This man page documents version 1.2 of \fBlibtar\fP.
31
+ .SH DESCRIPTION
32
+ The \fBtar_extract_file\fP() function acts as a front-end to the other
33
+ \fBtar_extract_*\fP() functions. It checks the current tar header
34
+ associated with the \fITAR\fP handle \fIt\fP (which must be initialized
35
+ first by calling \fBth_read\fP()) to determine what kind of file the
36
+ header refers to. It then calls the appropriate \fBtar_extract_*\fP()
37
+ function to extract that kind of file.
38
+
39
+ The \fBtar_skip_regfile\fP() function skips over the
40
+ file content blocks and positions the file pointer at the expected
41
+ location of the next tar header block.
42
+
43
+ The \fBtar_set_file_perms\fP() function sets the attributes of the
44
+ extracted file to match the encoded values. This includes the file's
45
+ modification time, mode, owner, and group. This function is automatically
46
+ called by \fBtar_extract_file\fP(), but applications which call the
47
+ other \fBtar_extract_*\fP() functions directly will need to call
48
+ \fBtar_set_file_perms\fP() manually if this behavior is desired.
49
+ .SH RETURN VALUES
50
+ On successful completion, the functions documented here will
51
+ return 0. On failure, they will return -1 and set \fIerrno\fP to an
52
+ appropriate value.
53
+
54
+ The \fBtar_extract_dir\fP() function will return 1 if the directory
55
+ already exists.
56
+ .SH ERRORS
57
+ The \fBtar_extract_file\fP() function will fail if:
58
+ .IP \fBEEXIST\fP
59
+ If the \fBO_NOOVERWRITE\fP flag is set and the file already exists.
60
+ .PP
61
+ The \fBtar_extract_*\fP() functions will fail if:
62
+ .IP \fBEINVAL\fP
63
+ An entry could not be added to the internal file hash.
64
+ .IP \fBEINVAL\fP
65
+ Less than \fBT_BLOCKSIZE\fP bytes were read from the tar archive.
66
+ .IP \fBEINVAL\fP
67
+ The current file header associated with \fIt\fP refers to a kind of file
68
+ other than the one which the called function knows about.
69
+ .PP
70
+ They may also fail if any of the following functions fail: \fBmkdir\fP(),
71
+ \fBwrite\fP(), \fBlink\fP(), \fBsymlink\fP(), \fBmknod\fP(), \fBmkfifo\fP(),
72
+ \fButime\fP(), \fBchown\fP(), \fBlchown\fP(), \fBchmod\fP(), or \fBlstat\fP().
73
+ .SH SEE ALSO
74
+ .BR mkdir (2),
75
+ .BR write (2),
76
+ .BR link (2),
77
+ .BR symlink (2),
78
+ .BR mknod (2),
79
+ .BR mkfifo (2),
80
+ .BR utime (2),
81
+ .BR chown (2),
82
+ .BR lchown (2),
83
+ .BR chmod (2),
84
+ .BR lstat (2)
@@ -0,0 +1,97 @@
1
+ .TH tar_open 3 "Jan 2001" "University of Illinois" "C Library Calls"
2
+ .SH NAME
3
+ tar_open, tar_close \- access a tar archive via a handle
4
+ .SH SYNOPSIS
5
+ .B #include <libtar.h>
6
+ .P
7
+ .BI "int tar_open(TAR **" t ", char *" pathname ","
8
+ .BI "tartype_t *" type ", int " oflags ","
9
+ .BI "int " mode ", int " options ");"
10
+
11
+ .BI "int tar_fdopen(TAR **" t ", int " fd ","
12
+ .BI "char *" pathname ", tartype_t *" type ","
13
+ .BI "int " oflags ", int " mode ","
14
+ .BI "int " options ");"
15
+
16
+ .BI "int tar_fd(TAR *" t");"
17
+
18
+ .BI "int tar_close(TAR *" t");"
19
+ .SH VERSION
20
+ This man page documents version 1.2 of \fBlibtar\fP.
21
+ .SH DESCRIPTION
22
+ The \fBtar_open\fP() function opens a tar archive file corresponding to
23
+ the filename named by the \fIpathname\fP argument. The \fIoflags\fP
24
+ argument must be either \fBO_RDONLY\fP or \fBO_WRONLY\fP.
25
+
26
+ The \fItype\fP argument specifies the access methods for the given file
27
+ type. The \fItartype_t\fP structure has members named \fIopenfunc\fP,
28
+ \fIclosefunc\fP, \fIreadfunc\fP() and \fIwritefunc\fP(), which are
29
+ pointers to the functions for opening, closing, reading, and writing
30
+ the file, respectively. If \fItype\fP is \fINULL\fP, the file type
31
+ defaults to a normal file, and the standard \fIopen\fP(), \fIclose\fP(),
32
+ \fIread\fP(), and \fIwrite\fP() functions are used.
33
+
34
+ The \fIoptions\fP argument is a logical-or'ed combination of zero or more
35
+ of the following:
36
+ .IP \fBTAR_GNU\fP
37
+ Use GNU extensions.
38
+ .IP \fBTAR_VERBOSE\fP
39
+ Send status messages to \fIstdout\fP.
40
+ .IP \fBTAR_NOOVERWRITE\fP
41
+ Do not overwrite pre-existing files.
42
+ .IP \fBTAR_IGNORE_EOT\fP
43
+ Skip all-zero blocks instead of treating them as EOT.
44
+ .IP \fBTAR_IGNORE_MAGIC\fP
45
+ Do not validate the magic field in file headers.
46
+ .IP \fBTAR_CHECK_VERSION\fP
47
+ Check the version field in file headers. (This field is normally ignored.)
48
+ .IP \fBTAR_IGNORE_CRC\fP
49
+ Do not validate the CRC of file headers.
50
+ .PP
51
+
52
+ The \fBtar_open\fP() function allocates memory for a \fITAR\fP handle,
53
+ and a pointer to the allocated memory is saved in the location specified
54
+ by \fIt\fP. The \fITAR\fP handle may be passed to other \fIlibtar\fP
55
+ calls to modify the opened tar archive. The \fITAR\fP handle maintains
56
+ all of the information about the open tar archive, including the archive
57
+ \fItype\fP, \fIoptions\fP, and \fIoflags\fP selected when \fBtar_open\fP()
58
+ was called.
59
+
60
+ The \fITAR\fP handle generated by \fBtar_open\fP() contains a file header
61
+ structure. When reading a tar archive, this structure contains the last
62
+ file header read from the tar archive. When writing a tar archive,
63
+ this structure is used as a staging area to construct the next file
64
+ header to be written to the archive. In addition, the \fITAR\fP handle
65
+ contains a hash table which is used to keep track of the device and
66
+ inode information for each file which gets written to the tar archive.
67
+ This is used to detect hard links, so that files do not need to be
68
+ duplicated in the archive.
69
+
70
+ The \fBtar_fdopen\fP() function is identical to the \fBtar_open\fP() function,
71
+ except that \fIfd\fP is used as the previously-opened file descriptor for
72
+ the tar file instead of calling \fItype->openfunc\fP() to open the file.
73
+
74
+ The \fBtar_fd\fP() function returns the file descriptor associated with
75
+ the \fITAR\fP handle \fIt\fP.
76
+
77
+ The \fBtar_close\fP() function closes the file descriptor associated
78
+ with the \fITAR\fP handle \fIt\fP and frees all dynamically-allocated
79
+ memory.
80
+ .SH RETURN VALUE
81
+ The \fBtar_open\fP(), \fBtar_fdopen\fP(), and \fBtar_close\fP() functions
82
+ return 0 on success. On failure, they return -1 and set \fIerrno\fP.
83
+
84
+ The \fBtar_fd\fP() function returns the file descriptor associated with
85
+ the \fITAR\fP handle \fIt\fP.
86
+ .SH ERRORS
87
+ \fBtar_open\fP() will fail if:
88
+ .IP \fBEINVAL\fP
89
+ The \fIoflags\fP argument was something other than \fBO_RDONLY\fP or \fBO_WRONLY\fP.
90
+ .PP
91
+ In addition, \fBtar_open\fP() and \fBtar_close\fP() may fail if it
92
+ cannot allocate memory using \fBcalloc\fP(), or if the
93
+ open or close functions for the specified tar archive \fItype\fP fail.
94
+ .SH SEE ALSO
95
+ .BR open (2),
96
+ .BR close (2),
97
+ .BR calloc (3)
@@ -0,0 +1,63 @@
1
+ .TH th_get_pathname 3 "Jan 2001" "University of Illinois" "C Library Calls"
2
+ .SH NAME
3
+ th_get_pathname, th_get_uid, th_get_gid, th_get_mode, th_get_crc, th_get_size, th_get_mtime, th_get_devmajor, th_get_devminor, th_get_linkname \- extract individual fields of a tar header
4
+
5
+ TH_ISREG, TH_ISLNK, TH_ISSYM, TH_ISCHR, TH_ISBLK, TH_ISDIR, TH_ISFIFO \- determine what kind of file a tar header refers to
6
+
7
+ TH_ISLONGNAME, TH_ISLONGLINK \- determine whether the GNU extensions are in use
8
+ .SH SYNOPSIS
9
+ .B #include <libtar.h>
10
+ .P
11
+ .BI "char *th_get_linkname(TAR *" t ");"
12
+
13
+ .BI "char *th_get_pathname(TAR *" t ");"
14
+
15
+ .BI "mode_t th_get_mode(TAR *" t ");"
16
+
17
+ .BI "uid_t th_get_uid(TAR *" t ");"
18
+
19
+ .BI "gid_t th_get_gid(TAR *" t ");"
20
+
21
+ .BI "int th_get_crc(TAR *" t ");"
22
+
23
+ .BI "off_t th_get_size(TAR *" t ");"
24
+
25
+ .BI "time_t th_get_mtime(TAR *" t ");"
26
+
27
+ .BI "major_t th_get_devmajor(TAR *" t ");"
28
+
29
+ .BI "minor_t th_get_devminor(TAR *" t ");"
30
+
31
+ .BI "int TH_ISREG(TAR *" t ");"
32
+
33
+ .BI "int TH_ISLNK(TAR *" t ");"
34
+
35
+ .BI "int TH_ISSYM(TAR *" t ");"
36
+
37
+ .BI "int TH_ISCHR(TAR *" t ");"
38
+
39
+ .BI "int TH_ISBLK(TAR *" t ");"
40
+
41
+ .BI "int TH_ISDIR(TAR *" t ");"
42
+
43
+ .BI "int TH_ISFIFO(TAR *" t ");"
44
+
45
+ .BI "int TH_ISLONGNAME(TAR *" t ");"
46
+
47
+ .BI "int TH_ISLONGLINK(TAR *" t ");"
48
+ .SH VERSION
49
+ This man page documents version 1.2 of \fBlibtar\fP.
50
+ .SH DESCRIPTION
51
+ The \fBth_get_*\fP() functions extract individual fields from the current
52
+ tar header associated with the \fITAR\fP handle \fIt\fP.
53
+
54
+ The \fBTH_IS*\fP() macros are used to evaluate what kind of file is
55
+ pointed to by the current tar header associated with the \fITAR\fP
56
+ handle \fIt\fP.
57
+
58
+ The \fBTH_ISLONGNAME\fP() and \fBTH_ISLONGLINK\fP() macros evaluate
59
+ whether or not the GNU extensions are used by the current tar header
60
+ associated with the \fITAR\fP handle \fIt\fP. This is only relevant
61
+ if the \fBTAR_GNU\fP option was used when \fItar_open\fP() was called.
62
+ .SH SEE ALSO
63
+ .BR tar_open (3)
@@ -0,0 +1,22 @@
1
+ .TH th_print_long_ls 3 "Jan 2001" "University of Illinois" "C Library Calls"
2
+ .SH NAME
3
+ th_print, th_print_long_ls \- print out information about a tar file header
4
+ .SH SYNOPSIS
5
+ .B #include <libtar.h>
6
+ .P
7
+ .BI "void th_print_long_ls(TAR *" t ");"
8
+
9
+ .BI "void th_print(TAR *" t ");"
10
+ .SH VERSION
11
+ This man page documents version 1.2 of \fBlibtar\fP.
12
+ .SH DESCRIPTION
13
+ The \fBth_print_long_ls\fP() function prints a line to \fIstdout\fP which
14
+ describes the file pointed to by the current file header associated with
15
+ the \fITAR\fP handle \fIt\fP. The output is similar to that of "ls -l".
16
+
17
+ The \fBth_print\fP() function prints the value of each field of the
18
+ current file header associated with the \fITAR\fP handle \fIt\fP to
19
+ \fIstdout\fP. This is mainly used for debugging purposes.
20
+ .SH SEE ALSO
21
+ .BR tar_open (3),
22
+ .BR th_read (3)
@@ -0,0 +1,34 @@
1
+ .TH th_read 3 "Jan 2001" "University of Illinois" "C Library Calls"
2
+ .SH NAME
3
+ th_read, th_write \- read and write a file header block from a tar archive
4
+ .SH SYNOPSIS
5
+ .B #include <libtar.h>
6
+ .P
7
+ .BI "int th_read(TAR *" t ");"
8
+
9
+ .BI "int th_write(TAR *" t ");"
10
+ .SH VERSION
11
+ This man page documents version 1.2 of \fBlibtar\fP.
12
+ .SH DESCRIPTION
13
+ The \fBth_read\fP() function reads the next block from the tar archive
14
+ associated with the \fITAR\fP handle \fIt\fP. It then sets the
15
+ current tar header associated with \fIt\fP to the contents of the block
16
+ read.
17
+
18
+ The \fBth_write\fP() function writes the contents of the current
19
+ tar header associated with \fIt\fP to the tar archive associated
20
+ with \fIt\fP.
21
+ .SH RETURN VALUE
22
+ On successful completion, \fBth_read\fP() and \fBth_write\fP() will
23
+ return 0. On failure, they will return -1 and set \fIerrno\fP to an
24
+ appropriate value.
25
+
26
+ On \fIEOF\fP, \fBth_read\fP() will return 1.
27
+ .SH ERRORS
28
+ \fBth_read\fP() and \fBth_write\fP() will fail if:
29
+ .IP \fBEINVAL\fP
30
+ Less than \fBT_BLOCKSIZE\fP blocks were read or written.
31
+ .PP
32
+ .SH SEE ALSO
33
+ .BR tar_block_read (3),
34
+ .BR tar_block_write (3)