diff options
author | Louis P. Santillan <lpsantil@gmail.com> | 2015-05-26 04:41:45 (GMT) |
---|---|---|
committer | Louis P. Santillan <lpsantil@gmail.com> | 2015-05-26 04:41:45 (GMT) |
commit | b2bbb2790d50f09b594f6588ebdade62966b5d5c (patch) | |
tree | aa6d98a147d5c7366fe7b5b53e6ef142b0a633c8 /programs | |
parent | 7d182b816ace89d6d6d16b7aee376a9962a05caa (diff) | |
download | lz4-b2bbb2790d50f09b594f6588ebdade62966b5d5c.zip lz4-b2bbb2790d50f09b594f6588ebdade62966b5d5c.tar.gz lz4-b2bbb2790d50f09b594f6588ebdade62966b5d5c.tar.bz2 |
Fixup programs/{Makefile,lz4cli.c,lz4io.c} to build with Andrew Wu's build-djgpp cross compilers. Add some documentation in README.DJ
Diffstat (limited to 'programs')
-rw-r--r-- | programs/Makefile | 2 | ||||
-rw-r--r-- | programs/lz4cli.c | 5 | ||||
-rw-r--r-- | programs/lz4io.c | 15 |
3 files changed, 16 insertions, 6 deletions
diff --git a/programs/Makefile b/programs/Makefile index 39335db..5e818e4 100644 --- a/programs/Makefile +++ b/programs/Makefile @@ -39,7 +39,7 @@ RELEASE?= r129 DESTDIR?= PREFIX ?= /usr/local CFLAGS ?= -O3 -CFLAGS += -std=c99 -Wall -Wextra -Wundef -Wshadow -Wcast-qual -Wcast-align -Wstrict-prototypes -pedantic -DLZ4_VERSION=\"$(RELEASE)\" +CFLAGS += -std=gnu99 -Wall -Wextra -Wundef -Wshadow -Wcast-qual -Wcast-align -Wstrict-prototypes -pedantic -DLZ4_VERSION=\"$(RELEASE)\" FLAGS := -I../lib $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) BINDIR := $(PREFIX)/bin diff --git a/programs/lz4cli.c b/programs/lz4cli.c index 970856d..fc5a34a 100644 --- a/programs/lz4cli.c +++ b/programs/lz4cli.c @@ -67,6 +67,11 @@ *****************************/ #if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(_WIN32) # include <io.h> /* _isatty */ +# if defined(__DJGPP__) +# include <unistd.h> +# define _isatty isatty +# define _fileno fileno +# endif # ifdef __MINGW32__ int _fileno(FILE *stream); /* MINGW somehow forgets to include this prototype into <stdio.h> */ # endif diff --git a/programs/lz4io.c b/programs/lz4io.c index 209f5ed..10f3020 100644 --- a/programs/lz4io.c +++ b/programs/lz4io.c @@ -64,11 +64,16 @@ #if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(_WIN32) # include <fcntl.h> /* _O_BINARY */ # include <io.h> /* _setmode, _fileno, _get_osfhandle */ -# define SET_BINARY_MODE(file) _setmode(_fileno(file), _O_BINARY) -# include <Windows.h> /* DeviceIoControl, HANDLE, FSCTL_SET_SPARSE */ -# define SET_SPARSE_FILE_MODE(file) { DWORD dw; DeviceIoControl((HANDLE) _get_osfhandle(_fileno(file)), FSCTL_SET_SPARSE, 0, 0, 0, 0, &dw, 0); } -# if defined(_MSC_VER) && (_MSC_VER >= 1400) /* Avoid MSVC fseek()'s 2GiB barrier */ -# define fseek _fseeki64 +# if !defined(__DJGPP__) +# define SET_BINARY_MODE(file) _setmode(_fileno(file), _O_BINARY) +# include <Windows.h> /* DeviceIoControl, HANDLE, FSCTL_SET_SPARSE */ +# define SET_SPARSE_FILE_MODE(file) { DWORD dw; DeviceIoControl((HANDLE) _get_osfhandle(_fileno(file)), FSCTL_SET_SPARSE, 0, 0, 0, 0, &dw, 0); } +# if defined(_MSC_VER) && (_MSC_VER >= 1400) /* Avoid MSVC fseek()'s 2GiB barrier */ +# define fseek _fseeki64 +# endif +# else +# define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY) +# define SET_SPARSE_FILE_MODE(file) # endif #else # define SET_BINARY_MODE(file) |