rendered paste bodybool czor_load_record (struct czor_d *dest)
{
datum key, data;
char *token;
key.dsize = strlen (dest->ascii_hash);
key.dptr = dest->ascii_hash;
data = gdbm_fetch (dbf, key);
if (data.dsize == 0) {
printf ("ERROR: Failed to load record of hash %s\n", dest->ascii_hash);
exit (2);
}
// Data loaded, now convert the ASCII values to respective structure values
token = strtok (data.dptr, ",");
dest->client_version = atoi (token);
token = strtok (NULL, ",");
dest->r_count = atoi (token);
token = strtok (NULL, ",");
dest->r_entered = strtol (token, NULL, 0);
token = strtok (NULL, ",");
dest->r_updated = strtol (token, NULL,0);
token = strtok (NULL, ",");
dest->wl_count = atoi (token);
token = strtok (NULL, ",");
dest->wl_entered = strtol (token, NULL, 0);
token = strtok (NULL, ",");
dest->wl_updated = strtol (token, NULL, 0);
free (data.dptr);
return (TRUE);