SIMPLE SOLUTIONS

GD_RENAME(3) - man page online | library functions

Change the name of a dirfile field or alias.

Chapter
16 October 2014
gd_rename(3)                                 GETDATA                                 gd_rename(3)

NAME

gd_rename — change the name of a dirfile field or alias

SYNOPSIS

#include <getdata.h> int gd_rename(DIRFILE *dirfile, const char *old_code, const char *new_name, unsigned int flags);

DESCRIPTION

The gd_rename() function changes the name of the field or alias specified by old_code, which should not contain a representation suffix, defined in the dirfile specified by dirfile to new_name. If the new name is the same as the old name, this function does nothing and returns no error. When renaming a metafield, the metafield should be specified in old_code by its full (slashed) field code, while new_name should only contain the new name (without slash). If old_code specifies a top-level field with meta subfields, the subfields will be re‐ named, too. By default, this function also updates ALIAS entries whose target contains old_code to point to the new field. Similarly, specifying the GD_REN_UPDB flag will cause this function to modify any field entry containing old_code. As a result, this function may cause more than one metadata fragment to be modified. The flags parameter should be zero or more of the following flags, bitwise or'd together: GD_REN_DANGLE Don't update ALIAS entries, instead turning them into dangling aliases. GD_REN_DATA if old_code specifies a RAW field, the binary file associated with the field will be renamed as well. Without this flag, no changes are made to the binary file. In this case, the field's I/O pointer will be reset to the beginning-of-frame. If field_code specifies a field of type other than RAW, this flag is ignored. GD_REN_FORCE When updating field metadata (either the target of an alias, or else when specified along with GD_REN_UPDB), skip updating field codes which would be invalid (due to /INCLUDE affixes). Without this flag, such invalid field codes causes this func‐ tion to fail with the error GD_E_BAD_CODE. GD_REN_UPDB Rename the field in any other field specifications which use this field as an input (either as a vector input field to a derived field, or else as a scalar field pa‐ rameter). Without this flag, fields which depend on the old name of this field are left unmodified.

RETURN VALUE

On success, gd_rename() returns zero. On error, -1 is returned and the dirfile error is set to a non-zero error value. Possible error values are: GD_E_ACCMODE The specified dirfile was opened read-only. GD_E_ALLOC The library was unable to allocate memory. GD_E_BAD_CODE The field specified by old_code was not found. Or else the resultant metadata up‐ date tried to change a field code into something prohibited by a fragment's affix‐ es. GD_E_BAD_DIRFILE The supplied dirfile was invalid. GD_E_BAD_FIELD_TYPE An attempt was made to rename the immutable INDEX field. GD_E_DUPLICATE The new name specified is already in use by another entry. GD_E_IO An I/O error occurred while attempting to rename the binary file. GD_E_PROTECTED The metadata of the format specification fragment containing the renamed entry, or another entry affected by this change, was protected from change, or the binary data of the fragment was protected from change and a binary file move was request‐ ed. GD_E_UNKNOWN_ENCODING The encoding scheme of the specified field could not be determined or was not un‐ derstood by GetData. GD_E_UNSUPPORTED The encoding scheme of the field does not support binary file renaming. The dirfile error may be retrieved by calling gd_error(3). A descriptive error string for the last error encountered can be obtained from a call to gd_error_string(3).

SEE ALSO

gd_metaflush(3), gd_open(3), gd_error(3), gd_error_string(3), dirfile(5), dirfile-for‐ mat(5)
Version 0.9.0 16 October 2014 gd_rename(3)
This manual Reference Other manuals
gd_rename(3) referred by dirfile-encoding(5) | gd_alter_entry(3) | gd_getdata(3) | gd_move(3)
refer to dirfile(5) | gd_cbopen(3) | gd_error(3) | gd_error_string(3) | gd_metaflush(3)