2000-01-13 07:09:20 +00:00
|
|
|
/* file_wrappers.h
|
1999-09-22 01:28:04 +00:00
|
|
|
*
|
2004-07-18 00:24:25 +00:00
|
|
|
* $Id$
|
1999-09-22 01:28:04 +00:00
|
|
|
*
|
|
|
|
* Wiretap Library
|
2001-11-13 23:55:44 +00:00
|
|
|
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
|
2002-08-28 20:30:45 +00:00
|
|
|
*
|
1999-09-22 01:28:04 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2002-08-28 20:30:45 +00:00
|
|
|
*
|
1999-09-22 01:28:04 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2002-08-28 20:30:45 +00:00
|
|
|
*
|
1999-09-22 01:28:04 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __FILE_H__
|
|
|
|
#define __FILE_H__
|
|
|
|
|
2006-11-05 22:46:44 +00:00
|
|
|
extern gint64 file_seek(void *stream, gint64 offset, int whence, int *err);
|
|
|
|
extern gint64 file_tell(void *stream);
|
|
|
|
extern int file_error(void *fh);
|
|
|
|
|
1999-09-22 01:28:04 +00:00
|
|
|
#ifdef HAVE_LIBZ
|
2002-03-04 00:25:35 +00:00
|
|
|
|
2005-11-07 02:45:19 +00:00
|
|
|
extern FILE_T file_open(const char *path, const char *mode);
|
1999-09-22 01:28:04 +00:00
|
|
|
#define filed_open gzdopen
|
2011-04-06 06:51:19 +00:00
|
|
|
#define file_read(buf, count, file) gzread((file),(buf),(unsigned)(count))
|
1999-09-22 01:28:04 +00:00
|
|
|
#define file_close gzclose
|
2002-02-06 09:58:30 +00:00
|
|
|
#define file_getc gzgetc
|
|
|
|
#define file_gets(buf, len, file) gzgets((file), (buf), (len))
|
2002-03-04 00:25:35 +00:00
|
|
|
#define file_eof gzeof
|
1999-09-22 01:28:04 +00:00
|
|
|
|
|
|
|
#else /* No zLib */
|
2007-01-12 03:05:28 +00:00
|
|
|
|
2008-09-15 21:50:50 +00:00
|
|
|
#define file_open(path, mode) ws_fopen(path, mode)
|
1999-09-22 01:28:04 +00:00
|
|
|
#define filed_open fdopen
|
2011-04-06 06:51:19 +00:00
|
|
|
#define file_read(buf, count, file) fread((buf), (1), (count), (file))
|
1999-09-22 01:28:04 +00:00
|
|
|
#define file_close fclose
|
1999-09-22 07:37:46 +00:00
|
|
|
#define file_getc fgetc
|
1999-10-31 17:46:11 +00:00
|
|
|
#define file_gets fgets
|
2002-03-04 00:25:35 +00:00
|
|
|
#define file_eof feof
|
|
|
|
|
1999-09-22 01:28:04 +00:00
|
|
|
#endif /* HAVE_LIBZ */
|
|
|
|
|
|
|
|
#endif /* __FILE_H__ */
|