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

# gd\_naliases(3)

report the number of aliases of a field in a Dirfile

## NAME

gd\_naliases — report the number of aliases of a field in a Dirfile

## SYNOPSIS

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

**unsigned int gd\_naliases(DIRFILE \****dirfile***, const char \****field\_code***);**

## DESCRIPTION

The **gd\_naliases**() function queries a [dirfile(5)](/dirfile/5.md) database specified by *dirfile* and counts the number of aliases of the entry (including the entry's name) specified by *field\_code*.

The *dirfile* argument must point to a valid DIRFILE object previously created by a call to [**gd\_open**(3)](/gd_open/3.md).

## RETURN VALUE

Upon successful completion, **gd\_naliases**() returns an unsigned integer indicating the number of aliases of the specified field code in the dirfile.  If successful, this count will be at least one.

On error, this function returns zero and stores 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 field code was not found in the database.\
  .TP 8 **GD\_E\_BAD\_DIRFILE** The supplied dirfile was invalid.

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

## HISTORY

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

## SEE ALSO

[**gd\_aliases**(3)](/gd_aliases/3.md), [**gd\_alias\_target**(3)](/gd_alias_target/3.md), [**gd\_open**(3)](/gd_open/3.md), [dirfile(5)](/dirfile/5.md)
