From 42015f0462e8f1b2292a48455ce740a627c14025 Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Sat, 15 Dec 2012 21:40:26 +0200 Subject: Implement map lookup functions in forlan. * lib/forlan.c: New functions "has_map" and "lookup". * lib/map.c (eclat_map_open): Don't issue error message if failed to open the map. Leave that to the caller. * src/util.c (translate_ids) (translate_resource_ids): Issue an error message if eclat_map_open fails. --- src/util.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/util.c') diff --git a/src/util.c b/src/util.c index 9e90ca5..a4a5834 100644 --- a/src/util.c +++ b/src/util.c @@ -42,10 +42,11 @@ translate_ids(int argc, char **argv, const char *mapname) map = eclat_map_lookup(realname); if (!map) die(EX_UNAVAILABLE, "no such map: %s", realname); - free(realname); if (eclat_map_open(map) != eclat_map_ok) - exit(EX_UNAVAILABLE); + die(EX_UNAVAILABLE, "failed to open map %s", realname); + + free(realname); for (i = 0; i < argc; i++) { if (!strchr(argv[i], '=')) { @@ -101,7 +102,8 @@ translate_resource_ids(int argc, char **argv) die(EX_UNAVAILABLE, "no such map: %s", ws.ws_wordv[j]); if (eclat_map_open(map) != eclat_map_ok) - exit(EX_UNAVAILABLE); + die(EX_UNAVAILABLE, + "failed to open map %s", ws.ws_wordv[j]); rc = eclat_map_get(map, MAP_DIR, p, &val); if (rc != eclat_map_ok) { die(EX_UNAVAILABLE, -- cgit v1.2.1