FreeCalypso > hg > fc-sim-tools
comparison libutil/dbread.c @ 28:fa81221ac9b6
retrieval of required db fields moved into libutil
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 16 Mar 2021 23:37:36 +0000 |
parents | ca8a6f95826a |
children |
comparison
equal
deleted
inserted
replaced
27:ca8a6f95826a | 28:fa81221ac9b6 |
---|---|
65 if (!strcasecmp(dbs->kv_pairs[n].key, sought_key)) | 65 if (!strcasecmp(dbs->kv_pairs[n].key, sought_key)) |
66 return dbs->kv_pairs[n].value; | 66 return dbs->kv_pairs[n].value; |
67 return 0; | 67 return 0; |
68 } | 68 } |
69 | 69 |
70 char * | |
71 dbread_find_key_req(dbs, sought_key) | |
72 struct dbread_state *dbs; | |
73 char *sought_key; | |
74 { | |
75 char *val; | |
76 | |
77 val = dbread_find_key(dbs, sought_key); | |
78 if (val) | |
79 return val; | |
80 fprintf(stderr, "error: card record has no %s field\n", sought_key); | |
81 return 0; | |
82 } | |
83 | |
70 dbread_find_record(filename, dbs, sought_key, sought_value) | 84 dbread_find_record(filename, dbs, sought_key, sought_value) |
71 char *filename, *sought_key, *sought_value; | 85 char *filename, *sought_key, *sought_value; |
72 struct dbread_state *dbs; | 86 struct dbread_state *dbs; |
73 { | 87 { |
74 FILE *inf; | 88 FILE *inf; |