VirtualBox

source: vbox/trunk/include/iprt/tar.h@ 29567

Last change on this file since 29567 was 28800, checked in by vboxsync, 15 years ago

Automated rebranding to Oracle copyright/license strings via filemuncher

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.3 KB
Line 
1/** @file
2 * IPRT - Tar archive I/O.
3 */
4
5/*
6 * Copyright (C) 2009 Oracle Corporation
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * The contents of this file may alternatively be used under the terms
17 * of the Common Development and Distribution License Version 1.0
18 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19 * VirtualBox OSE distribution, in which case the provisions of the
20 * CDDL are applicable instead of those of the GPL.
21 *
22 * You may elect to license modified versions of this file under the
23 * terms and conditions of either the GPL or the CDDL or both.
24 */
25
26#ifndef ___iprt_tar_h
27#define ___iprt_tar_h
28
29#include <iprt/cdefs.h>
30#include <iprt/types.h>
31
32RT_C_DECLS_BEGIN
33
34/** @defgroup grp_rt_tar RTTar - Tar archive I/O
35 * @ingroup grp_rt
36 * @{
37 */
38
39/**
40 * Check if the specified file exists in the Tar archive.
41 *
42 * (The matching is case sensitive.)
43 *
44 * @note Currently only regular files are supported.
45 *
46 * @returns iprt status code.
47 * @retval VINF_SUCCESS when the file exists in the Tar archive.
48 * @retval VERR_FILE_NOT_FOUND when the file not exists in the Tar archive.
49 *
50 * @param pszTarFile Tar file to check.
51 * @param pszFile Filename to check for.
52 */
53RTR3DECL(int) RTTarQueryFileExists(const char *pszTarFile, const char *pszFile);
54
55/**
56 * Create a file list from a Tar archive.
57 *
58 * @note Currently only regular files are supported.
59 *
60 * @returns iprt status code.
61 *
62 * @param pszTarFile Tar file to list files from.
63 * @param ppapszFiles On success an array with array with the filenames is
64 * returned. The names must be freed with RTStrFree and
65 * the array with RTMemFree.
66 * @param pcFiles On success the number of entries in ppapszFiles.
67 */
68RTR3DECL(int) RTTarList(const char *pszTarFile, char ***ppapszFiles, size_t *pcFiles);
69
70/**
71 * Extract a set of files from a Tar archive.
72 *
73 * Also note that this function is atomic. If an error occurs all previously
74 * extracted files will be deleted.
75 *
76 * (The matching is case sensitive.)
77 *
78 * @note Currently only regular files are supported. Also some of the heade
79 * fields are not used (uid, gid, uname, gname, mtime).
80 *
81 * @returns iprt status code.
82 *
83 * @param pszTarFile Tar file to extract files from.
84 * @param pszOutputDir Where to store the extracted files. Must exist.
85 * @param papszFiles Which files should be extracted.
86 * @param cFiles The number of files in papszFiles.
87 */
88RTR3DECL(int) RTTarExtractFiles(const char *pszTarFile, const char *pszOutputDir, const char * const *papszFiles, size_t cFiles);
89
90/**
91 * Extract a file by index from a Tar archive.
92 *
93 * @note Currently only regular files are supported. Also some of the header
94 * fields are not used (uid, gid, uname, gname, mtime).
95 *
96 * @returns iprt status code.
97 * @retval VERR_FILE_NOT_FOUND when the index isn't valid.
98 *
99 * @param pszTarFile Tar file to extract the file from.
100 * @param pszOutputDir Where to store the extracted file. Must exist.
101 * @param iIndex Which file should be extracted, 0 based.
102 * @param ppszFileName On success the filename of the extracted file. Must
103 * be freed with RTStrFree.
104 */
105RTR3DECL(int) RTTarExtractByIndex(const char *pszTarFile, const char *pszOutputDir, size_t iIndex, char **ppszFileName);
106
107/**
108 * Create a Tar archive out of the given files.
109 *
110 * @note Currently only regular files are supported.
111 *
112 * @returns iprt status code.
113 *
114 * @param pszTarFile Where to create the Tar archive.
115 * @param papszFiles Which files should be included.
116 * @param cFiles The number of files in papszFiles.
117 */
118RTR3DECL(int) RTTarCreate(const char *pszTarFile, const char * const *papszFiles, size_t cFiles);
119
120/** @} */
121
122RT_C_DECLS_END
123
124#endif /* ___iprt_tar_h */
125
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette