From 5b99194c58385215cad973281a6f162d187ab971 Mon Sep 17 00:00:00 2001 From: Pixel Date: Tue, 17 Feb 2009 02:03:49 +0100 Subject: Adding mpqlib_fs_filelist --- mpq-fs.c | 20 ++++++++++++++++++++ mpq-fs.h | 2 ++ 2 files changed, 22 insertions(+) diff --git a/mpq-fs.c b/mpq-fs.c index f797e74..68da3b8 100644 --- a/mpq-fs.c +++ b/mpq-fs.c @@ -128,6 +128,26 @@ struct mpq_file_t * mpqlib_fs_open(const char * _fname) { return NULL; } +int mpqlib_fs_filelist(char * buffer) { + int r_size = 0, l; + char * p = buffer; + + if (!hash_table) + return 0; + + if (hfirst(hash_table)) do { + l = strlen(hkey(hash_table)); + r_size += l + 1; + if (p) { + strcpy(p, hkey(hash_table)); + p += l; + *(p++) = '\n'; + } + } while (hnext(hash_table)); + + return r_size; +} + #define FALSE 0 #define TRUE !FALSE diff --git a/mpq-fs.h b/mpq-fs.h index 69e70f3..6ad9483 100644 --- a/mpq-fs.h +++ b/mpq-fs.h @@ -13,6 +13,8 @@ void mpqlib_fs_attach_listfile(struct mpq_archive_t *, const char *); struct mpq_file_t * mpqlib_fs_open(const char *); +int mpqlib_fs_filelist(char * buffer); + void mpqlib_fs_shutdown(); #ifdef __cplusplus -- cgit v1.2.3