diff options
author | Daniel Baumann <mail@daniel-baumann.ch> | 2015-11-07 14:03:12 +0000 |
---|---|---|
committer | Daniel Baumann <mail@daniel-baumann.ch> | 2015-11-07 14:03:12 +0000 |
commit | 2dc71271a57a0f0117700eca8b21276f25317da7 (patch) | |
tree | 8ec78a91aa8ef7939014e4f53e297b9b14c3cba4 /main.c | |
parent | Adding upstream version 1.6~pre2. (diff) | |
download | lzlib-2dc71271a57a0f0117700eca8b21276f25317da7.tar.xz lzlib-2dc71271a57a0f0117700eca8b21276f25317da7.zip |
Adding upstream version 1.6~pre3.upstream/1.6_pre3
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 18 |
1 files changed, 8 insertions, 10 deletions
@@ -35,7 +35,7 @@ #include <unistd.h> #include <utime.h> #include <sys/stat.h> -#if defined(__MSVCRT__) +#if defined(__MSVCRT__) || defined(_MSC_VER) #include <io.h> #define fchmod(x,y) 0 #define fchown(x,y,z) 0 @@ -202,9 +202,9 @@ static void show_help( void ) static void show_version( void ) { - printf( "%s %s\n", Program_name, PROGVERSION ); + printf( "%s %s\n", program_name, PROGVERSION ); printf( "Copyright (C) %s Antonio Diaz Diaz.\n", program_year ); - printf( "Using Lzlib %s\n", LZ_version() ); + printf( "Using lzlib %s\n", LZ_version() ); printf( "License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n" ); @@ -322,8 +322,7 @@ static int open_instream( const char * const name, struct stat * const in_statsp } else { - do infd = open( name, O_RDONLY | O_BINARY ); - while( infd < 0 && errno == EINTR ); + infd = open( name, O_RDONLY | O_BINARY ); if( infd < 0 ) { if( verbosity >= 0 ) @@ -407,8 +406,7 @@ static bool open_outstream( const bool force ) int flags = O_CREAT | O_WRONLY | O_BINARY; if( force ) flags |= O_TRUNC; else flags |= O_EXCL; - do outfd = open( output_filename, flags, outfd_mode ); - while( outfd < 0 && errno == EINTR ); + outfd = open( output_filename, flags, outfd_mode ); if( outfd < 0 && verbosity >= 0 ) { if( errno == EEXIST ) @@ -497,7 +495,7 @@ static int readblock( const int fd, uint8_t * const buf, const int size ) const int n = read( fd, buf + size - rest, rest ); if( n > 0 ) rest -= n; else if( n == 0 ) break; /* EOF */ - else if( errno != EINTR && errno != EAGAIN ) break; + else if( errno != EINTR ) break; errno = 0; } return size - rest; @@ -515,7 +513,7 @@ static int writeblock( const int fd, const uint8_t * const buf, const int size ) { const int n = write( fd, buf + size - rest, rest ); if( n > 0 ) rest -= n; - else if( n < 0 && errno != EINTR && errno != EAGAIN ) break; + else if( n < 0 && errno != EINTR ) break; errno = 0; } return size - rest; @@ -931,7 +929,7 @@ int main( const int argc, const char * const argv[] ) } } /* end process options */ -#if defined(__MSVCRT__) || defined(__OS2__) +#if defined(__MSVCRT__) || defined(__OS2__) || defined(_MSC_VER) setmode( STDIN_FILENO, O_BINARY ); setmode( STDOUT_FILENO, O_BINARY ); #endif |