summaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/main.c b/main.c
index ef12c33..5c53b00 100644
--- a/main.c
+++ b/main.c
@@ -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