]> granicus.if.org Git - file/commitdiff
cleanups for non BSD compilation.
authorChristos Zoulas <christos@zoulas.com>
Mon, 20 Oct 2008 15:14:17 +0000 (15:14 +0000)
committerChristos Zoulas <christos@zoulas.com>
Mon, 20 Oct 2008 15:14:17 +0000 (15:14 +0000)
src/cdf.c
src/cdf_time.c
src/magic.h
src/print.c

index 5620e7897b0b1caa423b29dc89193f56453734db..d914a4460accef198ffb24cae92208402c42921a 100644 (file)
--- a/src/cdf.c
+++ b/src/cdf.c
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <assert.h>
 #include <stdio.h>
+#ifdef CDF_DEBUG
 #include <err.h>
+#endif
 #include <stdlib.h>
 #include <unistd.h>
 #include <errno.h>
 #include <string.h>
 #include <time.h>
 #include <ctype.h>
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
+#endif
+
+#ifndef EFTYPE
+#define EFTYPE EINVAL
+#endif
 
 #include "cdf.h"
 
index 96321fcec703cbc059c27bf94d34c8195311bf8e..dbabae61f898405333e102f20581c6455231afc3 100644 (file)
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <sys/types.h>
 #include <stdio.h>
 #include <time.h>
+#ifdef TEST
 #include <err.h>
+#endif
 #include <string.h>
 #include <errno.h>
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
+#endif
 
 #include "cdf.h"
 
index 5ff78a29b1e60b781321de53bf3fa98b1a13b577..5864f266b3b7240a194a143cb03abee549c1dee6 100644 (file)
@@ -42,7 +42,7 @@
 #define        MAGIC_ERROR             0x000200 /* Handle ENOENT etc as real errors */
 #define        MAGIC_MIME_ENCODING     0x000400 /* Return only the MIME encoding */
 #define MAGIC_MIME             (MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
-#define        MAGIC_APPLE             0x000800 /* Return APPLE CREATOR/TYPE */
+#define        MAGIC_APPLE             0x000800 /* Return the Apple creator and type */
 #define        MAGIC_NO_CHECK_COMPRESS 0x001000 /* Don't check for compressed files */
 #define        MAGIC_NO_CHECK_TAR      0x002000 /* Don't check for tar files */
 #define        MAGIC_NO_CHECK_SOFT     0x004000 /* Don't check magic entries */
index 063a35547cf464a994d2213c93b8c61c635e5086..72a8c1014dfcfba5341b42610ac9f29b3c387606 100644 (file)
@@ -41,7 +41,7 @@
 #include <time.h>
 
 #ifndef lint
-FILE_RCSID("@(#)$File: print.c,v 1.62 2008/02/04 20:51:17 christos Exp $")
+FILE_RCSID("@(#)$File: print.c,v 1.63 2008/02/17 19:28:54 rrt Exp $")
 #endif  /* lint */
 
 #define SZOF(a)        (sizeof(a) / sizeof(a[0]))
@@ -64,7 +64,8 @@ file_mdump(struct magic *m)
                if (m->in_op & FILE_OPINVERSE)
                        (void) fputc('~', stderr);
                (void) fprintf(stderr, "%c%u),",
-                              ((m->in_op & FILE_OPS_MASK) < SZOF(optyp)) ? 
+                              ((size_t)(m->in_op & FILE_OPS_MASK) <
+                              SZOF(optyp)) ? 
                                        optyp[m->in_op & FILE_OPS_MASK] : '?',
                                m->in_offset);
        }
@@ -93,7 +94,7 @@ file_mdump(struct magic *m)
                        (void) fprintf(stderr, "/%u", m->str_range);
        }
        else {
-               if ((m->mask_op & FILE_OPS_MASK) < SZOF(optyp))
+               if ((size_t)(m->mask_op & FILE_OPS_MASK) < SZOF(optyp))
                        (void) fputc(optyp[m->mask_op & FILE_OPS_MASK], stderr);
                else
                        (void) fputc('?', stderr);