summaryrefslogtreecommitdiffstats
path: root/zutils.h
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2015-11-08 04:26:51 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2015-11-08 04:26:51 +0000
commitabdd6f5dd4e9b01f68646858e3abc58325436be3 (patch)
tree7d78c505a87aed973c3154a810d57feb259b69a6 /zutils.h
parentAdding upstream version 1.0. (diff)
downloadzutils-abdd6f5dd4e9b01f68646858e3abc58325436be3.tar.xz
zutils-abdd6f5dd4e9b01f68646858e3abc58325436be3.zip
Adding upstream version 1.1~rc2.upstream/1.1_rc2
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'zutils.h')
-rw-r--r--zutils.h28
1 files changed, 17 insertions, 11 deletions
diff --git a/zutils.h b/zutils.h
index 1a2bb93..238dea8 100644
--- a/zutils.h
+++ b/zutils.h
@@ -15,9 +15,10 @@
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 program_year = "2013";
+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;
@@ -27,8 +28,6 @@ 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 char * const decompressor_names[num_formats] =
- { "bzip2", "gzip", "lzip", "xz" };
const int8_t format_order[num_formats] =
{ fmt_lz, fmt_bz2, fmt_gz, fmt_xz }; // search order
@@ -47,14 +46,20 @@ const uint8_t xz_magic[xz_magic_size] =
{ 0xFD, 0x37, 0x7A, 0x58, 0x5A }; // 0xFD, "7zXZ"
-int get_format_type( const std::string & arg );
+int parse_format_type( const std::string & arg );
int readblock( const int fd, uint8_t * const buf, const int size );
int writeblock( const int fd, const uint8_t * const buf, const int size );
bool feed_data( const int infd, const int outfd,
const uint8_t * magic_data, const int magic_size );
-bool set_data_feeder( int * const infdp, pid_t * const pidp,
- const int format_type );
+
+struct Children
+ {
+ const char * compressor_name;
+ pid_t pid[2]; // data feeder, compressor
+ };
+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 );
@@ -66,9 +71,10 @@ 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 );
-const char * test_format( const int infd,
- const uint8_t ** const magic_datap,
- int * const magic_sizep );
+// 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.
//