GNU Octave 10.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
glob-wrappers.c
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 2016-2025 The Octave Project Developers
4//
5// See the file COPYRIGHT.md in the top-level directory of this
6// distribution or <https://octave.org/copyright/>.
7//
8// This file is part of Octave.
9//
10// Octave is free software: you can redistribute it and/or modify it
11// under the terms of the GNU General Public License as published by
12// the Free Software Foundation, either version 3 of the License, or
13// (at your option) any later version.
14//
15// Octave is distributed in the hope that it will be useful, but
16// WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18// GNU General Public License for more details.
19//
20// You should have received a copy of the GNU General Public License
21// along with Octave; see the file COPYING. If not, see
22// <https://www.gnu.org/licenses/>.
23//
24////////////////////////////////////////////////////////////////////////
25
26// These functions may be provided by gnulib. We don't include gnulib
27// headers directly in Octave's C++ source files to avoid problems that
28// may be caused by the way that gnulib overrides standard library
29// functions.
30
31#if defined (HAVE_CONFIG_H)
32# include "config.h"
33#endif
34
35#include <stdlib.h>
36
37#include <fnmatch.h>
38#include <glob.h>
39
40#include "glob-wrappers.h"
41
42void *
44{
45 return malloc (sizeof (glob_t));
46}
47
48// Does not call globfree.
49void
51{
52 free (glob_info);
53}
54
55int
56octave_glob_wrapper (const char *pattern, int flags, void *glob_info)
57{
58 return glob (pattern, flags, 0, glob_info);
59}
60
61int
62octave_glob_num_matches (void *glob_info)
63{
64 return glob_info ? ((glob_t *) glob_info)->gl_pathc : 0;
65}
66
67char **
68octave_glob_match_list (void *glob_info)
69{
70 return glob_info ? ((glob_t *) glob_info)->gl_pathv : 0;
71}
72
73void
74octave_globfree_wrapper (void *glob_info)
75{
76 globfree ((glob_t *) glob_info);
77}
78
79int
81{
82 return GLOB_NOSORT;
83}
84
85int
86octave_fnmatch_wrapper (const char *pattern, const char *name, int flags)
87{
88 return fnmatch (pattern, name, flags);
89}
90
91int
93{
94 return FNM_NOMATCH;
95}
96
97int
99{
100 return FNM_PATHNAME;
101}
102
103int
105{
106 return FNM_NOESCAPE;
107}
108
109int
111{
112 return FNM_PERIOD;
113}
void * octave_create_glob_info_struct(void)
int octave_fnm_nomatch_wrapper(void)
int octave_glob_nosort_wrapper(void)
void octave_destroy_glob_info_struct(void *glob_info)
void octave_globfree_wrapper(void *glob_info)
char ** octave_glob_match_list(void *glob_info)
int octave_glob_num_matches(void *glob_info)
int octave_fnm_period_wrapper(void)
int octave_fnm_pathname_wrapper(void)
int octave_fnm_noescape_wrapper(void)
int octave_glob_wrapper(const char *pattern, int flags, void *glob_info)
int octave_fnmatch_wrapper(const char *pattern, const char *name, int flags)
bool fnmatch(const string_vector &pat, const std::string &str, int fnm_flags)
Definition oct-glob.cc:58
string_vector glob(const string_vector &pat)
Definition oct-glob.cc:73
void * malloc(unsigned)
void free(void *)