summaryrefslogtreecommitdiffstats
path: root/contrib/file/apprentice.c
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2001-04-25 07:41:21 +0000
committerobrien <obrien@FreeBSD.org>2001-04-25 07:41:21 +0000
commit30980cd72da9ade33a9b331e58e75660d180a109 (patch)
tree000ebc599c417e0830db5f66711d1e99a3edfdcb /contrib/file/apprentice.c
parentfd87285c4e3e4e4fbf7112229c209a1c6ea64494 (diff)
downloadFreeBSD-src-30980cd72da9ade33a9b331e58e75660d180a109.zip
FreeBSD-src-30980cd72da9ade33a9b331e58e75660d180a109.tar.gz
Virgin import of Christos Zoulas's FILE 3.35.
Diffstat (limited to 'contrib/file/apprentice.c')
-rw-r--r--contrib/file/apprentice.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/contrib/file/apprentice.c b/contrib/file/apprentice.c
index f9225e7..4cc703d 100644
--- a/contrib/file/apprentice.c
+++ b/contrib/file/apprentice.c
@@ -38,14 +38,30 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$Id: apprentice.c,v 1.34 2001/03/11 20:29:16 christos Exp $")
+FILE_RCSID("@(#)$Id: apprentice.c,v 1.39 2001/04/24 14:40:24 christos Exp $")
#endif /* lint */
#define EATAB {while (isascii((unsigned char) *l) && \
isspace((unsigned char) *l)) ++l;}
#define LOWCASE(l) (isupper((unsigned char) (l)) ? \
tolower((unsigned char) (l)) : (l))
+/*
+ * Work around a bug in headers on Digital Unix.
+ * At least confirmed for: OSF1 V4.0 878
+ */
+#if defined(__osf__) && defined(__DECC)
+#ifdef MAP_FAILED
+#undef MAP_FAILED
+#endif
+#endif
+#ifndef MAP_FAILED
+#define MAP_FAILED (void *) -1
+#endif
+
+#ifndef MAP_FILE
+#define MAP_FILE 0
+#endif
#ifdef __EMX__
char PATHSEP=';';
@@ -798,6 +814,7 @@ apprentice_map(magicp, nmagicp, fn, action)
goto error;
}
(void)close(fd);
+ fd = -1;
ptr = (uint32 *) *magicp;
if (*ptr != MAGICNO) {
if (swap4(*ptr) != MAGICNO) {
@@ -815,7 +832,7 @@ apprentice_map(magicp, nmagicp, fn, action)
if (version != VERSIONNO) {
(void)fprintf(stderr,
"%s: version mismatch (%d != %d) in `%s'\n",
- progname, version, VERSION, dbname);
+ progname, version, VERSIONNO, dbname);
goto error;
}
*nmagicp = (st.st_size / sizeof(struct magic)) - 1;
OpenPOWER on IntegriCloud