- fix pointer casts.
- only first error is kept.
-# Makefile.in generated by automake 1.7.3 from Makefile.am.
-# @configure_input@
+# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
-# Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
-@SET_MAKE@
+
+SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+
+DESTDIR =
+
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
+
top_builddir = ..
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
INSTALL = @INSTALL@
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
+INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+transform = @program_transform_name@
+
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
+host_alias = @host_alias@
host_triplet = @host@
-ACLOCAL = @ACLOCAL@
-AMDEP_FALSE = @AMDEP_FALSE@
-AMDEP_TRUE = @AMDEP_TRUE@
+AMDEPBACKSLASH = @AMDEPBACKSLASH@
AMTAR = @AMTAR@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
+AS = @AS@
AWK = @AWK@
CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
DEPDIR = @DEPDIR@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
+DLLTOOL = @DLLTOOL@
EXEEXT = @EXEEXT@
-FSECT5_FALSE = @FSECT5_FALSE@
-FSECT5_TRUE = @FSECT5_TRUE@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
+GCJ = @GCJ@
+GCJFLAGS = @GCJFLAGS@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LDFLAGS = @LDFLAGS@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
-LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
+OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_RANLIB = @ac_ct_RANLIB@
-ac_ct_STRIP = @ac_ct_STRIP@
-am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
-am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-datadir = @datadir@
-exec_prefix = @exec_prefix@
fsect = @fsect@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-includedir = @includedir@
-infodir = @infodir@
install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localstatedir = @localstatedir@
-mandir = @mandir@
-oldincludedir = @oldincludedir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-sysconfdir = @sysconfdir@
-target_alias = @target_alias@
+
MAGIC = $(pkgdatadir)/magic
lib_LTLIBRARIES = libmagic.la
include_HEADERS = magic.h
file_SOURCES = file.c
file_LDFLAGS = -lmagic
-subdir = src
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
-CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES =
-LTLIBRARIES = $(lib_LTLIBRARIES)
-
-libmagic_la_LIBADD =
-am_libmagic_la_OBJECTS = magic.lo apprentice.lo softmagic.lo ascmagic.lo \
- compress.lo is_tar.lo readelf.lo print.lo fsmagic.lo funcs.lo \
- apptype.lo
-libmagic_la_OBJECTS = $(am_libmagic_la_OBJECTS)
-bin_PROGRAMS = file$(EXEEXT)
-PROGRAMS = $(bin_PROGRAMS)
-
-am_file_OBJECTS = file.$(OBJEXT)
-file_OBJECTS = $(am_file_OBJECTS)
+CONFIG_HEADER = ../config.h ../$@)]
+CONFIG_CLEAN_FILES =
+LTLIBRARIES = $(lib_LTLIBRARIES)
+
+
+DEFS = @DEFS@ -I. -I$(srcdir) -I.. -I..
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+libmagic_la_LIBADD =
+libmagic_la_OBJECTS = magic.lo apprentice.lo softmagic.lo ascmagic.lo \
+compress.lo is_tar.lo readelf.lo print.lo fsmagic.lo funcs.lo \
+apptype.lo
+bin_PROGRAMS = file$(EXEEXT)
+PROGRAMS = $(bin_PROGRAMS)
+
+file_OBJECTS = file.$(OBJEXT)
file_LDADD = $(LDADD)
-file_DEPENDENCIES =
-
-DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
-depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
-@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/apprentice.Plo \
-@AMDEP_TRUE@ ./$(DEPDIR)/apptype.Plo ./$(DEPDIR)/ascmagic.Plo \
-@AMDEP_TRUE@ ./$(DEPDIR)/compress.Plo ./$(DEPDIR)/file.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/fsmagic.Plo ./$(DEPDIR)/funcs.Plo \
-@AMDEP_TRUE@ ./$(DEPDIR)/is_tar.Plo ./$(DEPDIR)/magic.Plo \
-@AMDEP_TRUE@ ./$(DEPDIR)/print.Plo ./$(DEPDIR)/readelf.Plo \
-@AMDEP_TRUE@ ./$(DEPDIR)/softmagic.Plo
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
- $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \
- $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+file_DEPENDENCIES =
+CFLAGS = @CFLAGS@
+COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
-LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(AM_LDFLAGS) $(LDFLAGS) -o $@
-DIST_SOURCES = $(libmagic_la_SOURCES) $(file_SOURCES)
-HEADERS = $(include_HEADERS)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
+HEADERS = $(include_HEADERS)
+
+DIST_COMMON = Makefile.am Makefile.in
-DIST_COMMON = $(include_HEADERS) Makefile.am Makefile.in
-SOURCES = $(libmagic_la_SOURCES) $(file_SOURCES)
-all: all-am
+DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
+TAR = gtar
+GZIP_ENV = --best
+DEP_FILES = .deps/apprentice.P .deps/apptype.P .deps/ascmagic.P \
+.deps/compress.P .deps/file.P .deps/fsmagic.P .deps/funcs.P \
+.deps/is_tar.P .deps/magic.P .deps/print.P .deps/readelf.P \
+.deps/softmagic.P
+SOURCES = $(libmagic_la_SOURCES) $(file_SOURCES)
+OBJECTS = $(libmagic_la_OBJECTS) $(file_OBJECTS)
+
+all: all-redirect
.SUFFIXES:
-.SUFFIXES: .c .lo .o .obj
-$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
- cd $(top_srcdir) && \
- $(AUTOMAKE) --gnu src/Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
-libLTLIBRARIES_INSTALL = $(INSTALL)
+.SUFFIXES: .S .c .lo .o .obj .s
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile
+
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
+ cd $(top_builddir) \
+ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+
+mostlyclean-libLTLIBRARIES:
+
+clean-libLTLIBRARIES:
+ -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+
+distclean-libLTLIBRARIES:
+
+maintainer-clean-libLTLIBRARIES:
+
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(libdir)
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
- f="`echo $$p | sed -e 's|^.*/||'`"; \
- echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f"; \
- $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f; \
+ echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p"; \
+ $(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p; \
else :; fi; \
done
uninstall-libLTLIBRARIES:
@$(NORMAL_UNINSTALL)
- @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
- p="`echo $$p | sed -e 's|^.*/||'`"; \
- echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p"; \
- $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \
+ list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \
done
-clean-libLTLIBRARIES:
- -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
- @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
- dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
- test "$$dir" = "$$p" && dir=.; \
- echo "rm -f \"$${dir}/so_locations\""; \
- rm -f "$${dir}/so_locations"; \
- done
-libmagic.la: $(libmagic_la_OBJECTS) $(libmagic_la_DEPENDENCIES)
- $(LINK) -rpath $(libdir) $(libmagic_la_LDFLAGS) $(libmagic_la_OBJECTS) $(libmagic_la_LIBADD) $(LIBS)
-binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
-install-binPROGRAMS: $(bin_PROGRAMS)
- @$(NORMAL_INSTALL)
- $(mkinstalldirs) $(DESTDIR)$(bindir)
- @list='$(bin_PROGRAMS)'; for p in $$list; do \
- p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
- if test -f $$p \
- || test -f $$p1 \
- ; then \
- f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
- echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \
- $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f || exit 1; \
- else :; fi; \
- done
+# FIXME: We should only use cygpath when building on Windows,
+# and only if it is available.
+.c.obj:
+ $(COMPILE) -c `cygpath -w $<`
-uninstall-binPROGRAMS:
- @$(NORMAL_UNINSTALL)
- @list='$(bin_PROGRAMS)'; for p in $$list; do \
- f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
- echo " rm -f $(DESTDIR)$(bindir)/$$f"; \
- rm -f $(DESTDIR)$(bindir)/$$f; \
- done
+.s.o:
+ $(COMPILE) -c $<
-clean-binPROGRAMS:
- @list='$(bin_PROGRAMS)'; for p in $$list; do \
- f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
- echo " rm -f $$p $$f"; \
- rm -f $$p $$f ; \
- done
-file$(EXEEXT): $(file_OBJECTS) $(file_DEPENDENCIES)
- @rm -f file$(EXEEXT)
- $(LINK) $(file_LDFLAGS) $(file_OBJECTS) $(file_LDADD) $(LIBS)
+.S.o:
+ $(COMPILE) -c $<
mostlyclean-compile:
- -rm -f *.$(OBJEXT) core *.core
+ -rm -f *.o core *.core
+ -rm -f *.$(OBJEXT)
+
+clean-compile:
distclean-compile:
-rm -f *.tab.c
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/apprentice.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/apptype.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ascmagic.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compress.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsmagic.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/funcs.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/is_tar.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/magic.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/readelf.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/softmagic.Plo@am__quote@
+maintainer-clean-compile:
-distclean-depend:
- -rm -rf ./$(DEPDIR)
-
-.c.o:
-@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
-@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
-@am__fastdepCC_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
-@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
-@am__fastdepCC_TRUE@ fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$<
+.s.lo:
+ $(LIBTOOL) --mode=compile $(COMPILE) -c $<
-.c.obj:
-@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
-@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
-@am__fastdepCC_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
-@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
-@am__fastdepCC_TRUE@ fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
-
-.c.lo:
-@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
-@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
-@am__fastdepCC_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \
-@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
-@am__fastdepCC_TRUE@ fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
+.S.lo:
+ $(LIBTOOL) --mode=compile $(COMPILE) -c $<
mostlyclean-libtool:
-rm -f *.lo
-rm -rf .libs _libs
distclean-libtool:
- -rm -f libtool
-uninstall-info-am:
-includeHEADERS_INSTALL = $(INSTALL_HEADER)
+
+maintainer-clean-libtool:
+
+libmagic.la: $(libmagic_la_OBJECTS) $(libmagic_la_DEPENDENCIES)
+ $(LINK) -rpath $(libdir) $(libmagic_la_LDFLAGS) $(libmagic_la_OBJECTS) $(libmagic_la_LIBADD) $(LIBS)
+
+mostlyclean-binPROGRAMS:
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+
+distclean-binPROGRAMS:
+
+maintainer-clean-binPROGRAMS:
+
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ $(mkinstalldirs) $(DESTDIR)$(bindir)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ if test -f $$p; then \
+ echo " $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
+ $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ list='$(bin_PROGRAMS)'; for p in $$list; do \
+ rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
+ done
+
+file$(EXEEXT): $(file_OBJECTS) $(file_DEPENDENCIES)
+ @rm -f file$(EXEEXT)
+ $(LINK) $(file_LDFLAGS) $(file_OBJECTS) $(file_LDADD) $(LIBS)
+
install-includeHEADERS: $(include_HEADERS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(includedir)
@list='$(include_HEADERS)'; for p in $$list; do \
- if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
- f="`echo $$p | sed -e 's|^.*/||'`"; \
- echo " $(includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(includedir)/$$f"; \
- $(includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(includedir)/$$f; \
+ if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \
+ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p"; \
+ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p; \
done
uninstall-includeHEADERS:
@$(NORMAL_UNINSTALL)
- @list='$(include_HEADERS)'; for p in $$list; do \
- f="`echo $$p | sed -e 's|^.*/||'`"; \
- echo " rm -f $(DESTDIR)$(includedir)/$$f"; \
- rm -f $(DESTDIR)$(includedir)/$$f; \
+ list='$(include_HEADERS)'; for p in $$list; do \
+ rm -f $(DESTDIR)$(includedir)/$$p; \
done
-ETAGS = etags
-ETAGSFLAGS =
-
-CTAGS = ctags
-CTAGSFLAGS =
-
tags: TAGS
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) ' { files[$$0] = 1; } \
+ID: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS)'; \
+ unique=`for i in $$list; do echo $$i; done | \
+ awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
- mkid -fID $$unique
+ here=`pwd` && cd $(srcdir) \
+ && mkid -f$$here/ID $$unique $(LISP)
-TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
tags=; \
here=`pwd`; \
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) ' { files[$$0] = 1; } \
+ list='$(SOURCES) $(HEADERS)'; \
+ unique=`for i in $$list; do echo $$i; done | \
+ awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
- test -z "$(ETAGS_ARGS)$$tags$$unique" \
- || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$tags $$unique
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
-ctags: CTAGS
-CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- tags=; \
- here=`pwd`; \
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) ' { files[$$0] = 1; } \
- END { for (i in files) print i; }'`; \
- test -z "$(CTAGS_ARGS)$$tags$$unique" \
- || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$tags $$unique
+mostlyclean-tags:
-GTAGS:
- here=`$(am__cd) $(top_builddir) && pwd` \
- && cd $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) $$here
+clean-tags:
distclean-tags:
- -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ -rm -f TAGS ID
+
+maintainer-clean-tags:
-top_distdir = ..
-distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
+
+subdir = src
distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
- list='$(DISTFILES)'; for file in $$list; do \
- case $$file in \
- $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
- $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
- esac; \
- if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
- dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test "$$dir" != "$$file" && test "$$dir" != "."; then \
- dir="/$$dir"; \
- $(mkinstalldirs) "$(distdir)$$dir"; \
- else \
- dir=''; \
- fi; \
+ here=`cd $(top_builddir) && pwd`; \
+ top_distdir=`cd $(top_distdir) && pwd`; \
+ distdir=`cd $(distdir) && pwd`; \
+ cd $(top_srcdir) \
+ && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu src/Makefile
+ @for file in $(DISTFILES); do \
+ d=$(srcdir); \
if test -d $$d/$$file; then \
- if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
- fi; \
- cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ cp -pr $$d/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
- || cp -p $$d/$$file $(distdir)/$$file \
- || exit 1; \
+ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+ || cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
-check-am: all-am
-check: check-am
-all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS)
-install-binPROGRAMS: install-libLTLIBRARIES
+DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
-installdirs:
- $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(bindir) $(DESTDIR)$(includedir)
+-include $(DEP_FILES)
-install: install-am
+mostlyclean-depend:
+
+clean-depend:
+
+distclean-depend:
+ -rm -rf .deps
+
+maintainer-clean-depend:
+
+%.o: %.c
+ @echo '$(COMPILE) -c $<'; \
+ $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
+ @-cp .deps/$(*F).pp .deps/$(*F).P; \
+ tr ' ' '\012' < .deps/$(*F).pp \
+ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
+ >> .deps/$(*F).P; \
+ rm .deps/$(*F).pp
+
+%.lo: %.c
+ @echo '$(LTCOMPILE) -c $<'; \
+ $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
+ @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
+ < .deps/$(*F).pp > .deps/$(*F).P; \
+ tr ' ' '\012' < .deps/$(*F).pp \
+ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
+ >> .deps/$(*F).P; \
+ rm -f .deps/$(*F).pp
+info-am:
+info: info-am
+dvi-am:
+dvi: dvi-am
+check-am: all-am
+check: check-am
+installcheck-am:
+installcheck: installcheck-am
+install-exec-am: install-libLTLIBRARIES install-binPROGRAMS
install-exec: install-exec-am
+
+install-data-am: install-includeHEADERS
install-data: install-data-am
-uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
+install: install-am
+uninstall-am: uninstall-libLTLIBRARIES uninstall-binPROGRAMS \
+ uninstall-includeHEADERS
+uninstall: uninstall-am
+all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS)
+all-redirect: all-am
install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+ $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
+installdirs:
+ $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(bindir) \
+ $(DESTDIR)$(includedir)
+
+
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
+ -rm -f config.cache config.log stamp-h stamp-h[0-9]*
maintainer-clean-generic:
- @echo "This command is intended for maintainers to use"
- @echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
-
-clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \
- clean-libtool mostlyclean-am
-
-distclean: distclean-am
+mostlyclean-am: mostlyclean-libLTLIBRARIES mostlyclean-compile \
+ mostlyclean-libtool mostlyclean-binPROGRAMS \
+ mostlyclean-tags mostlyclean-depend mostlyclean-generic
-distclean-am: clean-am distclean-compile distclean-depend \
- distclean-generic distclean-libtool distclean-tags
-
-dvi: dvi-am
-
-dvi-am:
-
-info: info-am
-
-info-am:
+mostlyclean: mostlyclean-am
-install-data-am: install-includeHEADERS
+clean-am: clean-libLTLIBRARIES clean-compile clean-libtool \
+ clean-binPROGRAMS clean-tags clean-depend clean-generic \
+ mostlyclean-am
-install-exec-am: install-binPROGRAMS install-libLTLIBRARIES
+clean: clean-am
-install-info: install-info-am
+distclean-am: distclean-libLTLIBRARIES distclean-compile \
+ distclean-libtool distclean-binPROGRAMS distclean-tags \
+ distclean-depend distclean-generic clean-am
+ -rm -f libtool
-install-man:
+distclean: distclean-am
-installcheck-am:
+maintainer-clean-am: maintainer-clean-libLTLIBRARIES \
+ maintainer-clean-compile maintainer-clean-libtool \
+ maintainer-clean-binPROGRAMS maintainer-clean-tags \
+ maintainer-clean-depend maintainer-clean-generic \
+ distclean-am
+ @echo "This command is intended for maintainers to use;"
+ @echo "it deletes files that may require special tools to rebuild."
maintainer-clean: maintainer-clean-am
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
- mostlyclean-libtool
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am: uninstall-binPROGRAMS uninstall-includeHEADERS \
- uninstall-info-am uninstall-libLTLIBRARIES
+.PHONY: mostlyclean-libLTLIBRARIES distclean-libLTLIBRARIES \
+clean-libLTLIBRARIES maintainer-clean-libLTLIBRARIES \
+uninstall-libLTLIBRARIES install-libLTLIBRARIES mostlyclean-compile \
+distclean-compile clean-compile maintainer-clean-compile \
+mostlyclean-libtool distclean-libtool clean-libtool \
+maintainer-clean-libtool mostlyclean-binPROGRAMS distclean-binPROGRAMS \
+clean-binPROGRAMS maintainer-clean-binPROGRAMS uninstall-binPROGRAMS \
+install-binPROGRAMS uninstall-includeHEADERS install-includeHEADERS \
+tags mostlyclean-tags distclean-tags clean-tags maintainer-clean-tags \
+distdir mostlyclean-depend distclean-depend clean-depend \
+maintainer-clean-depend info-am info dvi-am dvi check check-am \
+installcheck-am installcheck install-exec-am install-exec \
+install-data-am install-data install-am install uninstall-am uninstall \
+all-redirect all-am all installdirs mostlyclean-generic \
+distclean-generic clean-generic maintainer-clean-generic clean \
+mostlyclean distclean maintainer-clean
-.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
- clean-generic clean-libLTLIBRARIES clean-libtool ctags \
- distclean distclean-compile distclean-depend distclean-generic \
- distclean-libtool distclean-tags distdir dvi dvi-am info \
- info-am install install-am install-binPROGRAMS install-data \
- install-data-am install-exec install-exec-am \
- install-includeHEADERS install-info install-info-am \
- install-libLTLIBRARIES install-man install-strip installcheck \
- installcheck-am installdirs maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-compile \
- mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
- tags uninstall uninstall-am uninstall-binPROGRAMS \
- uninstall-includeHEADERS uninstall-info-am \
- uninstall-libLTLIBRARIES
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
#endif
#ifndef lint
-FILE_RCSID("@(#)$Id: apprentice.c,v 1.54 2003/03/24 01:16:28 christos Exp $")
+FILE_RCSID("@(#)$Id: apprentice.c,v 1.55 2003/03/26 15:35:30 christos Exp $")
#endif /* lint */
#define EATAB {while (isascii((unsigned char) *l) && \
private void bs1(struct magic *);
private uint16_t swap2(uint16_t);
private uint32_t swap4(uint32_t);
-private char *mkdbname(struct magic_set *, const char *, char *, size_t);
+private char *mkdbname(const char *, char *, size_t);
private int apprentice_map(struct magic_set *, struct magic **, uint32_t *,
- const char *, int);
+ const char *);
private int apprentice_compile(struct magic_set *, struct magic **, uint32_t *,
- const char *, int);
+ const char *);
-private int maxmagic = 0;
+private size_t maxmagic = 0;
#ifdef COMPILE_ONLY
const char *magicfile;
if (action == FILE_COMPILE) {
rv = apprentice_file(ms, &magic, &nmagic, fn, action);
if (rv == 0) {
- rv = apprentice_compile(ms, &magic, &nmagic, fn,
- action);
+ rv = apprentice_compile(ms, &magic, &nmagic, fn);
free(magic);
}
return rv;
}
#ifndef COMPILE_ONLY
- if ((rv = apprentice_map(ms, &magic, &nmagic, fn, action)) == -1) {
+ if ((rv = apprentice_map(ms, &magic, &nmagic, fn)) == -1) {
if (ms->flags & MAGIC_CHECK)
file_magwarn("Using regular magic file `%s'", fn);
rv = apprentice_file(ms, &magic, &nmagic, fn, action);
if (ms->flags & MAGIC_CHECK)
file_magwarn("can't happen: m->type=%d\n",
m->type);
- return -1;
+ return ~0U;
}
return v;
}
int i = 0;
struct magic *m;
char *t;
+ uint32_t val;
#define ALLOC_INCR 200
if (*nmagicp + 1 >= maxmagic){
break;
}
if (isdigit((unsigned char)*l))
- m->in_offset = strtoul(l, &t, 0);
+ m->in_offset = (uint32_t)strtoul(l, &t, 0);
else
t = l;
if (*t++ != ')')
m->mask_op = FILE_OPINVERSE;
++l;
}
+ val = (uint32_t)strtoul(l, &l, 0);
switch (*l) {
case '&':
m->mask_op |= FILE_OPAND;
++l;
- m->mask = file_signextend(ms, m, strtoul(l, &l, 0));
+ m->mask = file_signextend(ms, m, val);
eatsize(&l);
break;
case '|':
m->mask_op |= FILE_OPOR;
++l;
- m->mask = file_signextend(ms, m, strtoul(l, &l, 0));
+ m->mask = file_signextend(ms, m, val);
eatsize(&l);
break;
case '^':
m->mask_op |= FILE_OPXOR;
++l;
- m->mask = file_signextend(ms, m, strtoul(l, &l, 0));
+ m->mask = file_signextend(ms, m, val);
eatsize(&l);
break;
case '+':
m->mask_op |= FILE_OPADD;
++l;
- m->mask = file_signextend(ms, m, strtoul(l, &l, 0));
+ m->mask = file_signextend(ms, m, val);
eatsize(&l);
break;
case '-':
m->mask_op |= FILE_OPMINUS;
++l;
- m->mask = file_signextend(ms, m, strtoul(l, &l, 0));
+ m->mask = file_signextend(ms, m, val);
eatsize(&l);
break;
case '*':
m->mask_op |= FILE_OPMULTIPLY;
++l;
- m->mask = file_signextend(ms, m, strtoul(l, &l, 0));
+ m->mask = file_signextend(ms, m, val);
eatsize(&l);
break;
case '%':
m->mask_op |= FILE_OPMODULO;
++l;
- m->mask = file_signextend(ms, m, strtoul(l, &l, 0));
+ m->mask = file_signextend(ms, m, val);
eatsize(&l);
break;
case '/':
if (FILE_STRING != m->type && FILE_PSTRING != m->type) {
m->mask_op |= FILE_OPDIVIDE;
++l;
- m->mask = file_signextend(ms, m, strtoul(l, &l, 0));
+ m->mask = file_signextend(ms, m, val);
eatsize(&l);
} else {
m->mask = 0L;
++l;
break;
}
- /* FALL THROUGH */
+ /*FALLTHROUGH*/
default:
if (*l == 'x' && isascii((unsigned char)l[1]) &&
isspace((unsigned char)l[1])) {
return 0;
default:
if (m->reln != 'x') {
- m->value.l = file_signextend(ms, m, strtoul(*p, p, 0));
+ m->value.l = file_signextend(ms, m,
+ (uint32_t)strtoul(*p, p, 0));
eatsize(p);
}
return 0;
* Print a string containing C character escapes.
*/
protected void
-file_showstr(FILE *fp, const char *s, int len)
+file_showstr(FILE *fp, const char *s, size_t len)
{
char c;
for (;;) {
c = *s++;
- if (len == -1) {
+ if (len == ~0U) {
if (c == '\0')
break;
}
*/
private int
apprentice_map(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp,
- const char *fn, int action)
+ const char *fn)
{
int fd;
struct stat st;
uint32_t version;
int needsbyteswap;
char buf[MAXPATHLEN];
- char *dbname = mkdbname(ms, fn, buf, sizeof(buf));
+ char *dbname = mkdbname(fn, buf, sizeof(buf));
void *mm;
if (dbname == NULL)
*magicp = mm;
(void)close(fd);
fd = -1;
- ptr = (uint32_t *) *magicp;
+ ptr = (uint32_t *)(void *)*magicp;
if (*ptr != MAGICNO) {
if (swap4(*ptr) != MAGICNO) {
file_error(ms, "Bad magic in `%s'", dbname);
version, VERSIONNO, dbname);
goto error;
}
- *nmagicp = (st.st_size / sizeof(struct magic)) - 1;
+ *nmagicp = (uint32_t)(st.st_size / sizeof(struct magic)) - 1;
(*magicp)++;
if (needsbyteswap)
byteswap(*magicp, *nmagicp);
*/
private int
apprentice_compile(struct magic_set *ms, struct magic **magicp,
- uint32_t *nmagicp, const char *fn, int action)
+ uint32_t *nmagicp, const char *fn)
{
int fd;
char buf[MAXPATHLEN];
- char *dbname = mkdbname(ms, fn, buf, sizeof(buf));
+ char *dbname = mkdbname(fn, buf, sizeof(buf));
if (dbname == NULL)
return -1;
return -1;
}
- if (lseek(fd, sizeof(struct magic), SEEK_SET) != sizeof(struct magic)) {
+ if (lseek(fd, (off_t)sizeof(struct magic), SEEK_SET)
+ != sizeof(struct magic)) {
file_error(ms, "Error seeking `%s' (%s)", dbname,
strerror(errno));
return -1;
* make a dbname
*/
private char *
-mkdbname(struct magic_set *ms, const char *fn, char *buf, size_t bufsiz)
+mkdbname(const char *fn, char *buf, size_t bufsiz)
{
const char *p;
if ((p = strrchr(fn, '/')) != NULL)
p++;
else
p = fn;
- snprintf(buf, bufsiz, "%s%s", p, ext);
+ (void)snprintf(buf, bufsiz, "%s%s", p, ext);
return buf;
}
swap2(uint16_t sv)
{
uint16_t rv;
- uint8_t *s = (uint8_t *) &sv;
- uint8_t *d = (uint8_t *) &rv;
+ uint8_t *s = (uint8_t *)(void *)&sv;
+ uint8_t *d = (uint8_t *)(void *)&rv;
d[0] = s[1];
d[1] = s[0];
return rv;
swap4(uint32_t sv)
{
uint32_t rv;
- uint8_t *s = (uint8_t *) &sv;
- uint8_t *d = (uint8_t *) &rv;
+ uint8_t *s = (uint8_t *)(void *)&sv;
+ uint8_t *d = (uint8_t *)(void *)&rv;
d[0] = s[3];
d[1] = s[2];
d[2] = s[1];
bs1(struct magic *m)
{
m->cont_level = swap2(m->cont_level);
- m->offset = swap4(m->offset);
- m->in_offset = swap4(m->in_offset);
+ m->offset = swap4((uint32_t)m->offset);
+ m->in_offset = swap4((uint32_t)m->in_offset);
if (m->type != FILE_STRING)
m->value.l = swap4(m->value.l);
m->mask = swap4(m->mask);
#include "names.h"
#ifndef lint
-FILE_RCSID("@(#)$Id: ascmagic.c,v 1.35 2003/03/23 21:16:26 christos Exp $")
+FILE_RCSID("@(#)$Id: ascmagic.c,v 1.36 2003/03/26 15:35:30 christos Exp $")
#endif /* lint */
typedef unsigned long unichar;
code = "UTF-8 Unicode";
code_mime = "utf-8";
type = "text";
- } else if ((i = looks_unicode(buf, nbytes, ubuf, &ulen))) {
+ } else if ((i = looks_unicode(buf, nbytes, ubuf, &ulen)) != 0) {
if (i == 1)
code = "Little-endian UTF-16 Unicode";
else
n_cr++;
last_line_end = i;
}
- if (ubuf[i] == '\n' && (i - 1 < 0 || ubuf[i - 1] != '\r')) {
+ if (ubuf[i] == '\n' && ((int)i - 1 < 0 || ubuf[i - 1] != '\r')){
n_lf++;
last_line_end = i;
}
if (ubuf[*ulen - 1] == 0xfffe)
return 0;
- if (ubuf[*ulen - 1] < 128 && text_chars[ubuf[*ulen - 1]] != T)
+ if (ubuf[*ulen - 1] < 128 &&
+ text_chars[(size_t)ubuf[*ulen - 1]] != T)
return 0;
}
#endif
#ifndef lint
-FILE_RCSID("@(#)$Id: compress.c,v 1.29 2003/03/24 01:16:28 christos Exp $")
+FILE_RCSID("@(#)$Id: compress.c,v 1.30 2003/03/26 15:35:30 christos Exp $")
#endif
private struct {
const char *magic;
- int maglen;
+ size_t maglen;
const char *const argv[3];
- int silent;
+ int silent;
} compr[] = {
{ "\037\235", 2, { "gzip", "-cdq", NULL }, 1 }, /* compressed */
/* Uncompress can get stuck; so use gzip first if we have it
private int swrite(int, const void *, size_t);
private int sread(int, void *, size_t);
-private size_t uncompressbuf(struct magic_set *ms, int, const unsigned char *,
+private size_t uncompressbuf(struct magic_set *, size_t, const unsigned char *,
unsigned char **, size_t);
#ifdef HAVE_LIBZ
-private size_t uncompressgzipped(struct magic_set *ms, const unsigned char *,
+private size_t uncompressgzipped(struct magic_set *, const unsigned char *,
unsigned char **, size_t);
#endif
file_zmagic(struct magic_set *ms, const unsigned char *buf, size_t nbytes)
{
unsigned char *newbuf;
- size_t nsz;
size_t i;
if ((ms->flags & MAGIC_COMPRESS) == 0)
if (nbytes < compr[i].maglen)
continue;
if (memcmp(buf, compr[i].magic, compr[i].maglen) == 0 &&
- (nsz = uncompressbuf(ms, i, buf, &newbuf, nbytes)) != 0) {
+ uncompressbuf(ms, i, buf, &newbuf, nbytes) != 0) {
free(newbuf);
if (file_printf(ms, " (") == -1)
return -1;
r = 1;
else {
while ((r = sread(fd, buf, sizeof(buf))) > 0)
- if (swrite(tfd, buf, r) != r)
+ if (swrite(tfd, buf, (size_t)r) != r)
break;
}
}
/* XXX: const castaway, via strchr */
- z.next_in = (Bytef *)strchr(old + data_start, old[data_start]);
+ z.next_in = (Bytef *)strchr((const char *)old + data_start,
+ old[data_start]);
z.avail_in = n - data_start;
z.next_out = *newch;
z.avail_out = HOWMANY;
return 0;
}
- n = z.total_out;
+ n = (size_t)z.total_out;
inflateEnd(&z);
/* let's keep the nul-terminate tradition */
#endif
private size_t
-uncompressbuf(struct magic_set *ms, int method, const unsigned char *old,
+uncompressbuf(struct magic_set *ms, size_t method, const unsigned char *old,
unsigned char **newch, size_t n)
{
int fdin[2], fdout[2];
+ int r;
/* The buffer is NUL terminated, and we don't need that. */
n--;
if (pipe(fdin) == -1 || pipe(fdout) == -1) {
file_error(ms, "Cannot create pipe (%s)", strerror(errno));
- return -1;
+ return 0;
}
switch (fork()) {
case 0: /* child */
/*NOTREACHED*/
case -1:
file_error(ms, "Could not fork (%s)", strerror(errno));
- return -1;
+ return 0;
default: /* parent */
(void) close(fdin[0]);
n = 0;
goto err;
}
- if ((n = sread(fdout[0], *newch, HOWMANY)) <= 0) {
+ if ((r = sread(fdout[0], *newch, HOWMANY)) <= 0) {
free(*newch);
- n = 0;
+ r = 0;
goto err;
+ } else {
+ n = r;
}
/* NUL terminate, as every buffer is handled here. */
(*newch)[n++] = '\0';
#include "patchlevel.h"
#ifndef lint
-FILE_RCSID("@(#)$Id: file.c,v 1.73 2003/03/24 01:34:21 christos Exp $")
+FILE_RCSID("@(#)$Id: file.c,v 1.74 2003/03/26 15:35:30 christos Exp $")
#endif /* lint */
(void) printf("%s%c%*s ", inname, separator,
(int) (nopad ? 0 : (wid - strlen(inname))), "");
- type = magic_file(magic, inname);
+ type = magic_file(magic, strcmp(inname, "-") == 0 ? NULL : inname);
if (type == NULL)
printf("ERROR: %s\n", magic_error(magic));
else
*/
/*
* file.h - definitions for file(1) program
- * @(#)$Id: file.h,v 1.48 2003/03/24 01:16:28 christos Exp $
+ * @(#)$Id: file.h,v 1.49 2003/03/26 15:35:30 christos Exp $
*/
#ifndef __file_h__
#define FILE_COMPILE 2
#ifndef __GNUC__
+#ifndef __attribute__
#define __attribute__(a)
#endif
+#endif
struct magic {
uint16_t cont_level; /* level of ">" */
};
struct stat;
-protected char *file_fmttime(long, int);
-protected int file_buffer(struct magic_set *, const void *buf, size_t);
+protected char *file_fmttime(uint32_t, int);
+protected int file_buffer(struct magic_set *, const void *, size_t);
protected int file_fsmagic(struct magic_set *, const char *, struct stat *);
protected int file_pipe2file(struct magic_set *, int, const void *, size_t);
protected int file_printf(struct magic_set *, const char *, ...);
protected void file_error(struct magic_set *, const char *, ...);
protected void file_magwarn(const char *, ...);
protected void file_mdump(struct magic *);
-protected void file_showstr(FILE *, const char *, int);
+protected void file_showstr(FILE *, const char *, size_t);
#ifndef HAVE_STRERROR
extern int sys_nerr;
file_printf(struct magic_set *ms, const char *fmt, ...)
{
va_list ap;
- int len;
+ size_t len;
char *buf;
va_start(ap, fmt);
*/
/*VARARGS*/
protected void
-#ifdef __STDC__
file_error(struct magic_set *ms, const char *f, ...)
-#else
-error(va_alist)
- va_dcl
-#endif
{
va_list va;
-#ifdef __STDC__
+ /* Only the first error is ok */
+ if (ms->haderr)
+ return;
va_start(va, f);
-#else
- const char *f;
- va_start(va);
- f = va_arg(va, const char *);
-#endif
+
/* cuz we use stdout for most, stderr here */
(void) fflush(stdout);
#include "tar.h"
#ifndef lint
-FILE_RCSID("@(#)$Id: is_tar.c,v 1.19 2003/03/23 21:16:26 christos Exp $")
+FILE_RCSID("@(#)$Id: is_tar.c,v 1.20 2003/03/26 15:35:30 christos Exp $")
#endif
#define isodigit(c) ( ((c) >= '0') && ((c) <= '7') )
-private int from_oct(int, char *); /* Decode octal number */
+private int from_oct(int, const char *); /* Decode octal number */
/*
* Return
protected int
file_is_tar(const unsigned char *buf, size_t nbytes)
{
- union record *header = (union record *)buf;
+ const union record *header = (const union record *)(const void *)buf;
int i;
int sum, recsum;
- char *p;
+ const char *p;
if (nbytes < sizeof(union record))
return 0;
* Result is -1 if the field is invalid (all blank, or nonoctal).
*/
private int
-from_oct(int digs, char *where)
+from_oct(int digs, const char *where)
{
int value;
+/*
+ * Copyright (c) Christos Zoulas 2003.
+ * All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice immediately at the beginning of the file, without modification,
+ * this list of conditions, and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
#include "magic.h"
#include "file.h"
#include "patchlevel.h"
#ifndef lint
-FILE_RCSID("@(#)$Id: magic.c,v 1.5 2003/03/24 01:34:21 christos Exp $")
+FILE_RCSID("@(#)$Id: magic.c,v 1.6 2003/03/26 15:35:30 christos Exp $")
#endif /* lint */
#ifdef __EMX__
return ms->o.buf;
}
- if ((fd = open(inname, O_RDONLY)) < 0) {
+#ifndef STDIN_FILENO
+#define STDIN_FILENO 0
+#endif
+ if (inname == NULL)
+ fd = STDIN_FILENO;
+ else if ((fd = open(inname, O_RDONLY)) < 0) {
/* We can't open it, but we were able to stat it. */
if (sb.st_mode & 0002)
- if (file_printf(ms, "writeable, ") == -1)
+ if (file_printf(ms, "writable, ") == -1)
return NULL;
if (sb.st_mode & 0111)
if (file_printf(ms, "executable, ") == -1)
return ms->o.buf;
}
#endif
- if (file_buffer(ms, buf, nbytes) == -1)
+ if (file_buffer(ms, buf, (size_t)nbytes) == -1)
return NULL;
#ifdef BUILTIN_ELF
if (nbytes > 5) {
* information from the ELF headers that can't easily
* be extracted with rules in the magic file.
*/
- file_tryelf(ms, fd, buf, nbytes);
+ file_tryelf(ms, fd, buf, (size_t)nbytes);
}
#endif
}
public const char *
-magic_buf(struct magic_set *ms, const void *buf, size_t nb)
+magic_buffer(struct magic_set *ms, const void *buf, size_t nb)
{
if (file_reset(ms) == -1)
return NULL;
#include <time.h>
#ifndef lint
-FILE_RCSID("@(#)$Id: print.c,v 1.42 2003/03/24 01:16:28 christos Exp $")
+FILE_RCSID("@(#)$Id: print.c,v 1.43 2003/03/26 15:35:30 christos Exp $")
#endif /* lint */
#define SZOF(a) (sizeof(a) / sizeof(a[0]))
if (m->mask_op & FILE_OPINVERSE)
(void) fputc('~', stderr);
if (m->mask) {
- ((m->mask_op&0x7F) < SZOF(optyp)) ?
- (void) fputc(optyp[m->mask_op&0x7F], stderr) :
- (void) fputc('?', stderr);
+ if ((m->mask_op & 0x7F) < SZOF(optyp))
+ fputc(optyp[m->mask_op&0x7F], stderr);
+ else
+ fputc('?', stderr);
if(FILE_STRING != m->type || FILE_PSTRING != m->type)
(void) fprintf(stderr, "%.8x", m->mask);
else {
case FILE_STRING:
case FILE_PSTRING:
case FILE_REGEX:
- file_showstr(stderr, m->value.s, -1);
+ file_showstr(stderr, m->value.s, ~0U);
break;
case FILE_DATE:
case FILE_LEDATE:
}
protected char *
-file_fmttime(long v, int local)
+file_fmttime(uint32_t v, int local)
{
char *pp, *rt;
time_t t = (time_t)v;
#include "readelf.h"
#ifndef lint
-FILE_RCSID("@(#)$Id: readelf.c,v 1.30 2003/03/23 21:16:26 christos Exp $")
+FILE_RCSID("@(#)$Id: readelf.c,v 1.31 2003/03/26 15:35:30 christos Exp $")
#endif
#ifdef ELFCORE
#define ph_offset (class == ELFCLASS32 \
? getu32(swap, ph32.p_offset) \
: getu64(swap, ph64.p_offset))
-#define ph_align (class == ELFCLASS32 \
- ? (ph32.p_align ? getu32(swap, ph32.p_align) : 4) \
- : (ph64.p_align ? getu64(swap, ph64.p_align) : 4))
+#define ph_align (int)((class == ELFCLASS32 \
+ ? (off_t) (ph32.p_align ? \
+ getu32(swap, ph32.p_align) : 4) \
+ : (off_t) (ph64.p_align ? \
+ getu64(swap, ph64.p_align) : 4)))
#define nh_size (class == ELFCLASS32 \
- ? sizeof *nh32 \
- : sizeof *nh64)
+ ? sizeof nh32 \
+ : sizeof nh64)
#define nh_type (class == ELFCLASS32 \
- ? getu32(swap, nh32->n_type) \
- : getu32(swap, nh64->n_type))
+ ? getu32(swap, nh32.n_type) \
+ : getu32(swap, nh64.n_type))
#define nh_namesz (class == ELFCLASS32 \
- ? getu32(swap, nh32->n_namesz) \
- : getu32(swap, nh64->n_namesz))
+ ? getu32(swap, nh32.n_namesz) \
+ : getu32(swap, nh64.n_namesz))
#define nh_descsz (class == ELFCLASS32 \
- ? getu32(swap, nh32->n_descsz) \
- : getu32(swap, nh64->n_descsz))
+ ? getu32(swap, nh32.n_descsz) \
+ : getu32(swap, nh64.n_descsz))
#define prpsoffsets(i) (class == ELFCLASS32 \
? prpsoffsets32[i] \
: prpsoffsets64[i])
Elf32_Phdr ph32;
Elf64_Phdr ph64;
size_t offset;
- char nbuf[BUFSIZ];
+ unsigned char nbuf[BUFSIZ];
int bufsize;
if (size != ph_size) {
for (;;) {
if (offset >= bufsize)
break;
- offset = donote(ms, nbuf, offset, bufsize, class, swap,
- 4);
+ offset = donote(ms, nbuf, offset, (size_t)bufsize,
+ class, swap, 4);
}
}
donote(struct magic_set *ms, unsigned char *nbuf, size_t offset, size_t size,
int class, int swap, int align)
{
- Elf32_Nhdr *nh32 = NULL;
- Elf64_Nhdr *nh64 = NULL;
+ Elf32_Nhdr nh32;
+ Elf64_Nhdr nh64;
size_t noff, doff;
#ifdef ELFCORE
int os_style = -1;
#endif
if (class == ELFCLASS32)
- nh32 = (Elf32_Nhdr *)&nbuf[offset];
+ memcpy(&nh32, &nbuf[offset], sizeof(nh32));
else
- nh64 = (Elf64_Nhdr *)&nbuf[offset];
+ memcpy(&nh64, &nbuf[offset], sizeof(nh64));
offset += nh_size;
if ((nh_namesz == 0) && (nh_descsz == 0)) {
if (offset + nh_descsz >= size)
return offset;
- if (nh_namesz == 4 && strcmp(&nbuf[noff], "GNU") == 0 &&
+ if (nh_namesz == 4 && strcmp((char *)&nbuf[noff], "GNU") == 0 &&
nh_type == NT_GNU_VERSION && nh_descsz == 16) {
- uint32_t *desc = (uint32_t *)&nbuf[doff];
+ uint32_t desc[4];
+ (void)memcpy(desc, &nbuf[doff], sizeof(desc));
if (file_printf(ms, ", for GNU/") == -1)
- return -1;
+ return size;
switch (getu32(swap, desc[0])) {
case GNU_OS_LINUX:
if (file_printf(ms, "Linux") == -1)
- return -1;
+ return size;
break;
case GNU_OS_HURD:
if (file_printf(ms, "Hurd") == -1)
- return -1;
+ return size;
break;
case GNU_OS_SOLARIS:
if (file_printf(ms, "Solaris") == -1)
- return -1;
+ return size;
break;
default:
if (file_printf(ms, "<unknown>") == -1)
- return -1;
+ return size;
}
if (file_printf(ms, " %d.%d.%d", getu32(swap, desc[1]),
getu32(swap, desc[2]), getu32(swap, desc[3])) == -1)
- return -1;
+ return size;
return size;
}
- if (nh_namesz == 7 && strcmp(&nbuf[noff], "NetBSD") == 0 &&
+ if (nh_namesz == 7 && strcmp((char *)&nbuf[noff], "NetBSD") == 0 &&
nh_type == NT_NETBSD_VERSION && nh_descsz == 4) {
- uint32_t desc = getu32(swap, *(uint32_t *)&nbuf[doff]);
+ uint32_t desc;
+ (void)memcpy(&desc, &nbuf[doff], sizeof(desc));
+ desc = getu32(swap, desc);
if (file_printf(ms, ", for NetBSD") == -1)
- return -1;
+ return size;
/*
* The version number used to be stuck as 199905, and was thus
* basically content-free. Newer versions of NetBSD have fixed
u_int ver_maj = desc / 100000000;
if (file_printf(ms, " %u.%u", ver_maj, ver_min) == -1)
- return -1;
+ return size;
if (ver_rel == 0 && ver_patch != 0) {
if (file_printf(ms, ".%u", ver_patch) == -1)
- return -1;
+ return size;
} else if (ver_rel != 0 && ver_rel <= 26) {
- if (file_printf(ms, "%c", 'A' + ver_rel - 1) == -1)
- return -1;
+ if (file_printf(ms, "%c", 'A' + ver_rel - 1)
+ == -1)
+ return size;
} else if (ver_rel != 0 && ver_rel <= 52) {
- if (file_printf(ms, "Z%c", 'A' + ver_rel - 1) == -1)
- return -1;
+ if (file_printf(ms, "Z%c", 'A' + ver_rel - 1)
+ == -1)
+ return size;
} else if (ver_rel != 0) {
if (file_printf(ms, "<unknown>") == -1)
- return -1;
+ return size;
}
}
return size;
}
- if (nh_namesz == 8 && strcmp(&nbuf[noff], "FreeBSD") == 0 &&
+ if (nh_namesz == 8 && strcmp((char *)&nbuf[noff], "FreeBSD") == 0 &&
nh_type == NT_FREEBSD_VERSION && nh_descsz == 4) {
- uint32_t desc = getu32(swap,
- *(uint32_t *)&nbuf[doff]);
+ uint32_t desc;
+ (void)memcpy(&desc, &nbuf[doff], sizeof(desc));
+ desc = getu32(swap, desc);
if (file_printf(ms, ", for FreeBSD") == -1)
- return -1;
+ return size;
/*
* Contents is __FreeBSD_version, whose relation to OS versions
* is defined by a huge table in the Porters' Handbook. Happily,
* the first three digits are the version number, at least in
* versions of FreeBSD that use this note.
*/
- if (file_printf(ms, " %d.%d", desc / 100000, desc / 10000 % 10) == -1)
- return -1;
+ if (file_printf(ms, " %d.%d", desc / 100000, desc / 10000 % 10)
+ == -1)
+ return size;
if (desc / 1000 % 10 > 0)
if (file_printf(ms, ".%d", desc / 1000 % 10) == -1)
- return -1;
+ return size;
return size;
}
- if (nh_namesz == 8 && strcmp(&nbuf[noff], "OpenBSD") == 0 &&
+ if (nh_namesz == 8 && strcmp((char *)&nbuf[noff], "OpenBSD") == 0 &&
nh_type == NT_OPENBSD_VERSION && nh_descsz == 4) {
if (file_printf(ms, ", for OpenBSD") == -1)
- return -1;
+ return size;
/* Content of note is always 0 */
return size;
}
* doesn't include the terminating null in the
* name....
*/
- if ((nh_namesz == 4 && strncmp(&nbuf[noff], "CORE", 4) == 0) ||
- (nh_namesz == 5 && strcmp(&nbuf[noff], "CORE") == 0)) {
+ if ((nh_namesz == 4 && strncmp((char *)&nbuf[noff], "CORE", 4) == 0) ||
+ (nh_namesz == 5 && strcmp((char *)&nbuf[noff], "CORE") == 0)) {
os_style = OS_STYLE_SVR4;
}
- if ((nh_namesz == 8 && strcmp(&nbuf[noff], "FreeBSD") == 0)) {
+ if ((nh_namesz == 8 && strcmp((char *)&nbuf[noff], "FreeBSD") == 0)) {
os_style = OS_STYLE_FREEBSD;
}
- if ((nh_namesz >= 11 && strncmp(&nbuf[noff], "NetBSD-CORE", 11) == 0)) {
+ if ((nh_namesz >= 11 && strncmp((char *)&nbuf[noff], "NetBSD-CORE", 11)
+ == 0)) {
os_style = OS_STYLE_NETBSD;
}
#ifdef ELFCORE
if (os_style != -1)
if (file_printf(ms, ", %s-style", os_style_names[os_style]) == -1)
- return -1;
+ return size;
if (os_style == OS_STYLE_NETBSD && nh_type == NT_NETBSD_CORE_PROCINFO) {
uint32_t signo;
* including the terminating NUL.
*/
if (file_printf(ms, ", from '%.31s'", &nbuf[doff + 0x7c]) == -1)
- return -1;
+ return size;
/*
* Extract the signal number. It is at
memcpy(&signo, &nbuf[doff + 0x08],
sizeof(signo));
if (file_printf(ms, " (signal %u)", getu32(swap, signo)) == -1)
- return -1;
+ return size;
return size;
} else if (os_style != OS_STYLE_NETBSD && nh_type == NT_PRPSINFO) {
int i, j;
*/
if (file_printf(ms, ", from '%.16s'",
&nbuf[doff + prpsoffsets(i)]) == -1)
- return -1;
+ return size;
return size;
tryanother:
Elf64_Phdr ph64;
const char *linking_style = "statically";
const char *shared_libraries = "";
- char nbuf[BUFSIZ];
+ unsigned char nbuf[BUFSIZ];
int bufsize;
size_t offset;
off_t savedoffset;
file_badread(ms);
return -1;
}
- if ((savedoffset = lseek(fd, 0, SEEK_CUR)) == (off_t)-1) {
+ if ((savedoffset = lseek(fd, (off_t)0, SEEK_CUR)) == (off_t)-1) {
file_badseek(ms);
return -1;
}
for (;;) {
if (offset >= bufsize)
break;
- offset = donote(ms, nbuf, offset, bufsize,
- class, swap, ph_align);
+ offset = donote(ms, nbuf, offset,
+ (size_t)bufsize, class, swap, ph_align);
}
if (lseek(fd, savedoffset + offset, SEEK_SET)
== (off_t)-1) {
if (getu16(swap, elfhdr.e_type) == ET_CORE) {
#ifdef ELFCORE
if (dophn_core(ms, class, swap, fd,
- getu32(swap, elfhdr.e_phoff),
+ (off_t)getu32(swap, elfhdr.e_phoff),
getu16(swap, elfhdr.e_phnum),
- getu16(swap, elfhdr.e_phentsize)) == -1)
+ (size_t)getu16(swap, elfhdr.e_phentsize)) == -1)
return -1;
#else
;
} else {
if (getu16(swap, elfhdr.e_type) == ET_EXEC) {
if (dophn_exec(ms, class, swap,
- fd, getu32(swap, elfhdr.e_phoff),
+ fd, (off_t)getu32(swap, elfhdr.e_phoff),
getu16(swap, elfhdr.e_phnum),
- getu16(swap, elfhdr.e_phentsize)) == -1)
+ (size_t)getu16(swap, elfhdr.e_phentsize))
+ == -1)
return -1;
}
if (doshn(ms, class, swap, fd,
- getu32(swap, elfhdr.e_shoff),
+ (off_t)getu32(swap, elfhdr.e_shoff),
getu16(swap, elfhdr.e_shnum),
- getu16(swap, elfhdr.e_shentsize)) == -1)
+ (size_t)getu16(swap, elfhdr.e_shentsize)) == -1)
return -1;
}
return 1;
#ifdef ELFCORE
if (dophn_core(ms, class, swap, fd,
#ifdef USE_ARRAY_FOR_64BIT_TYPES
- getu32(swap, elfhdr.e_phoff[1]),
+ (off_t)getu32(swap, elfhdr.e_phoff[1]),
#else
- getu64(swap, elfhdr.e_phoff),
+ (off_t)getu64(swap, elfhdr.e_phoff),
#endif
getu16(swap, elfhdr.e_phnum),
- getu16(swap, elfhdr.e_phentsize)) == -1)
+ (size_t)getu16(swap, elfhdr.e_phentsize)) == -1)
return -1;
#else
;
if (getu16(swap, elfhdr.e_type) == ET_EXEC) {
if (dophn_exec(ms, class, swap, fd,
#ifdef USE_ARRAY_FOR_64BIT_TYPES
- getu32(swap, elfhdr.e_phoff[1]),
+ (off_t)getu32(swap, elfhdr.e_phoff[1]),
#else
- getu64(swap, elfhdr.e_phoff),
+ (off_t)getu64(swap, elfhdr.e_phoff),
#endif
getu16(swap, elfhdr.e_phnum),
- getu16(swap, elfhdr.e_phentsize)) == -1)
+ (size_t)getu16(swap, elfhdr.e_phentsize))
+ == -1)
return -1;
}
if (doshn(ms, class, swap, fd,
#ifdef USE_ARRAY_FOR_64BIT_TYPES
- getu32(swap, elfhdr.e_shoff[1]),
+ (off_t)getu32(swap, elfhdr.e_shoff[1]),
#else
- getu64(swap, elfhdr.e_shoff),
+ (off_t)getu64(swap, elfhdr.e_shoff),
#endif
getu16(swap, elfhdr.e_shnum),
- getu16(swap, elfhdr.e_shentsize)) == -1)
+ (size_t)getu16(swap, elfhdr.e_shentsize)) == -1)
return -1;
}
return 1;
#ifndef lint
-FILE_RCSID("@(#)$Id: softmagic.c,v 1.57 2003/03/24 01:16:28 christos Exp $")
+FILE_RCSID("@(#)$Id: softmagic.c,v 1.58 2003/03/26 15:35:30 christos Exp $")
#endif /* lint */
private int match(struct magic_set *, struct magic *, uint32_t,
return -1;
case 0:
flush++;
+ break;
default:
break;
}
switch (m->type) {
case FILE_BYTE:
- v = file_signextend(ms, m, p->b);
+ v = file_signextend(ms, m, (size_t)p->b);
if (file_printf(ms, m->desc, (unsigned char) v) == -1)
return -1;
t = m->offset + sizeof(char);
case FILE_SHORT:
case FILE_BESHORT:
case FILE_LESHORT:
- v = file_signextend(ms, m, p->h);
+ v = file_signextend(ms, m, (size_t)p->h);
if (file_printf(ms, m->desc, (unsigned short) v) == -1)
return -1;
t = m->offset + sizeof(short);
* (starting at 1), not as bytes-from start-of-file
*/
unsigned char *b, *last = NULL;
- if ((b = p->buf = strdup(s)) == NULL) {
+ if ((p->buf = strdup((const char *)s)) == NULL) {
file_oomem(ms);
return -1;
}
-
- for (; offset && (b = (unsigned char *)strchr(b, '\n')) != NULL;
+ for (b = (unsigned char *)p->buf; offset &&
+ (b = (unsigned char *)strchr((char *)b, '\n')) != NULL;
offset--, s++)
last = b;
if (last != NULL)
int32_t have = nbytes - offset;
memset(p, 0, sizeof(union VALUETYPE));
if (have > 0)
- memcpy(p, s + offset, have);
+ memcpy(p, s + offset, (size_t)have);
}
if ((ms->flags & MAGIC_DEBUG) != 0) {
- mdebug(offset, (char *) p, sizeof(union VALUETYPE));
+ mdebug(offset, (char *)(void *)p, sizeof(union VALUETYPE));
file_mdump(m);
}
memcpy(p, s + offset, sizeof(union VALUETYPE));
if ((ms->flags & MAGIC_DEBUG) != 0) {
- mdebug(offset, (char *) p, sizeof(union VALUETYPE));
+ mdebug(offset, (char *)(void *)p,
+ sizeof(union VALUETYPE));
file_mdump(m);
}
}