<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.1.2//EN"
  "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">


<refentry id="gfs-glob.3">

<refentryinfo><date>11 Sep 2003</date></refentryinfo>

<refmeta>
<refentrytitle>gfs_glob</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>Gfarm</refmiscinfo>
</refmeta>

<refnamediv id="name">
<refname>gfs_glob</refname>
<refpurpose>find path names matching a pattern</refpurpose>
</refnamediv>
<refsynopsisdiv id="synopsis">
<funcsynopsis>
<funcsynopsisinfo format="linespecific">
#include &lt;gfarm/gfarm.h&gt;
</funcsynopsisinfo>

<funcprototype>
  <funcdef><function moreinfo="none"><returnvalue>char *</returnvalue>gfs_glob</function></funcdef>
    <paramdef>const char * <parameter moreinfo="none">pattern</parameter></paramdef>
    <paramdef>gfarm_stringlist * <parameter moreinfo="none">paths</parameter></paramdef>
    <paramdef>gfs_glob_t * <parameter moreinfo="none">types</parameter></paramdef>
</funcprototype>

</funcsynopsis>
</refsynopsisdiv>

<!-- body begins here -->

<refsect1 id="description"><title>DESCRIPTION</title>

<para><function moreinfo="none">gfs_glob()</function> searches for all the path names
matching <parameter moreinfo="none">pattern</parameter> that may include a wildcard,
and returns <parameter moreinfo="none">paths</parameter>.</para>

<para>The returned path names are accessed by
gfarm_stringlist_length(3) and gfarm_stringlist_elem(3).</para>

<para>It is necessary to allocate memory space dynamically pointed to
by <parameter moreinfo="none">types</parameter> using
<function moreinfo="none">gfs_glob_init(3)</function> before calling
<function moreinfo="none">gfs_glob(3)</function>.  The allocated memory space needs to
be free'ed by gfs_glob_free(3).</para>

</refsect1>

<refsect1 id="return-values"><title>RETURN VALUES</title>
<variablelist>
<varlistentry>
<term><constant>NULL</constant></term>
<listitem>
<para>The function terminated successfully.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>GFARM_ERR_NO_MEMORY</constant></term>
<listitem>
<para>Insufficient memory was available.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>GFARM_ERR_PATHNAME_TOO_LONG</constant></term>
<listitem>
<para>Too long pattern or path name to process.</para>
</listitem>
</varlistentry>

<varlistentry>
<term>Others</term>
<listitem>
<para>An error except the above occurred.  The reason is shown by its
pointed strings.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>

<refsect1 id="see-also"><title>SEE ALSO</title>
<para>
<citerefentry><refentrytitle>gfs_glob_init</refentrytitle><manvolnum>3</manvolnum></citerefentry>
<citerefentry><refentrytitle>gfs_glob_free</refentrytitle><manvolnum>3</manvolnum></citerefentry>
<citerefentry><refentrytitle>gfarm_stringlist_init</refentrytitle><manvolnum>3</manvolnum></citerefentry>
<citerefentry><refentrytitle>gfarm_stringlist_length</refentrytitle><manvolnum>3</manvolnum></citerefentry>
<citerefentry><refentrytitle>gfarm_stringlist_elem</refentrytitle><manvolnum>3</manvolnum></citerefentry>
<citerefentry><refentrytitle>gfarm_stringlist_free</refentrytitle><manvolnum>3</manvolnum></citerefentry>
<citerefentry><refentrytitle>gfarm_stringlist_free_deeply</refentrytitle><manvolnum>3</manvolnum></citerefentry>
</para>
</refsect1>
</refentry>
