glob.h

Overview

Related Modules:

FS

Description:

Provides functions and structures used to find path names matching a pattern and release the memory that was applied for during the search.

Since:

1.0

Version:

1.0

Summary

Data Structures

Data Structure Name

Description

glob_t

Defines the search information.

Macros

Macro Name and Value

Description

GLOB_ERR   0x01

Return upon a read error.

GLOB_MARK   0x02

Append a slash (/) to each path, which corresponds to a directory.

GLOB_NOSORT   0x04

Do not sort the returned path names.

GLOB_DOOFFS   0x08

In the pglob parameter of the glob() function, reserve a string that has a length of pglob->gl_offs and ends with \0 at the beginning of the string list in pglob->pathv. That is, the newly matched string is appended to a position where the distance from the beginning of pglob->pathv is the length of pglob->gl_offs.

GLOB_NOCHECK   0x10

If no pattern matches, return the original pattern.

GLOB_APPEND   0x20

Append the results of this call to the results returned by a previous call to glob().

GLOB_NOESCAPE   0x40

Do not use a backslash () as an escape character.

GLOB_PERIOD   0x80

Allow a leading period to be matched by metacharacters.

GLOB_TILDE   0x1000

Carry out tilde expansion. If a tilde (~) is the only character in the pattern, or an initial tilde is followed immediately by a slash (/), then the home directory of the caller is substituted for the tilde.

GLOB_TILDE_CHECK   0x4000

Similar to GLOB_TILDE. The difference is that if the username is invalid, or the home directory cannot be determined, glob() returns GLOB_NOMATCH to indicate an error.

GLOB_NOSPACE   1

Memory insufficient.

GLOB_ABORTED   2

Read error.

GLOB_NOMATCH   3

No matching item is found.

GLOB_NOSYS   4

The function is not supported.

Functions

Function Name

Description

glob (const char __restrict pattern, int flags, int(errfunc)(const char , int), glob_t__restrict pglob)

int 

Searches for path names that meet a specified pattern.

globfree (glob_t *pglob)

void 

Frees allocated memory from a call to glob().