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

# gd\_alias\_target(3)

determine the target of an alias defined in a Dirfile database

## NAME

gd\_alias\_target — determine the target of an alias defined in a Dirfile database

## SYNOPSIS

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

**const char \*gd\_alias\_target(DIRFILE \****dirfile***,** **const char \****alias\_name***);**

## DESCRIPTION

The **gd\_alias\_target**() function queries a [dirfile(5)](/dirfile/5.md) database specified by *dirfile* and determines the target field code of the alias specified by *alias\_name*.

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

Note: the target may itself be the an alias, which will have its own target.  To obtain the canonical name of the field ultimately referenced by *alias\_name*, pass it to [**gd\_entry**(3)](/gd_entry/3.md) and inspect the *field* member of the gd\_entry\_t structure returned.

## RETURN VALUE

Upon successful completion, **gd\_alias\_target**() returns a pointer to a read-only character string containing the name of the target of the specified alias.  On error, **gd\_alias\_target**() returns NULL and sets the dirfile error a non-zero error value.  Possible error values are:\
  .TP 8 **GD\_E\_BAD\_CODE** The name *alias\_name* was not found in the dirfile. **GD\_E\_BAD\_DIRFILE** The supplied dirfile was invalid.\
  .TP 8 **GD\_E\_BAD\_FIELD\_TYPE** The entry specified by *alias\_name* was not an alias.

The dirfile error may be retrieved by calling [**gd\_error**(3)](/gd_error/3.md). A descriptive error string for the last error encountered can be obtained from a call to [**gd\_error\_string**(3)](/gd_error_string/3.md).

## HISTORY

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

## SEE ALSO

[**gd\_aliases**(3)](/gd_aliases/3.md), [**gd\_entry**(3)](/gd_entry/3.md), [**gd\_open**(3)](/gd_open/3.md), [dirfile(5)](/dirfile/5.md)
