Initial Patch of Auction House bot rev. 135
[auctionmangos.git] / contrib / extractor / libmpq / common.h
blob5794c162e103b786d8709c2b34e3e80eeb90e9f9
1 /*
2 * common.h -- defines and structs used by the config files.
4 * Copyright (C) 2003 Maik Broemme <mbroemme@plusserver.de>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 * $Id: common.h,v 1.4 2004/02/12 00:41:55 mbroemme Exp $
23 #define LIBMPQ_CONF_FL_INCREMENT 512 /* i hope we did not need more :) */
24 #define LIBMPQ_CONF_EXT ".conf" /* listdb file seems to be valid with this extension */
25 #define LIBMPQ_CONF_HEADER "LIBMPQ_VERSION" /* listdb file must include this entry to be valid */
26 #define LIBMPQ_CONF_BUFSIZE 4096 /* maximum number of bytes a line in the file could contain */
28 #define LIBMPQ_CONF_TYPE_CHAR 1 /* value in config file is from type char */
29 #define LIBMPQ_CONF_TYPE_INT 2 /* value in config file is from type int */
31 #define LIBMPQ_CONF_EOPEN_DIR -1 /* error on open directory */
32 #define LIBMPQ_CONF_EVALUE_NOT_FOUND -2 /* value for the option was not found */
34 #if defined( __GNUC__ )
35 #include <sys/types.h>
36 #include <unistd.h>
38 #define _lseek lseek
39 #define _read read
40 #define _open open
41 #define _write write
42 #define _close close
43 #define _strdup strdup
45 #ifndef O_BINARY
46 #define O_BINARY 0
47 #endif
48 #else
49 #include <io.h>
50 #endif
52 #ifdef O_LARGEFILE
53 #define MPQ_FILE_OPEN_FLAGS (O_RDONLY | O_BINARY | O_LARGEFILE)
54 #else
55 #define MPQ_FILE_OPEN_FLAGS (O_RDONLY | O_BINARY)
56 #endif
58 #ifndef min
59 #define min(a, b) ((a < b) ? a : b)
60 #endif
62 int libmpq_init_buffer(mpq_archive *mpq_a);
63 int libmpq_read_hashtable(mpq_archive *mpq_a);
64 int libmpq_read_blocktable(mpq_archive *mpq_a);
65 int libmpq_file_read_file(mpq_archive *mpq_a, mpq_file *mpq_f, unsigned int filepos, char *buffer, unsigned int toread);
66 int libmpq_read_listfile(mpq_archive *mpq_a, FILE *fp);
68 int libmpq_conf_get_value(FILE *fp, char *search_value, void *return_value, int type, int size);
69 char *libmpq_conf_delete_char(char *buf, char *chars);
70 int libmpq_conf_get_array(FILE *fp, char *search_value, char ***filelist, int *entries);
71 int libmpq_free_listfile(char **filelist);
72 int libmpq_read_listfile(mpq_archive *mpq_a, FILE *fp);