summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2016-08-22 16:07:16 +0000
committerIngo Schwarze <schwarze@openbsd.org>2016-08-22 16:07:16 +0000
commit1c6894f509f4d5465a9c42324e61b4af5dabb3b9 (patch)
treea2bda16459077490c4c7a91a74c63bc67152f156
parenta47c2723999e135348912a7c9c9b2060866c3a44 (diff)
downloadmandoc-1c6894f509f4d5465a9c42324e61b4af5dabb3b9.tar.gz
When running into a mandoc.db(5) file still using the obsolete
format based on SQLite 3, say so in words that mortals can understand rather than babbling about hex magic. Suggested by espie@.
-rw-r--r--dbm_map.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/dbm_map.c b/dbm_map.c
index b4d5bb80..2d1315f6 100644
--- a/dbm_map.c
+++ b/dbm_map.c
@@ -80,8 +80,14 @@ dbm_map(const char *fname)
goto fail;
magic = dbm_getint(0);
if (be32toh(*magic) != MANDOCDB_MAGIC) {
- warnx("dbm_map(%s): Bad initial magic %x (expected %x)",
- fname, be32toh(*magic), MANDOCDB_MAGIC);
+ if (strncmp(dbm_base, "SQLite format 3", 15))
+ warnx("dbm_map(%s): "
+ "Bad initial magic %x (expected %x)",
+ fname, be32toh(*magic), MANDOCDB_MAGIC);
+ else
+ warnx("dbm_map(%s): "
+ "Obsolete format based on SQLite 3",
+ fname);
errno = EFTYPE;
goto fail;
}