]> wimlib.net Git - wimlib/blob - src/pathlist.c
Makefile.am: include nasm_lt.sh in release tarball
[wimlib] / src / pathlist.c
1 /*
2  * pathlist.c
3  *
4  * Utility function for reading path list files.
5  */
6
7 /*
8  * Copyright (C) 2013 Eric Biggers
9  *
10  * This file is free software; you can redistribute it and/or modify it under
11  * the terms of the GNU Lesser General Public License as published by the Free
12  * Software Foundation; either version 3 of the License, or (at your option) any
13  * later version.
14  *
15  * This file is distributed in the hope that it will be useful, but WITHOUT
16  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
18  * details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * along with this file; if not, see http://www.gnu.org/licenses/.
22  */
23
24 #ifdef HAVE_CONFIG_H
25 #  include "config.h"
26 #endif
27
28 #include "wimlib/pathlist.h"
29 #include "wimlib/textfile.h"
30
31 int
32 read_path_list_file(const tchar *listfile,
33                     tchar ***paths_ret, size_t *num_paths_ret,
34                     void **mem_ret)
35 {
36         STRING_LIST(paths);
37         struct text_file_section tmp = {
38                 .name = T(""),
39                 .strings = &paths,
40         };
41         void *buf;
42         int ret;
43
44         ret = load_text_file(listfile, &buf, &tmp, 1, NULL);
45         if (ret)
46                 return ret;
47
48         *paths_ret = paths.strings;
49         *num_paths_ret = paths.num_strings;
50         *mem_ret = buf;
51         return 0;
52 }