1dirfile_rename(3) GETDATA dirfile_rename(3)
2
3
4
6 dirfile_rename — change the name of a dirfile field
7
9 #include <getdata.h>
10
11 int dirfile_rename(DIRFILE *dirfile, const char *old_code, const char
12 *new_name, int move_data);
13
15 The dirfile_rename() function changes the name of the field specified
16 by old_code, which should not contain a representation suffix, defined
17 in the dirfile specified by dirfile to new_name. If the new name is
18 the same as the old name, this function does nothing.
19
20 When renaming a metafield, the metafield should be specified in
21 old_code by its full (slashed) field code, while new_name should only
22 contain the new name (without slash).
23
24 If the flag move_data is non-zero, and old_code specifies a RAW field,
25 the binary file associated with the field will be renamed as well. If
26 move_data is zero, no changes will be made to the binary file. If
27 field_code specifies a field of type other than RAW, the move_data flag
28 is ignored.
29
30
32 On success, dirfile_rename() returns zero. On error, -1 is returned
33 and the dirfile error is set to a non-zero error value. Possible error
34 values are:
35
36 GD_E_ACCMODE
37 The specified dirfile was opened read-only.
38
39 GD_E_ALLOC
40 The library was unable to allocate memory.
41
42 GD_E_BAD_CODE
43 The field specified by old_code was not found.
44
45 GD_E_BAD_DIRFILE
46 The supplied dirfile was invalid.
47
48 GD_E_BAD_FIELD_TYPE
49 An attempt was made to rename the immutable INDEX field.
50
51 GD_E_BAD_REPR
52 The representation suffix specified in field_code was not
53 recognised.
54
55 GD_E_DUPLICATE
56 The new name specified is already in use by another field.
57
58 GD_E_PROTECTED
59 The metadata of the format file fragment containing the field
60 was protected from change, or the binary data of the fragments
61 was protected from change and binary file translation was re‐
62 quested.
63
64 GD_E_RAW_IO
65 An I/O error occurred while attempting to rename the binary
66 file.
67
68 GD_E_UNKNOWN_ENCODING
69 The encoding scheme of the specified field could not be deter‐
70 mined or was not understood by GetData.
71
72 GD_E_UNSUPPORTED
73 The encoding scheme of the field does not support binary file
74 renaming.
75
76 The dirfile error may be retrieved by calling get_error(3). A descrip‐
77 tive error string for the last error encountered can be obtained from a
78 call to get_error_string(3).
79
81 dirfile_metaflush(3), dirfile_open(3), get_error(3), get_er‐
82 ror_string(3), dirfile(5), dirfile-format(5)
83
84
85
86Version 0.6.0 19 October 2009 dirfile_rename(3)