=head1 NAME dbfp_init - initialize the metadata for queries to the DB timetable API =head1 SYNOPSIS #include int dbfp_init(struct dbfp *dbfp, char *key); =head1 DESCRIPTION B initializes a I structure that stores the metadata for queries to the DB timetable API. I is the API key to use for the connections. I must already be allocated. I and I must not be NULL. I is copied to the structure, so it can be changed or freed after calling this function. B is a structure defined as: struct dbfp { char *key; CURL *curl; }; The user does not have to deal with the fields of this structure. I structures initialized with this method should be closed by calling B. =head1 RETURN VALUE B returns zero if successful, or a non-zero error code. Positive error codes are from I, negative error codes are specific to dbfp. =head1 ERRORS =over =item EINVAL if I or I is NULL =item ENOMEM if there is not enoguh memory to copy I to I =item DBFP_ERROR_CURL if curl could not be initialized =back =head1 EXAMPLE #include #include #include #include int main(int argc, char **argv) { struct dbfp dbfp; int err; err = dbfp_init(&dbfp, "API key"); if (!err) printf("DBFP structure created.\n"); else printf("Could not create DBFP: %s\n", strerror(err)); dbfp_close(&dbfp); return err ? EXIT_FAILURE : EXIT_SUCCESS; } =head1 SEE ALSO L, L, L