From c26c9404a86ae9cea970519f045969623c2760b0 Mon Sep 17 00:00:00 2001 From: schwarze Date: Mon, 22 Aug 2016 16:05:56 +0000 Subject: [PATCH] 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@. --- usr.bin/mandoc/dbm_map.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/usr.bin/mandoc/dbm_map.c b/usr.bin/mandoc/dbm_map.c index 4c81197a91a..ce1e0660b76 100644 --- a/usr.bin/mandoc/dbm_map.c +++ b/usr.bin/mandoc/dbm_map.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dbm_map.c,v 1.1 2016/08/01 10:32:39 schwarze Exp $ */ +/* $OpenBSD: dbm_map.c,v 1.2 2016/08/22 16:05:56 schwarze Exp $ */ /* * Copyright (c) 2016 Ingo Schwarze * @@ -70,8 +70,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; } -- 2.20.1