1
2
3
4
5
6
7
8
9gd_rewrite_fragment(3)              GETDATA             gd_rewrite_fragment(3)
10
11
12

NAME

14       gd_rewrite_fragment — re-write a Dirfile format specification fragment
15
16

SYNOPSIS

18       #include <getdata.h>
19
20       int gd_rewrite_fragment(DIRFILE *dirfile, int fragment);
21
22

DESCRIPTION

24       The  gd_rewrite_fragment()  writes  the  format  specification fragment
25       specified by fragment to disk, regardless of whether it has changed  or
26       not, overwriting the existing file.
27
28       In  addition  to being simply a valid fragment index, fragment may also
29       be the special value GD_ALL_FRAGMENTS, which indicates that  all  frag‐
30       ments should be rewritten.
31
32       Metadata  is  written  to  disk  using the current Standards Version as
33       stored in the dirfile object.  See gd_dirfile_standards(3) to change or
34       report the current Standards Version.  If the dirfile metadata conforms
35       to no known Standards Version, a Standards non-compliant fragment  will
36       be written.
37
38

RETURN VALUE

40       On  success,  zero is returned.  On error, a negative-valued error code
41       is returned.  Possible error codes are:
42
43       GD_E_ACCMODE
44               The supplied dirfile was opened in read-only mode.
45
46       GD_E_ALLOC
47               The library was unable to allocate memory.
48
49       GD_E_BAD_DIRFILE
50               The supplied dirfile was invalid.
51
52       GD_E_BAD_INDEX
53               The supplied fragment index was out of range.
54
55       GD_E_IO An I/O error occurred while trying to write  modified  metadata
56               to disk.
57
58       GD_E_LINE_TOO_LONG
59               While  attempting  to  flush modified metadata to disk, a field
60               specification line exceeded the  maximum  allowed  length.   On
61               most  platforms, the maximum length is at least 2**31 bytes, so
62               this typically indicates something pathological happening.
63
64       The error code is also stored in the DIRFILE  object  and  may  be  re‐
65       trieved after this function returns by calling gd_error(3).  A descrip‐
66       tive  error  string  for  the  error  may  be   obtained   by   calling
67       gd_error_string(3).
68
69

BUGS

71       When  writing metadata using Standards Version 4 or earlier, the refer‐
72       ence field may change, owing to the lack of a /REFERENCE directive.   A
73       work-around is to upgrade to Standards Version 5 or later.
74
75

HISTORY

77       The gd_rewrite_fragment() function appeared in GetData-0.7.0.
78
79       In  GetData-0.10.0, the error return from this function changed from -1
80       to a negative-valued error code.
81
82

SEE ALSO

84       gd_close(3), gd_dirfile_standards(3), gd_error(3),  gd_error_string(3),
85       gd_flush(3), gd_metaflush(3), gd_open(3)
86
87
88
89Version 0.10.0                 25 December 2016         gd_rewrite_fragment(3)
Impressum