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

NAME

14       gd_validate — check a Dirfile field code for validity
15
16

SYNOPSIS

18       #include <getdata.h>
19
20       int gd_validate(DIRFILE *dirfile, const char *field_code);
21
22

DESCRIPTION

24       The  gd_validate()  function queries a dirfile(5) database specified by
25       dirfile and checks whether field_code, which may contain a  representa‐
26       tion suffix, specifies a valid field.
27
28       The  dirfile  argument  must point to a valid DIRFILE object previously
29       created by a call to gd_open(3).
30
31       This function checks whether the field and its input  fields  (if  any)
32       are  found,  and  also  that  all  non-literal parameters specify valid
33       scalar fields.
34
35

RETURN VALUE

37       If all checks pass, gd_validate() returns zero.  On error, it returns a
38       negative-valued error code.  Possible error codes are:
39
40       GD_E_BAD_CODE
41               The  field specified by field_code or one of the fields it uses
42               as input was not found in the database.
43
44       GD_E_BAD_DIRFILE
45               The supplied dirfile was invalid.
46
47       GD_E_BAD_SCALAR
48               A non-literal scalar used in the definition of the field or one
49               of  its  inputs  was  not  found,  or was not a CONST or CARRAY
50               field.
51
52       GD_E_DIMENSION
53               A scalar field was found where a vector field was expected.
54
55       The error code is also stored in the DIRFILE  object  and  may  be  re‐
56       trieved after this function returns by calling gd_error(3).  A descrip‐
57       tive  error  string  for  the  error  may  be   obtained   by   calling
58       gd_error_string(3).
59
60

NOTES

62       It  is  not necessary to call this function before passing a field code
63       to another GetData function: all functions  which  accept  field  codes
64       perform these checks themselves.
65
66

HISTORY

68       The dirfile_validate(3) function appared in GetData-0.6.0.
69
70       In GetData-0.7.0, this function was renamed to gd_validate(3).
71
72       In  GetData-0.10.0, the error return from this function changed from -1
73       to a negative-valued error code.
74
75

SEE ALSO

77       gd_error(3), gd_error_string(3), gd_getdata(3), gd_open(3), dirfile(5)
78
79
80
81Version 0.10.0                 25 December 2016                 gd_validate(3)
Impressum