-
Notifications
You must be signed in to change notification settings - Fork 21
/
pathlist.c
54 lines (48 loc) · 1.35 KB
/
pathlist.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
* pathlist.c
*
* Utility function for reading path list files.
*/
/*
* Copyright (C) 2013 Eric Biggers
*
* This file is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 3 of the License, or (at your option) any
* later version.
*
* This file 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 Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this file; if not, see https://www.gnu.org/licenses/.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "wimlib/pathlist.h"
#include "wimlib/textfile.h"
int
read_path_list_file(const tchar *listfile,
tchar ***paths_ret, size_t *num_paths_ret,
void **mem_ret)
{
STRING_LIST(paths);
struct text_file_section tmp = {
.name = T(""),
.strings = &paths,
};
void *buf;
int ret;
ret = load_text_file(listfile, NULL, 0, &buf, &tmp, 1,
LOAD_TEXT_FILE_REMOVE_QUOTES |
LOAD_TEXT_FILE_ALLOW_STDIN, NULL);
if (ret)
return ret;
*paths_ret = paths.strings;
*num_paths_ret = paths.num_strings;
*mem_ret = buf;
return 0;
}