summaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 14:00:28 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 14:00:28 +0000
commit01c49d142d098985fd0951397e6dfe032b19e265 (patch)
treeea1574894741dd5fa797703f3bcc4580ba530063 /main.c
parentAdding upstream version 1.5. (diff)
downloadlzlib-01c49d142d098985fd0951397e6dfe032b19e265.tar.xz
lzlib-01c49d142d098985fd0951397e6dfe032b19e265.zip
Adding upstream version 1.6~pre1.upstream/1.6_pre1
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'main.c')
-rw-r--r--main.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/main.c b/main.c
index db94774..4435c01 100644
--- a/main.c
+++ b/main.c
@@ -54,6 +54,10 @@
#include "carg_parser.h"
#include "lzlib.h"
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
#if CHAR_BIT != 8
#error "Environments where CHAR_BIT != 8 are not supported."
#endif
@@ -75,12 +79,6 @@ const char * const program_name = "minilzip";
const char * const program_year = "2013";
const char * invocation_name = 0;
-#ifdef O_BINARY
-const int o_binary = O_BINARY;
-#else
-const int o_binary = 0;
-#endif
-
struct { const char * from; const char * to; } const known_extensions[] = {
{ ".lz", "" },
{ ".tlz", ".tar" },
@@ -306,7 +304,7 @@ static int open_instream( const char * const name, struct stat * const in_statsp
}
else
{
- infd = open( name, O_RDONLY | o_binary );
+ infd = open( name, O_RDONLY | O_BINARY );
if( infd < 0 )
{
if( verbosity >= 0 )
@@ -387,7 +385,7 @@ static void set_d_outname( const char * const name, const int i )
static bool open_outstream( const bool force )
{
- int flags = O_CREAT | O_WRONLY | o_binary;
+ int flags = O_CREAT | O_WRONLY | O_BINARY;
if( force ) flags |= O_TRUNC; else flags |= O_EXCL;
outfd = open( output_filename, flags, outfd_mode );