---
name: "gd_entry_list"
section: "3"
platform: "linux"
package: "libgetdata-doc"
version: "0.11.0-15"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/gd_entry_list"
---

# gd\_entry\_list(3)

list field entries in a Dirfile

## NAME

gd\_entry\_list, gd\_field\_list, gd\_field\_list\_by\_type gd\_mfield\_list, gd\_mfield\_list\_by\_type, gd\_mvector\_list, gd\_vector\_list — list field entries in a Dirfile

## SYNOPSIS

**#include \<getdata.h\>**

**const char \*\*gd\_entry\_list(DIRFILE \****dirfile***,** **const char \****parent***, int** *type***, unsigned int** *flags***);**

**const char \*\*gd\_field\_list(DIRFILE \****dirfile***);**

**const char \*\*gd\_field\_list\_by\_type(DIRFILE \****dirfile***, gd\_entype\_t** *type***);**

**const char \*\*gd\_mfield\_list(DIRFILE \****dirfile***, const char \****parent***);**

**const char \*\*gd\_mfield\_list\_by\_type(DIRFILE \****dirfile***,** **const char \****parent***, gd\_entype\_t** *type***);**

**const char \*\*gd\_mvector\_list(DIRFILE \****dirfile***, const char \****parent***);**

**const char \*\*gd\_vector\_list(DIRFILE \****dirfile***);**

## DESCRIPTION

The **gd\_entry\_list**() function queries a [dirfile(5)](/dirfile/5.md) database specified by *dirfile* and finds all the fields satisfying the provided criteria.  If *parent* is non-NULL, metafields under the field specified by *parent* are considered; otherwise, top-level fields are considered, and metafields ignored.

The *type* argument should be one of the following symbols indicating an explicit entry type to list:

-

  **GD\_BIT\_ENTRY**, **GD\_CARRAY\_ENTRY**, **GD\_CONST\_ENTRY**, **GD\_DIVIDE\_ENTRY**, **GD\_INDEX\_ENTRY**, **GD\_INDIR\_ENTRY**, **GD\_LINCOM\_ENTRY**, **GD\_LINTERP\_ENTRY**, **GD\_MPLEX\_ENTRY**, **GD\_MULTIPLY\_ENTRY**, **GD\_PHASE\_ENTRY**, **GD\_POLYNOM\_ENTRY**, **GD\_RAW\_ENTRY**, **GD\_RECIP\_ENTRY**, **GD\_SARRAY\_ENTRY**, **GD\_SBIT\_ENTRY**, **GD\_SINDIR\_ENTRY**, **GD\_STRING\_ENTRY**, **GD\_WINDOW\_ENTRY**.

(**GD\_INDEX\_ENTRY** is a special field type for the implicit *INDEX* field) or else one of the following special symbols:\
  .PP **GD\_ALL\_ENTRIES**\
  .TP 8 **(=0)** List entries of all types.\
  .TP 8 **GD\_ALIAS\_ENTRIES** List only aliases.  This is the only way to get a list including aliases which do not point to valid field codes.\
  .TP 8 **GD\_SCALAR\_ENTRIES** List only scalar field types (**CONST**, **CARRAY**, **SARRAY**, **STRING**).\
  .TP 8 **GD\_VECTOR\_ENTRIES** List only numeric-valued vector field types (all field types except **SINDIR** and the scalar field types listed above).

The *flags* argument should be zero or more of the following flags, bitwise or'd together:\
  .TP 8 **GD\_ENTRIES\_HIDDEN** Include hidden entries (see [**gd\_hidden**(3)](/gd_hidden/3.md)) in the list: normally hidden entries are skipped;\
  .TP 8 **GD\_ENTRIES\_NOALIAS** Exclude aliases from the list: normally aliases are considered the same as their target (that is: if a field satisfies the criteria, both its canonical name and all its aliases will appear in the list).

The array returned will be de-allocated by a call to [**gd\_close**(3)](/gd_close/3.md) and should not be de-allocated by the caller.  The list returned should not be assumed to be in any particular order.  The array is terminated by a NULL pointer.  The number of elements in the array, excluding the terminating NULL, can be obtained from an equivalent call to [**gd\_nentries**(3)](/gd_nentries/3.md).

The caller may not modify any strings in the array, or the array itself.  Doing so may cause database corruption.  The pointer returned is guaranteed to be valid at least until **gd\_entry\_list**() is called again on the same DIRFILE object, or until the array is de-allocated by a call to [**gd\_close**(3)](/gd_close/3.md). (Although the data may have become obsolete, if metadata have been modified in the interrim.)

This function has a subset of the functionality of the [**gd\_match\_entries**(3)](/gd_match_entries/3.md) function (q.v.).

### Special Cases

The call

**gd\_field\_list(***dirfile***);**

is equivalent to

**gd\_entry\_list(***dirfile***, NULL, GD\_ALL\_ENTRIES, 0);**

The call

**gd\_field\_list\_by\_type(***dirfile***,** *type***);**

is equivalent to

**gd\_entry\_list(***dirfile***, NULL,** *type***, 0);**

The call

**gd\_mfield\_list(***dirfile***,** *parent***);**

is equivalent to

**gd\_entry\_list(***dirfile***,** *parent***, GD\_ALL\_ENTRIES, 0);**

The call

**gd\_mfield\_list\_by\_type(***dirfile***,** *parent***,** *type***);**

is equivalent to

**gd\_entry\_list(***dirfile***,** *parent***,** *type***, 0);**

The call

**gd\_mvector\_list(***dirfile***,** *parent***);**

is equivalent to

**gd\_entry\_list(***dirfile***,** *parent***, GD\_VECTOR\_ENTRIES, 0);**

The call

**gd\_vector\_list(***dirfile***);**

is equivalent to

**gd\_entry\_list(***dirfile***, NULL, GD\_VECTOR\_ENTRIES, 0);**

## RETURN VALUE

Upon successful completion, these functions returns a pointer to an array of strings containing the names of all the entries in the database satisfying the supplied criteria.  The array is terminated with a NULL pointer.  If there are no matching entries, an array containing only the terminating NULL pointer is returned.

On error, these functions return NULL and store a negative-valued error code in the **DIRFILE** object which may be retrieved by a subsequent call to [**gd\_error**(3)](/gd_error/3.md). Possible error codes are:\
  .TP 8 **GD\_E\_BAD\_CODE** The supplied parent field code was not found, or referred to a metafield itself.\
  .TP 8 **GD\_E\_BAD\_DIRFILE** The supplied dirfile was invalid.\
  .TP 8 **GD\_E\_BAD\_ENTRY** The *type* parameter supplied was not one of the symbols listed above.

A descriptive error string for the error may be obtained by calling [**gd\_error\_string**(3)](/gd_error_string/3.md).

## HISTORY

The **get\_field\_list**() function appeared in GetData-0.3.0.

The **get\_field\_list\_by\_type**(), **get\_mfield\_list**(), **get\_mfield\_list\_by\_type**(), **get\_mvector\_list**(), and **get\_vector\_list**() functions appeared in GetData-0.4.0.

In GetData-0.7.0, these functions were renamed to **gd\_field\_list**(), **gd\_field\_list\_by\_type**(), **gd\_mfield\_list**(), **gd\_mfield\_list\_by\_type**(), **gd\_mvector\_list**(), and **gd\_vector\_list**().

The **gd\_entry\_list**() function appeared in GetData-0.8.0.

## SEE ALSO

[**gd\_error**(3)](/gd_error/3.md), [**gd\_error\_string**(3)](/gd_error_string/3.md), [**gd\_hidden**(3)](/gd_hidden/3.md), [**gd\_match\_entries**(3)](/gd_match_entries/3.md), [**gd\_nentries**(3)](/gd_nentries/3.md), [**gd\_open**(3)](/gd_open/3.md), [dirfile(5)](/dirfile/5.md)
