summaryrefslogtreecommitdiffstats
path: root/tarlz.h
diff options
context:
space:
mode:
Diffstat (limited to 'tarlz.h')
-rw-r--r--tarlz.h29
1 files changed, 22 insertions, 7 deletions
diff --git a/tarlz.h b/tarlz.h
index 10a2dd5..196ecb1 100644
--- a/tarlz.h
+++ b/tarlz.h
@@ -70,15 +70,17 @@ inline bool dotdot_at_i( const char * const filename, const int i )
}
-enum { initial_line_length = 1000 }; // must be >= 87 for format_member_name
-
class Resizable_buffer
{
char * p;
unsigned long size_; // size_ < LONG_MAX
public:
- explicit Resizable_buffer( const unsigned long initial_size )
+ // must be >= 87 for format_member_name
+ enum { default_initial_size = 2 * header_size };
+
+ explicit Resizable_buffer( const unsigned long initial_size =
+ default_initial_size )
: p( (char *)std::malloc( initial_size ) ), size_( p ? initial_size : 0 ) {}
~Resizable_buffer() { if( p ) std::free( p ); p = 0; size_ = 0; }
@@ -136,6 +138,7 @@ public:
const std::string & linkpath() const { return linkpath_; }
const std::string & path() const { return path_; }
unsigned long long file_size() const { return file_size_; }
+ unsigned long long get_file_size_and_reset( const Tar_header header );
void linkpath( const char * const lp ) { linkpath_ = lp; full_size_ = -1; }
void path( const char * const p ) { path_ = p; full_size_ = -1; }
@@ -311,6 +314,7 @@ extern int cl_data_size;
extern Solidity solidity;
bool writeblock_wrapper( const int outfd, const uint8_t * const buffer,
const int size );
+bool write_eof_records( const int outfd, const bool compressed );
const char * remove_leading_dotslash( const char * const filename,
const bool dotdot = false );
bool fill_headers( const char * const filename, Extended & extended,
@@ -323,23 +327,32 @@ void set_error_status( const int retval );
int final_exit_status( int retval, const bool show_msg = true );
unsigned ustar_chksum( const uint8_t * const header );
bool verify_ustar_chksum( const uint8_t * const header );
+bool has_lz_ext( const std::string & name );
class Arg_parser;
-int concatenate( const std::string & archive_name, const Arg_parser & parser,
+int concatenate( std::string archive_name, const Arg_parser & parser,
const int filenames );
int encode( const std::string & archive_name, const Arg_parser & parser,
const int filenames, const int level, const int num_workers,
- const int debug_level, const bool append );
+ const int out_slots, const int debug_level, const bool append,
+ const bool dereference );
// defined in create_lz.cc
int encode_lz( const Arg_parser & parser, const int dictionary_size,
const int match_len_limit, const int num_workers,
- const int outfd, const int debug_level );
+ const int outfd, const int out_slots, const int debug_level,
+ const bool dereference );
+
+// defined in exclude.cc
+namespace Exclude {
+void add_pattern( const std::string & arg );
+bool excluded( const char * const filename );
+} // end namespace Exclude
// defined in extract.cc
enum Program_mode { m_none, m_append, m_concatenate, m_create, m_diff,
m_extract, m_list };
bool block_is_zero( const uint8_t * const buf, const int size );
-void format_member_name( const Extended & extended, const Tar_header header,
+bool format_member_name( const Extended & extended, const Tar_header header,
Resizable_buffer & rbuf, const bool long_format );
bool compare_prefix_dir( const char * const dir, const char * const name );
bool compare_tslash( const char * const name1, const char * const name2 );
@@ -377,6 +390,8 @@ int seek_read( const int fd, uint8_t * const buf, const int size,
// defined in main.cc
extern int verbosity;
+struct stat;
+int hstat( const char * const filename, struct stat * const st );
int open_instream( const std::string & name );
int open_outstream( const std::string & name, const bool create = true );
void cleanup_and_fail( const int retval = 1 ); // terminate the program