diff options
author | Christos Zoulas <christos@zoulas.com> | 2007-12-27 20:52:35 +0000 |
---|---|---|
committer | Christos Zoulas <christos@zoulas.com> | 2007-12-27 20:52:35 +0000 |
commit | f1b977305fee6edc0a49b9850213ded06c67d07f (patch) | |
tree | 87f52f903bfc651909fb80e5a37f476c2541a78d | |
parent | 6503b00dd1dbfb3df7a31d07dd44d55bc0588eda (diff) | |
download | file-git-f1b977305fee6edc0a49b9850213ded06c67d07f.tar.gz |
- deal with missing strtof
- better version mispatch print
-rw-r--r-- | config.h.in | 3 | ||||
-rwxr-xr-x | configure | 3 | ||||
-rw-r--r-- | configure.in | 2 | ||||
-rw-r--r-- | src/apprentice.c | 12 |
4 files changed, 15 insertions, 5 deletions
diff --git a/config.h.in b/config.h.in index a745cf13..281a4e40 100644 --- a/config.h.in +++ b/config.h.in @@ -72,6 +72,9 @@ /* Define to 1 if you have the `strndup' function. */ #undef HAVE_STRNDUP +/* Define to 1 if you have the `strtof' function. */ +#undef HAVE_STRTOF + /* Define to 1 if you have the `strtoul' function. */ #undef HAVE_STRTOUL @@ -23398,7 +23398,8 @@ _ACEOF -for ac_func in mmap strerror strndup strtoul mbrtowc mkstemp getopt_long utimes utime wcwidth snprintf vsnprintf + +for ac_func in mmap strerror strndup strtoul mbrtowc mkstemp getopt_long utimes utime wcwidth snprintf vsnprintf strtof do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_func" >&5 diff --git a/configure.in b/configure.in index d5e6ca56..8af5dafc 100644 --- a/configure.in +++ b/configure.in @@ -127,7 +127,7 @@ AC_CHECK_SIZEOF_STDC_HEADERS(int64_t, 0) AC_CHECK_SIZEOF_STDC_HEADERS(uint64_t, 0) dnl Checks for functions -AC_CHECK_FUNCS(mmap strerror strndup strtoul mbrtowc mkstemp getopt_long utimes utime wcwidth snprintf vsnprintf) +AC_CHECK_FUNCS(mmap strerror strndup strtoul mbrtowc mkstemp getopt_long utimes utime wcwidth snprintf vsnprintf strtof) dnl Checks for libraries AC_CHECK_LIB(z,gzopen) diff --git a/src/apprentice.c b/src/apprentice.c index b9b2b222..24223c28 100644 --- a/src/apprentice.c +++ b/src/apprentice.c @@ -31,6 +31,7 @@ #include "file.h" #include "magic.h" +#include "patchlevel.h" #include <stdlib.h> #ifdef HAVE_UNISTD_H #include <unistd.h> @@ -46,7 +47,7 @@ #endif #ifndef lint -FILE_RCSID("@(#)$File: apprentice.c,v 1.107 2007/11/08 00:31:37 christos Exp $") +FILE_RCSID("@(#)$File: apprentice.c,v 1.108 2007/12/27 16:35:58 christos Exp $") #endif /* lint */ #define EATAB {while (isascii((unsigned char) *l) && \ @@ -1418,7 +1419,11 @@ getvalue(struct magic_set *ms, struct magic *m, const char **p, int action) case FILE_LEFLOAT: if (m->reln != 'x') { char *ep; +#ifdef HAVE_STRTOF m->value.f = strtof(*p, &ep); +#else + m->value.f = (float)strtod(*p, &ep); +#endif *p = ep; } return 0; @@ -1758,8 +1763,9 @@ apprentice_map(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp, else version = ptr[1]; if (version != VERSIONNO) { - file_error(ms, 0, "version mismatch (%d != %d) in `%s'", - version, VERSIONNO, dbname); + file_error(ms, 0, "File %d.%d supports only %d version magic " + "files. `%s' is version %d", FILE_VERSION_MAJOR, patchlevel, + VERSIONNO, dbname, version); goto error; } *nmagicp = (uint32_t)(st.st_size / sizeof(struct magic)) - 1; |