1dirfile_validate(3)                 GETDATA                dirfile_validate(3)
2
3
4

NAME

6       dirfile_validate — check a dirfile field code for validity
7

SYNOPSIS

9       #include <getdata.h>
10
11       int dirfile_validate(DIRFILE *dirfile, const char *field_code);
12

DESCRIPTION

14       The dirfile_validate() function queries a dirfile(5) database specified
15       by dirfile and checks whether field_code, which may contain a represen‐
16       tation suffix, specifies a valid field.
17
18       The  dirfile  argument  must point to a valid DIRFILE object previously
19       created by a call to dirfile_open(3).
20
21       This function checks whether the field and its input  fields  (if  any)
22       are found, whether the representation suffix (if any) is valid, and al‐
23       so that all non-literal scalar parameters specify valid CONST fields.
24
25

RETURN VALUE

27       If all checks pass, dirfile_validate() returns zero.  On error, it  re‐
28       turns  -1 and sets the dirfile error to a non-zero error value.  Possi‐
29       ble error values are:
30
31       GD_E_BAD_CODE
32               The field specified by field_code or one of the fields it  uses
33               as input was not found in the database.
34
35       GD_E_BAD_DIRFILE
36               The supplied dirfile was invalid.
37
38       GD_E_BAD_REPR
39               The  representation  suffix  specified  in  field_code  was not
40               recognised.
41
42       GD_E_BAD_SCALAR
43               A non-literal scalar used in the definition of the field or one
44               of its inputs was not found, or was not a CONST field.
45
46       GD_E_DIMENSION
47               A scalar field was found where a vector field was expected.
48
49       GD_E_RECURSE_LEVEL
50               Too  many  levels of recursion were encountered while trying to
51               resolve field_code.  This usually indicates a  circular  depen‐
52               dency in field specification in the dirfile.
53
54       The dirfile error may be retrieved by calling get_error(3).  A descrip‐
55       tive error string for the last error encountered can be obtained from a
56       call to get_error_string(3).
57

NOTES

59       It  is  not necessary to call this function before passing a field code
60       to another GetData function: all functions  which  accept  field  codes
61       perform these checks themselves.
62

SEE ALSO

64       dirfile(5),    dirfile_open(3),   getdata(3),   get_error(3),   get_er‐
65       ror_string(3)
66
67
68
69Version 0.6.0                   19 October 2009            dirfile_validate(3)
Impressum