\hypertarget{group__unixem__glob}{
\section{glob() API}
\label{group__unixem__glob}\index{glob() API@{glob() API}}
}


This API provides facilities for enumerating \hyperlink{protocolthe-p}{the} file-\/system contents.  


\subsection*{Classes}
\begin{DoxyCompactItemize}
\item 
struct \hyperlink{structglob__t}{glob\_\-t}
\begin{DoxyCompactList}\small\item\em Result structure for \hyperlink{group__unixem__glob_gaa115aff94eace1fbabc6b3a562139745}{glob()} \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Defines}
\begin{DoxyCompactItemize}
\item 
\hypertarget{group__unixem__glob_gab53de39e075e6fb9a11678341772930b}{
\#define \hyperlink{group__unixem__glob_gab53de39e075e6fb9a11678341772930b}{GLOB\_\-NOSPACE}~(1)}
\label{group__unixem__glob_gab53de39e075e6fb9a11678341772930b}

\begin{DoxyCompactList}\small\item\em (Error result code:) An attempt to allocate memory failed, or if errno was 0 GLOB\_\-LIMIT was specified in \hyperlink{protocolthe-p}{the} flags and ARG\_\-MAX patterns were matched. \item\end{DoxyCompactList}\item 
\hypertarget{group__unixem__glob_gab5de50cedafa21283878657d05fb2ba8}{
\#define \hyperlink{group__unixem__glob_gab5de50cedafa21283878657d05fb2ba8}{GLOB\_\-ABORTED}~(2)}
\label{group__unixem__glob_gab5de50cedafa21283878657d05fb2ba8}

\begin{DoxyCompactList}\small\item\em (Error result code:) The scan was stopped because an error was encountered and either GLOB\_\-ERR was set or ($\ast$errfunc)() returned non-\/zero. \item\end{DoxyCompactList}\item 
\hypertarget{group__unixem__glob_gaed760cf90fd4398067cdb679ebe60312}{
\#define \hyperlink{group__unixem__glob_gaed760cf90fd4398067cdb679ebe60312}{GLOB\_\-NOMATCH}~(3)}
\label{group__unixem__glob_gaed760cf90fd4398067cdb679ebe60312}

\begin{DoxyCompactList}\small\item\em (Error result code:) The pattern does not match any existing pathname, and GLOB\_\-NOCHECK was not set int flags. \item\end{DoxyCompactList}\item 
\hypertarget{group__unixem__glob_ga121ff4729e5e2d403808f90e6a47a113}{
\#define \hyperlink{group__unixem__glob_ga121ff4729e5e2d403808f90e6a47a113}{GLOB\_\-NOSYS}~(4)}
\label{group__unixem__glob_ga121ff4729e5e2d403808f90e6a47a113}

\begin{DoxyCompactList}\small\item\em (Error result code:) . \item\end{DoxyCompactList}\item 
\hypertarget{group__unixem__glob_ga234444240a7d268f31c141b9710c59da}{
\#define \hyperlink{group__unixem__glob_ga234444240a7d268f31c141b9710c59da}{GLOB\_\-ABEND}~GLOB\_\-ABORTED}
\label{group__unixem__glob_ga234444240a7d268f31c141b9710c59da}

\begin{DoxyCompactList}\small\item\em (Error result code:) . \item\end{DoxyCompactList}\item 
\hypertarget{group__unixem__glob_ga9e77b0b20a1c1d66cdf924a07776f360}{
\#define \hyperlink{group__unixem__glob_ga9e77b0b20a1c1d66cdf924a07776f360}{GLOB\_\-ERR}~0x00000001}
\label{group__unixem__glob_ga9e77b0b20a1c1d66cdf924a07776f360}

\begin{DoxyCompactList}\small\item\em Return on read errors. \item\end{DoxyCompactList}\item 
\hypertarget{group__unixem__glob_gac6ec2b6ae844d895de9685a689dd27f0}{
\#define \hyperlink{group__unixem__glob_gac6ec2b6ae844d895de9685a689dd27f0}{GLOB\_\-MARK}~0x00000002}
\label{group__unixem__glob_gac6ec2b6ae844d895de9685a689dd27f0}

\begin{DoxyCompactList}\small\item\em Append a slash to each name. \item\end{DoxyCompactList}\item 
\hypertarget{group__unixem__glob_ga4eba6cedebdfe13f924d9b4a489bfe83}{
\#define \hyperlink{group__unixem__glob_ga4eba6cedebdfe13f924d9b4a489bfe83}{GLOB\_\-NOSORT}~0x00000004}
\label{group__unixem__glob_ga4eba6cedebdfe13f924d9b4a489bfe83}

\begin{DoxyCompactList}\small\item\em Don't sort \hyperlink{protocolthe-p}{the} names. \item\end{DoxyCompactList}\item 
\hypertarget{group__unixem__glob_ga8ae13e97ae5da0993fe526c406337c62}{
\#define \hyperlink{group__unixem__glob_ga8ae13e97ae5da0993fe526c406337c62}{GLOB\_\-DOOFFS}~0x00000008}
\label{group__unixem__glob_ga8ae13e97ae5da0993fe526c406337c62}

\begin{DoxyCompactList}\small\item\em Insert PGLOB-\/$>$gl\_\-offs NULLs. \item\end{DoxyCompactList}\item 
\hypertarget{group__unixem__glob_gaf183b2f40936442579be8d62b87e6fc6}{
\#define \hyperlink{group__unixem__glob_gaf183b2f40936442579be8d62b87e6fc6}{GLOB\_\-NOCHECK}~0x00000010}
\label{group__unixem__glob_gaf183b2f40936442579be8d62b87e6fc6}

\begin{DoxyCompactList}\small\item\em If nothing matches, return \hyperlink{protocolthe-p}{the} pattern. \item\end{DoxyCompactList}\item 
\hypertarget{group__unixem__glob_ga7e586df07bb159e904a61d8470f1fda2}{
\#define \hyperlink{group__unixem__glob_ga7e586df07bb159e904a61d8470f1fda2}{GLOB\_\-APPEND}~0x00000020}
\label{group__unixem__glob_ga7e586df07bb159e904a61d8470f1fda2}

\begin{DoxyCompactList}\small\item\em Append to results of a previous call. \item\end{DoxyCompactList}\item 
\hypertarget{group__unixem__glob_gad21c37825788f86d5fefea803276f746}{
\#define \hyperlink{group__unixem__glob_gad21c37825788f86d5fefea803276f746}{GLOB\_\-NOESCAPE}~0x00000040}
\label{group__unixem__glob_gad21c37825788f86d5fefea803276f746}

\begin{DoxyCompactList}\small\item\em Backslashes don't quote metacharacters. \item\end{DoxyCompactList}\item 
\hypertarget{group__unixem__glob_gab548aece9c1254c6c08475ce8c6274a2}{
\#define \hyperlink{group__unixem__glob_gab548aece9c1254c6c08475ce8c6274a2}{GLOB\_\-PERIOD}~0x00000080}
\label{group__unixem__glob_gab548aece9c1254c6c08475ce8c6274a2}

\begin{DoxyCompactList}\small\item\em Leading `.' can be matched by metachars. \item\end{DoxyCompactList}\item 
\hypertarget{group__unixem__glob_gacc6e4ea8a4442b7781000ce2ac38bfc8}{
\#define \hyperlink{group__unixem__glob_gacc6e4ea8a4442b7781000ce2ac38bfc8}{GLOB\_\-MAGCHAR}~0x00000100}
\label{group__unixem__glob_gacc6e4ea8a4442b7781000ce2ac38bfc8}

\begin{DoxyCompactList}\small\item\em Set in gl\_\-flags if any metachars seen. \item\end{DoxyCompactList}\item 
\hypertarget{group__unixem__glob_gaa40f63eb7a510f61854e80c8aed76df2}{
\#define \hyperlink{group__unixem__glob_gaa40f63eb7a510f61854e80c8aed76df2}{GLOB\_\-ALTDIRFUNC}~0x00000200}
\label{group__unixem__glob_gaa40f63eb7a510f61854e80c8aed76df2}

\begin{DoxyCompactList}\small\item\em Use gl\_\-opendir et al functions. \item\end{DoxyCompactList}\item 
\hypertarget{group__unixem__glob_ga8e2d3aba9a154bf55f242e4c7806dd61}{
\#define \hyperlink{group__unixem__glob_ga8e2d3aba9a154bf55f242e4c7806dd61}{GLOB\_\-BRACE}~0x00000400}
\label{group__unixem__glob_ga8e2d3aba9a154bf55f242e4c7806dd61}

\begin{DoxyCompactList}\small\item\em Expand \char`\"{}\{a,b\}\char`\"{} to \char`\"{}a\char`\"{} \char`\"{}b\char`\"{}. \item\end{DoxyCompactList}\item 
\hypertarget{group__unixem__glob_gacbd3685c584a9741e4cf6dab1cab0e17}{
\#define \hyperlink{group__unixem__glob_gacbd3685c584a9741e4cf6dab1cab0e17}{GLOB\_\-NOMAGIC}~0x00000800}
\label{group__unixem__glob_gacbd3685c584a9741e4cf6dab1cab0e17}

\begin{DoxyCompactList}\small\item\em If no magic chars, return \hyperlink{protocolthe-p}{the} pattern. \item\end{DoxyCompactList}\item 
\hypertarget{group__unixem__glob_ga4f1c6c0dae8dfefcf3032fed1b5cd0fe}{
\#define \hyperlink{group__unixem__glob_ga4f1c6c0dae8dfefcf3032fed1b5cd0fe}{GLOB\_\-TILDE}~0x00001000}
\label{group__unixem__glob_ga4f1c6c0dae8dfefcf3032fed1b5cd0fe}

\begin{DoxyCompactList}\small\item\em Expand $\sim$user and $\sim$ to home directories. \item\end{DoxyCompactList}\item 
\hypertarget{group__unixem__glob_ga7d9e60c4fe4f8707e9e4f7b6b30ef753}{
\#define \hyperlink{group__unixem__glob_ga7d9e60c4fe4f8707e9e4f7b6b30ef753}{GLOB\_\-ONLYDIR}~0x00002000}
\label{group__unixem__glob_ga7d9e60c4fe4f8707e9e4f7b6b30ef753}

\begin{DoxyCompactList}\small\item\em Match only directories. \item\end{DoxyCompactList}\item 
\hypertarget{group__unixem__glob_gacf779f5283225f7a1507122f75418103}{
\#define \hyperlink{group__unixem__glob_gacf779f5283225f7a1507122f75418103}{GLOB\_\-TILDE\_\-CHECK}~0x00004000}
\label{group__unixem__glob_gacf779f5283225f7a1507122f75418103}

\begin{DoxyCompactList}\small\item\em Like GLOB\_\-TILDE but return an error. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
int \hyperlink{group__unixem__glob_gaa115aff94eace1fbabc6b3a562139745}{glob} (char const $\ast$pattern, int flags, int($\ast$errfunc)(char const $\ast$, int), \hyperlink{structglob__t}{glob\_\-t} $\ast$pglob)
\begin{DoxyCompactList}\small\item\em Generates pathnames matching a pattern. \item\end{DoxyCompactList}\item 
void \hyperlink{group__unixem__glob_gaa43d417234c8572d6e98fb1dc12a4794}{globfree} (\hyperlink{structglob__t}{glob\_\-t} $\ast$pglob)
\begin{DoxyCompactList}\small\item\em Frees \hyperlink{protocolthe-p}{the} results of a call to glob. \item\end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
This API provides facilities for enumerating \hyperlink{protocolthe-p}{the} file-\/system contents. 

\subsection{Function Documentation}
\hypertarget{group__unixem__glob_gaa115aff94eace1fbabc6b3a562139745}{
\index{unixem\_\-glob@{unixem\_\-glob}!glob@{glob}}
\index{glob@{glob}!unixem_glob@{unixem\_\-glob}}
\subsubsection[{glob}]{\setlength{\rightskip}{0pt plus 5cm}int glob (
\begin{DoxyParamCaption}
\item[{char const $\ast$}]{pattern, }
\item[{int}]{flags, }
\item[{int($\ast$)(char const $\ast$, int)}]{errfunc, }
\item[{{\bf glob\_\-t} $\ast$}]{pglob}
\end{DoxyParamCaption}
)}}
\label{group__unixem__glob_gaa115aff94eace1fbabc6b3a562139745}


Generates pathnames matching a pattern. 

This function is a pathname generator that implements \hyperlink{protocolthe-p}{the} rules for file name pattern matching used by \hyperlink{protocolthe-p}{the} UNIX shell.


\begin{DoxyParams}{Parameters}
{\em pattern} & The pattern controlling \hyperlink{protocolthe-p}{the} search \\
\hline
{\em flags} & A combination of \hyperlink{protocolthe-p}{the} {\bfseries GLOB\_\-$\ast$} flags \\
\hline
{\em errfunc} & \mbox{[}Not currently supported. Must be NULL\mbox{]} \\
\hline
{\em pglob} & Pointer to a \hyperlink{structglob__t}{glob\_\-t} structure to receive \hyperlink{protocolthe-p}{the} search results \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 on success, otherwise one of \hyperlink{protocolthe-p}{the} {\bfseries GLOB\_\-$\ast$} error codes 
\end{DoxyReturn}
\hypertarget{group__unixem__glob_gaa43d417234c8572d6e98fb1dc12a4794}{
\index{unixem\_\-glob@{unixem\_\-glob}!globfree@{globfree}}
\index{globfree@{globfree}!unixem_glob@{unixem\_\-glob}}
\subsubsection[{globfree}]{\setlength{\rightskip}{0pt plus 5cm}void globfree (
\begin{DoxyParamCaption}
\item[{{\bf glob\_\-t} $\ast$}]{pglob}
\end{DoxyParamCaption}
)}}
\label{group__unixem__glob_gaa43d417234c8572d6e98fb1dc12a4794}


Frees \hyperlink{protocolthe-p}{the} results of a call to glob. 

This function releases any memory allocated in a call to glob. It must always be called for a successful call to glob.


\begin{DoxyParams}{Parameters}
{\em pglob} & Pointer to a \hyperlink{structglob__t}{glob\_\-t} structure to receive \hyperlink{protocolthe-p}{the} search results \\
\hline
\end{DoxyParams}
