diff 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
line wrap: on
line diff
--- a/libutil/dbread.c	Tue Mar 16 23:22:37 2021 +0000
+++ b/libutil/dbread.c	Tue Mar 16 23:37:36 2021 +0000
@@ -67,6 +67,20 @@
 	return 0;
 }
 
+char *
+dbread_find_key_req(dbs, sought_key)
+	struct dbread_state *dbs;
+	char *sought_key;
+{
+	char *val;
+
+	val = dbread_find_key(dbs, sought_key);
+	if (val)
+		return val;
+	fprintf(stderr, "error: card record has no %s field\n", sought_key);
+	return 0;
+}
+
 dbread_find_record(filename, dbs, sought_key, sought_value)
 	char *filename, *sought_key, *sought_value;
 	struct dbread_state *dbs;