1 #ifndef VSF_LS_H
2 #define VSF_LS_H
3 
4 struct mystr;
5 struct mystr_list;
6 struct vsf_sysutil_dir;
7 struct vsf_session;
8 
9 /* vsf_ls_populate_dir_list()
10  * PURPOSE
11  * Given a directory handle, populate a formatted directory entry list (/bin/ls
12  * format). Also optionally populate a list of subdirectories.
13  * PARAMETERS
14  * p_sess         - the current FTP session object
15  * p_list         - the string list object for the result list of entries
16  * p_subdir_list  - the string list object for the result list of
17  *                  subdirectories. May be 0 if client is not interested.
18  * p_dir          - the directory object to be listed
19  * p_base_dir_str - the directory name we are listing, relative to current
20  * p_option_str   - the string of options given to the LIST/NLST command
21  * p_filter_str   - the filter string given to LIST/NLST - e.g. "*.mp3"
22  * is_verbose     - set to 1 for LIST, 0 for NLST
23  * is_http        - ...
24  */
25 void vsf_ls_populate_dir_list(struct vsf_session* p_sess,
26                               struct mystr_list* p_list,
27                               struct mystr_list* p_subdir_list,
28                               struct vsf_sysutil_dir* p_dir,
29                               const struct mystr* p_base_dir_str,
30                               const struct mystr* p_option_str,
31                               const struct mystr* p_filter_str,
32                               int is_verbose,
33                               int is_http);
34 
35 /* vsf_filename_passes_filter()
36  * PURPOSE
37  * Determine whether the given filename is matched by the given filter string.
38  * The format of the filter string is a small subset of a regular expression.
39  * Currently, just * and ? are supported.
40  * PARAMETERS
41  * p_filename_str  - the filename to match
42  * p_filter_str    - the filter to match against
43  * iters           - pointer to a zero-seeded int which prevents the match
44  *                   loop from running an excessive number of times
45  * RETURNS
46  * Returns 1 if there is a match, 0 otherwise.
47  */
48 int vsf_filename_passes_filter(const struct mystr* p_filename_str,
49                                const struct mystr* p_filter_str,
50                                unsigned int* iters);
51 
52 #endif /* VSF_LS_H */
53 
54