glob.h(0P)

glob.h โ€” pathname pattern-matching types ๐Ÿ’…โœจ

okay bestie, so this page is from the POSIX Programmer's Manual (that's the glob.h(0P) joint right there in the corner ๐Ÿ‘‘). Real talk though: the Linux implementation of this interface may differ โ€” so if you're on Linux, go peek at the corresponding Linux manual page for the actual deets โ€” or honestly the interface might not even be implemented on Linux at all. ๐Ÿ™ˆ


๐ŸŒธ PROLOG ๐ŸŒธ

This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux.


๐ŸŽ€ NAME ๐ŸŽ€

glob.h โ€” pathname pattern-matching types. that's it, that's the name, iconic.


โœจ SYNOPSIS โœจ

#include <glob.h>

๐Ÿ’– DESCRIPTION ๐Ÿ’–

So the <glob.h> header shall define the structures and symbolic constants that the glob() function uses. it's giving "support system for the main character" fr fr.

The <glob.h> header shall define the glob_t structure type, which shall include at least these members:

size_t   gl_pathc Count of paths matched by pattern.
char   **gl_pathv Pointer to a list of matched pathnames.
size_t   gl_offs  Slots to reserve at the beginning of gl_pathv.
  • gl_pathc โ€” count of paths matched by pattern. the headcount bestie ๐Ÿ’€
  • gl_pathv โ€” pointer to a list of matched pathnames. the actual roster โœจ
  • gl_offs โ€” slots to reserve at the beginning of gl_pathv. like saving seats at the front of the row ๐Ÿซถ

The <glob.h> header shall define the size_t type as described in <sys/types.h>. yes, that <sys/types.h>, the one you already know and love ๐Ÿ’œ

The <glob.h> header shall define the following symbolic constants as values for the flags argument:

  • GLOB_APPEND โ€” append generated pathnames to those previously obtained. not me just adding to the pile ๐ŸŽ€
  • GLOB_DOOFFS โ€” specify how many null pointers to add to the beginning of gl_pathv. blank slots at the start, periodt.
  • GLOB_ERR โ€” cause glob() to return on error. no patience, we're leaving ๐Ÿƒโ€โ™€๏ธ
  • GLOB_MARK โ€” each pathname that is a directory that matches pattern has a <slash> appended. directory girls get a little accessory ๐Ÿ’…
  • GLOB_NOCHECK โ€” if pattern does not match any pathname, then return a list consisting of only pattern. if nobody shows up, at least you showed up for yourself ๐Ÿ˜ญ
  • GLOB_NOESCAPE โ€” disable backslash escaping. backslash, you are OFF the team.
  • GLOB_NOSORT โ€” do not sort the pathnames returned. chaotic order, we don't gatekeep ๐Ÿฆ‹

The <glob.h> header shall define the following symbolic constants as error return values:

  • GLOB_ABORTED โ€” the scan was stopped because GLOB_ERR was set or (*errfunc)() returned non-zero.
  • GLOB_NOMATCH โ€” the pattern does not match any existing pathname, and GLOB_NOCHECK was not set in flags.
  • GLOB_NOSPACE โ€” an attempt to allocate memory failed. bestie ran out of room, it happens ๐Ÿ˜ญ

The following shall be declared as functions and may also be defined as macros. Function prototypes shall be provided.

int  glob(const char *restrict, int, int(*)(const char *, int),
         glob_t *restrict);
void globfree(glob_t *);

The following sections are informative. (translation: the lore is optional, the facts above were not ๐ŸŒˆ)


๐ŸŒŸ APPLICATION USAGE ๐ŸŒŸ

None.


๐Ÿ’ญ RATIONALE ๐Ÿ’ญ

None.


๐Ÿ”ฎ FUTURE DIRECTIONS ๐Ÿ”ฎ

None.


๐Ÿ‘€ SEE ALSO ๐Ÿ‘€

  • <sys_types.h>
  • The System Interfaces volume of POSIX.1โ€2017, glob()

Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .

Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .


and that's the whole page bestie, no cap ๐Ÿซถ this came to you courtesy of IEEE/The Open Group, dated 2017, and it lives under the name glob.h(0P). go match some patterns, you ate ๐Ÿ’…โœจ๐ŸŽ€

๐Ÿ“ฆ where this page comes from