Merging upstream version 1.2~pre3.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
388270afb8
commit
57a593e0b1
32 changed files with 1172 additions and 1035 deletions
52
zutils.h
52
zutils.h
|
@ -15,37 +15,6 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
const char * const Program_name = "Zutils";
|
||||
const char * const program_name = "zutils";
|
||||
const char * const config_file_name = "zutilsrc";
|
||||
const char * const program_year = "2013";
|
||||
extern const char * invocation_name;
|
||||
extern const char * util_name;
|
||||
|
||||
extern int verbosity;
|
||||
|
||||
enum { fmt_bz2, fmt_gz, fmt_lz, fmt_xz, num_formats };
|
||||
const char * const format_names[num_formats] = { "bz2", "gz", "lz", "xz" };
|
||||
const char * const simple_extensions[num_formats] =
|
||||
{ ".bz2", ".gz", ".lz", ".xz" };
|
||||
const int8_t format_order[num_formats] =
|
||||
{ fmt_lz, fmt_bz2, fmt_gz, fmt_xz }; // search order
|
||||
|
||||
// first magic byte must be different among formats
|
||||
enum { bzip2_magic_size = 3,
|
||||
gzip_magic_size = 2,
|
||||
lzip_magic_size = 4,
|
||||
xz_magic_size = 5 };
|
||||
const uint8_t bzip2_magic[bzip2_magic_size] =
|
||||
{ 0x42, 0x5A, 0x68 }; // "BZh"
|
||||
const uint8_t gzip_magic[gzip_magic_size] =
|
||||
{ 0x1F, 0x8B };
|
||||
const uint8_t lzip_magic[lzip_magic_size] =
|
||||
{ 0x4C, 0x5A, 0x49, 0x50 }; // "LZIP"
|
||||
const uint8_t xz_magic[xz_magic_size] =
|
||||
{ 0xFD, 0x37, 0x7A, 0x58, 0x5A }; // 0xFD, "7zXZ"
|
||||
|
||||
|
||||
int parse_format_type( const std::string & arg );
|
||||
|
||||
int readblock( const int fd, uint8_t * const buf, const int size );
|
||||
|
@ -61,28 +30,7 @@ struct Children
|
|||
bool good_status( const Children & children, const bool finished );
|
||||
bool set_data_feeder( int * const infdp, Children & children, int format_index );
|
||||
|
||||
void show_help_addr();
|
||||
void show_version( const char * const Util_name = 0 );
|
||||
void show_error( const char * const msg, const int errcode = 0,
|
||||
const bool help = false );
|
||||
void show_error2( const char * const msg, const char * const name );
|
||||
void show_close_error( const char * const prog_name );
|
||||
void show_exec_error( const char * const prog_name );
|
||||
void show_fork_error( const char * const prog_name );
|
||||
void internal_error( const char * const msg );
|
||||
|
||||
// Returns format index or -1 if uncompressed
|
||||
//
|
||||
int test_format( const int infd, const uint8_t ** const magic_datap,
|
||||
int * const magic_sizep );
|
||||
|
||||
// Returns exit status of child process 'pid', or 'eretval' in case of error.
|
||||
//
|
||||
int wait_for_child( const pid_t pid, const char * const name,
|
||||
const int eretval = 2, const bool isgzxz = false );
|
||||
|
||||
// Returns -1 if child not terminated, 'eretval' in case of error, or
|
||||
// exit status of child process 'pid'.
|
||||
//
|
||||
int child_status( const pid_t pid, const char * const name,
|
||||
const int eretval = 2 );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue