Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unistd.h and make it configure script independent #1022

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add unistd.h and make it configure script independent
arnabanimesh authored Nov 17, 2024
commit f8dfb1eddb257ca659bdd3df087597d88a39a6dc
6 changes: 6 additions & 0 deletions contrib/iostream/zfstream.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@


#if defined( unix ) || defined( __unix ) || defined( __unix__ ) || \
(defined( __APPLE__ ) && defined( __MACH__ )) || \
HAVE_UNISTD_H
#include <unistd.h> /* lseek, read, write, close, chown, unlink, sleep, ftruncate, fsync */
#endif
#include "zfstream.h"

gzfilebuf::gzfilebuf() :
6 changes: 6 additions & 0 deletions contrib/iostream/zfstream.h
Original file line number Diff line number Diff line change
@@ -2,6 +2,12 @@
#ifndef zfstream_h
#define zfstream_h


#if defined( unix ) || defined( __unix ) || defined( __unix__ ) || \
(defined( __APPLE__ ) && defined( __MACH__ )) || \
HAVE_UNISTD_H
#include <unistd.h> /* lseek, read, write, close, chown, unlink, sleep, ftruncate, fsync */
#endif
#include <fstream.h>
#include "zlib.h"

5 changes: 5 additions & 0 deletions contrib/iostream2/zstream.h
Original file line number Diff line number Diff line change
@@ -24,6 +24,11 @@
* $Id: zstream.h 1.1 1997-06-25 12:00:56+02 tyge Exp tyge $
*/

#if defined( unix ) || defined( __unix ) || defined( __unix__ ) || \
(defined( __APPLE__ ) && defined( __MACH__ )) || \
HAVE_UNISTD_H
#include <unistd.h> /* lseek, read, write, close, chown, unlink, sleep, ftruncate, fsync */
#endif
#include <strstream.h>
#include <string.h>
#include <stdio.h>
6 changes: 6 additions & 0 deletions contrib/iostream3/zfstream.h
Original file line number Diff line number Diff line change
@@ -10,6 +10,12 @@
#ifndef ZFSTREAM_H
#define ZFSTREAM_H


#if defined( unix ) || defined( __unix ) || defined( __unix__ ) || \
(defined( __APPLE__ ) && defined( __MACH__ )) || \
HAVE_UNISTD_H
#include <unistd.h> /* lseek, read, write, close, chown, unlink, sleep, ftruncate, fsync */
#endif
#include <istream> // not iostream, since we don't need cin/cout
#include <ostream>
#include "zlib.h"
6 changes: 5 additions & 1 deletion examples/gun.c
Original file line number Diff line number Diff line change
@@ -62,7 +62,11 @@
#include <string.h> /* strerror(), strcmp(), strlen(), memcpy() */
#include <errno.h> /* errno */
#include <fcntl.h> /* open() */
#include <unistd.h> /* read(), write(), close(), chown(), unlink() */
#if defined( unix ) || defined( __unix ) || defined( __unix__ ) || \
(defined( __APPLE__ ) && defined( __MACH__ )) || \
HAVE_UNISTD_H
#include <unistd.h> /* lseek, read, write, close, chown, unlink, sleep, ftruncate, fsync */
#endif
#include <sys/types.h>
#include <sys/stat.h> /* stat(), chmod() */
#include <utime.h> /* utime() */
6 changes: 5 additions & 1 deletion examples/gzappend.c
Original file line number Diff line number Diff line change
@@ -81,7 +81,11 @@
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#if defined( unix ) || defined( __unix ) || defined( __unix__ ) || \
(defined( __APPLE__ ) && defined( __MACH__ )) || \
HAVE_UNISTD_H
#include <unistd.h> /* lseek, read, write, close, chown, unlink, sleep, ftruncate, fsync */
#endif
#include "zlib.h"

#define local static
6 changes: 5 additions & 1 deletion examples/gzjoin.c
Original file line number Diff line number Diff line change
@@ -56,7 +56,11 @@
#include <stdio.h> /* fputs(), fprintf(), fwrite(), putc() */
#include <stdlib.h> /* exit(), malloc(), free() */
#include <fcntl.h> /* open() */
#include <unistd.h> /* close(), read(), lseek() */
#if defined( unix ) || defined( __unix ) || defined( __unix__ ) || \
(defined( __APPLE__ ) && defined( __MACH__ )) || \
HAVE_UNISTD_H
#include <unistd.h> /* lseek, read, write, close, chown, unlink, sleep, ftruncate, fsync */
#endif
#include "zlib.h"
/* crc32(), crc32_combine(), inflateInit2(), inflate(), inflateEnd() */

7 changes: 5 additions & 2 deletions examples/gzlog.c
Original file line number Diff line number Diff line change
@@ -228,8 +228,11 @@
#include <stdlib.h> /* malloc, free */
#include <string.h> /* strlen, strrchr, strcpy, strncpy, strcmp */
#include <fcntl.h> /* open */
#include <unistd.h> /* lseek, read, write, close, unlink, sleep, */
/* ftruncate, fsync */
#if defined( unix ) || defined( __unix ) || defined( __unix__ ) || \
(defined( __APPLE__ ) && defined( __MACH__ )) || \
HAVE_UNISTD_H
#include <unistd.h> /* lseek, read, write, close, chown, unlink, sleep, ftruncate, fsync */
#endif
#include <errno.h> /* errno */
#include <time.h> /* time, ctime */
#include <sys/stat.h> /* stat */
6 changes: 6 additions & 0 deletions gzread.c
Original file line number Diff line number Diff line change
@@ -3,6 +3,12 @@
* For conditions of distribution and use, see copyright notice in zlib.h
*/


#if defined( unix ) || defined( __unix ) || defined( __unix__ ) || \
(defined( __APPLE__ ) && defined( __MACH__ )) || \
HAVE_UNISTD_H
#include <unistd.h> /* lseek, read, write, close, chown, unlink, sleep, ftruncate, fsync */
#endif
#include "gzguts.h"

/* Use read() to load a buffer -- return -1 on error, otherwise 0. Read from
5 changes: 5 additions & 0 deletions gzwrite.c
Original file line number Diff line number Diff line change
@@ -3,6 +3,11 @@
* For conditions of distribution and use, see copyright notice in zlib.h
*/

#if defined( unix ) || defined( __unix ) || defined( __unix__ ) || \
(defined( __APPLE__ ) && defined( __MACH__ )) || \
HAVE_UNISTD_H
#include <unistd.h> /* lseek, read, write, close, chown, unlink, sleep, ftruncate, fsync */
#endif
#include "gzguts.h"

/* Initialize state for writing a gzip file. Mark initialization by setting
7 changes: 5 additions & 2 deletions test/minigzip.c
Original file line number Diff line number Diff line change
@@ -173,8 +173,11 @@ static char *string_copy(char *dst, char const *src, z_size_t len) {
#ifdef Z_SOLO
/* for Z_SOLO, create simplified gz* functions using deflate and inflate */

#if defined(Z_HAVE_UNISTD_H) || defined(Z_LARGE)
# include <unistd.h> /* for unlink() */

#if defined( unix ) || defined( __unix ) || defined( __unix__ ) || \
(defined( __APPLE__ ) && defined( __MACH__ )) || \
HAVE_UNISTD_H
#include <unistd.h> /* lseek, read, write, close, chown, unlink, sleep, ftruncate, fsync */
#endif

static void *myalloc(void *q, unsigned n, unsigned m) {