gd_fragment_namespace(3)

NAME
gd_fragment_namespace — report or change the root namespace of a fragment of a dirfile database

SYNOPSIS
#include <getdata.h>

const char *gd_fragment_namespace(DIRFILE *dirfile, int fragment_index, char *new_namespace);

DESCRIPTION
The function can be used to update and/or query the root namespace of a fragment in the dirfile(5) database specified by

If is NULL, then the current root namespace of the fragment indexed by is returned. If is non-NULL, then the root namespace is first changed to the string provided before being reported. The new namespace may optionally contain a single, trailing dot (.). To remove an existing root namespace, pass a pointer to the empty string ("") as

The root namespace of the root format file (the one indexed by may not be changed. It is always the empty string.

The argument must point to a valid DIRFILE object previously created by a call to

RETURN VALUE
Upon successful completion, returns a non-NULL pointer to a read-only string containing the current root namespace of the fragment specified. This will be a copy of the string if that parameter was non-NULL. If the fragment's root namespace is empty, a pointer to the empty string ("") will be returned.

On error, this function returns NULL and sets the dirfile error to a non-zero error value. Possible dirfile error values are: The dirfile was opened read-only. A memory allocation error occurred. The supplied was not a valid namespace. The supplied dirfile was invalid. The supplied index was out of range. This error will also be returned if an attempt is made to change the root namespace of the root format file (fragment_index zero). Attempting to change the root namespace resulted in a duplicated field definition. The protection level of the specified fragment prohibits metadata changes.

The dirfile error may be retrieved by calling A descriptive error string for the last error encountered can be obtained from a call to

HISTORY
The function appeared in GetData-0.10.0.

SEE ALSO
dirfile(5), dirfile-format(5)