bglibs
|
Macros | |
#define | PATH_MATCH_DOTFILES 1 |
Functions | |
int | path_merge (str *path, const char *start) |
int | fnmatch (const char *filename, const char *pattern, unsigned options) |
int | has_magic (const char *s) |
int | path_match (const char *pattern, str *result, unsigned options) |
int | path_contains (const char *path, const char *part) |
int | path_mktemp (const char *prefix, str *filename) |
int | path_mkdirs (const char *path, unsigned mode) |
#define PATH_MATCH_DOTFILES 1 |
Make path_match include files starting with dots.
|
extern |
Matches a path using glob patterns.
References str::len, PATH_MATCH_DOTFILES, str::s, and str::size.
|
extern |
Does the string have glob characters in it.
Returns true if the given string contains at least one instance of either *
, ?
, or [
.
|
extern |
Test if a path contains a component.
Returns true if the path
contains part
either at the start followed by a slash, at the end preceded by a slash, or elsewhere with a slash on either side.
|
extern |
Matches the pattern against existing files.
This function produces a list of existing files in result
(in the current directory) that match the given pattern. If options
has PATH_MATCH_DOTFILES
set, the result may contain paths starting with ".".
References str::len, str_copyb(), str_copys(), str_free(), and str_sort().
|
extern |
Merge two paths together.
This function takes a starting path, and merges the second path into it. If the second path starts with a "/", it replaces the existing path completely. If the second path contains any ".." components, the preceding directory component in the current path (if any) is removed. All "." components are removed.
The effects of this function are equivalent to changing directory to the first path and then using the second one.
References str_copys().
|
extern |
Create a directory, optionally creating any parent directories.
This function creates the named directory using mkdir
. If any of the parent directories of the specified path do not exist, they are created as well (with the same mode).
References path_mkdirs().
Referenced by path_mkdirs().
|
extern |
Create a temporary file.
This function creates a temporary file by adding an difficult-to-predict suffix (using the PID and microsecond timestamp) to the given prefix. If this filename does not exist, it is opened in read/write mode.
References str::s, str_catc(), str_catu(), str_catuw(), and str_copys().