From: Christos Zoulas Date: Sun, 28 Nov 1999 20:02:28 +0000 (+0000) Subject: new string/[Bcb] magic from anton, and adjustments to the magic files to X-Git-Tag: FILE3_30~13 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=901d90c52dc2d9bf50efb05631ab3e4e5257db6d;p=file new string/[Bcb] magic from anton, and adjustments to the magic files to use it. --- diff --git a/Makefile.in b/Makefile.in index a356bc93..c45b012a 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated automatically by automake 1.4 from Makefile.am +# Makefile.in generated automatically by automake 1.4a from Makefile.am # Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation @@ -48,9 +48,10 @@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_FLAG = transform = @program_transform_name@ NORMAL_INSTALL = : @@ -119,7 +120,7 @@ missing mkinstalldirs DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) -TAR = tar +TAR = gtar GZIP_ENV = --best SOURCES = $(file_SOURCES) OBJECTS = $(file_OBJECTS) @@ -184,8 +185,8 @@ install-binPROGRAMS: $(bin_PROGRAMS) $(mkinstalldirs) $(DESTDIR)$(bindir) @list='$(bin_PROGRAMS)'; for p in $$list; do \ if test -f $$p; then \ - echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \ - $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \ + $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ else :; fi; \ done @@ -380,7 +381,7 @@ distdir: $(DISTFILES) @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ - cp -pr $$/$$file $(distdir)/$$file; \ + cp -pr $$d/$$file $(distdir)/$$file; \ else \ test -f $(distdir)/$$file \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ @@ -412,7 +413,7 @@ uninstall: uninstall-am all-am: Makefile $(PROGRAMS) $(MANS) $(DATA) config.h all-redirect: all-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install + $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install installdirs: $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man1 \ $(DESTDIR)$(mandir)/man4 $(DESTDIR)$(datadir) diff --git a/aclocal.m4 b/aclocal.m4 index 15f85742..c62b0c88 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,7 +1,7 @@ -dnl aclocal.m4 generated automatically by aclocal 1.3 +dnl aclocal.m4 generated automatically by aclocal 1.4a -dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. -dnl This Makefile.in is free software; the Free Software Foundation +dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -100,7 +100,9 @@ dnl Usage: dnl AM_INIT_AUTOMAKE(package,version, [no-define]) AC_DEFUN(AM_INIT_AUTOMAKE, -[AC_REQUIRE([AM_PROG_INSTALL]) +[AC_REQUIRE([AC_PROG_INSTALL]) +dnl We require 2.13 because we rely on SHELL being computed by configure. +AC_PREREQ([2.13]) PACKAGE=[$1] AC_SUBST(PACKAGE) VERSION=[$2] @@ -110,8 +112,8 @@ if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi ifelse([$3],, -AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE") -AC_DEFINE_UNQUOTED(VERSION, "$VERSION")) +AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) +AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])) AC_REQUIRE([AM_SANITY_CHECK]) AC_REQUIRE([AC_ARG_PROGRAM]) dnl FIXME This is truly gross. @@ -123,15 +125,6 @@ AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) AC_REQUIRE([AC_PROG_MAKE_SET])]) - -# serial 1 - -AC_DEFUN(AM_PROG_INSTALL, -[AC_REQUIRE([AC_PROG_INSTALL]) -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' -AC_SUBST(INSTALL_SCRIPT)dnl -]) - # # Check to make sure that the build environment is sane. # diff --git a/config.h.in b/config.h.in index 5f308738..116676b7 100644 --- a/config.h.in +++ b/config.h.in @@ -24,12 +24,6 @@ /* Define if you have the ANSI C header files. */ #undef STDC_HEADERS -/* Autoheader needs me */ -#define PACKAGE "file" - -/* Autoheader needs me */ -#define VERSION "3.27" - /* Define if builtin ELF support is enabled. */ #undef BUILTIN_ELF @@ -70,5 +64,15 @@ /* Define if you have the strtoul function. */ #undef HAVE_STRTOUL +/* Define if you have the header file. */ +#undef HAVE_LOCALE_H + /* Define if you have the header file. */ #undef HAVE_UNISTD_H + +/* Name of package */ +#undef PACKAGE + +/* Version number of package */ +#undef VERSION + diff --git a/configure b/configure index 48ee2786..56565249 100755 --- a/configure +++ b/configure @@ -608,11 +608,8 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' - echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 -echo "configure:616: checking whether build environment is sane" >&5 +echo "configure:613: checking whether build environment is sane" >&5 # Just in case sleep 1 echo timestamp > conftestfile @@ -669,7 +666,7 @@ test "$program_suffix" != NONE && test "$program_transform_name" = "" && program_transform_name="s,x,x," echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:673: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:670: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -696,6 +693,7 @@ else fi + PACKAGE=file VERSION=3.27 @@ -715,7 +713,7 @@ EOF missing_dir=`cd $ac_aux_dir && pwd` echo $ac_n "checking for working aclocal""... $ac_c" 1>&6 -echo "configure:719: checking for working aclocal" >&5 +echo "configure:717: checking for working aclocal" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -728,7 +726,7 @@ else fi echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 -echo "configure:732: checking for working autoconf" >&5 +echo "configure:730: checking for working autoconf" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -741,7 +739,7 @@ else fi echo $ac_n "checking for working automake""... $ac_c" 1>&6 -echo "configure:745: checking for working automake" >&5 +echo "configure:743: checking for working automake" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -754,7 +752,7 @@ else fi echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 -echo "configure:758: checking for working autoheader" >&5 +echo "configure:756: checking for working autoheader" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -767,7 +765,7 @@ else fi echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 -echo "configure:771: checking for working makeinfo" >&5 +echo "configure:769: checking for working makeinfo" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -785,7 +783,7 @@ fi echo $ac_n "checking for builtin ELF support""... $ac_c" 1>&6 -echo "configure:789: checking for builtin ELF support" >&5 +echo "configure:787: checking for builtin ELF support" >&5 # Check whether --enable-elf or --disable-elf was given. if test "${enable_elf+set}" = set; then enableval="$enable_elf" @@ -811,7 +809,7 @@ fi echo $ac_n "checking for ELF core file support""... $ac_c" 1>&6 -echo "configure:815: checking for ELF core file support" >&5 +echo "configure:813: checking for ELF core file support" >&5 # Check whether --enable-elf-core or --disable-elf-core was given. if test "${enable_elf_core+set}" = set; then enableval="$enable_elf_core" @@ -839,7 +837,7 @@ fi # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:843: checking for $ac_word" >&5 +echo "configure:841: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -869,7 +867,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:873: checking for $ac_word" >&5 +echo "configure:871: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -920,7 +918,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:924: checking for $ac_word" >&5 +echo "configure:922: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -952,7 +950,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:956: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:954: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -963,12 +961,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 967 "configure" +#line 965 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:972: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:970: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -994,12 +992,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:998: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:996: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:1003: checking whether we are using GNU C" >&5 +echo "configure:1001: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1008,7 +1006,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1012: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1010: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -1027,7 +1025,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1031: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:1029: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1070,7 +1068,7 @@ fi # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:1074: checking for a BSD compatible install" >&5 +echo "configure:1072: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1123,7 +1121,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:1127: checking whether ln -s works" >&5 +echo "configure:1125: checking whether ln -s works" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1145,7 +1143,7 @@ fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1149: checking how to run the C preprocessor" >&5 +echo "configure:1147: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1160,13 +1158,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1170: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1168: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1177,13 +1175,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1187: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1185: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1194,13 +1192,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1204: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1202: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1225,12 +1223,12 @@ fi echo "$ac_t""$CPP" 1>&6 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1229: checking for ANSI C header files" >&5 +echo "configure:1227: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1238,7 +1236,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1242: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1240: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1255,7 +1253,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1273,7 +1271,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1294,7 +1292,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1305,7 +1303,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1309: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1307: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -1329,19 +1327,19 @@ EOF fi echo $ac_n "checking whether sys/types.h defines makedev""... $ac_c" 1>&6 -echo "configure:1333: checking whether sys/types.h defines makedev" >&5 +echo "configure:1331: checking whether sys/types.h defines makedev" >&5 if eval "test \"`echo '$''{'ac_cv_header_sys_types_h_makedev'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { return makedev(0, 0); ; return 0; } EOF -if { (eval echo configure:1345: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1343: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_header_sys_types_h_makedev=yes else @@ -1359,17 +1357,17 @@ echo "$ac_t""$ac_cv_header_sys_types_h_makedev" 1>&6 if test $ac_cv_header_sys_types_h_makedev = no; then ac_safe=`echo "sys/mkdev.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for sys/mkdev.h""... $ac_c" 1>&6 -echo "configure:1363: checking for sys/mkdev.h" >&5 +echo "configure:1361: checking for sys/mkdev.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1373: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1371: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1397,17 +1395,17 @@ fi if test $ac_cv_header_sys_mkdev_h = no; then ac_safe=`echo "sys/sysmacros.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for sys/sysmacros.h""... $ac_c" 1>&6 -echo "configure:1401: checking for sys/sysmacros.h" >&5 +echo "configure:1399: checking for sys/sysmacros.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1411: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1409: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1435,12 +1433,12 @@ fi fi echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 -echo "configure:1439: checking for sys/wait.h that is POSIX.1 compatible" >&5 +echo "configure:1437: checking for sys/wait.h that is POSIX.1 compatible" >&5 if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1456,7 +1454,7 @@ wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } EOF -if { (eval echo configure:1460: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1458: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_sys_wait_h=yes else @@ -1480,17 +1478,57 @@ for ac_hdr in unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1484: checking for $ac_hdr" >&5 +echo "configure:1482: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1492: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done + +for ac_hdr in locale.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:1522: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1494: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1532: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1518,12 +1556,12 @@ done echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:1522: checking for working const" >&5 +echo "configure:1560: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1614: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -1593,12 +1631,12 @@ EOF fi echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:1597: checking for off_t" >&5 +echo "configure:1635: checking for off_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -1626,12 +1664,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:1630: checking for size_t" >&5 +echo "configure:1668: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -1659,12 +1697,12 @@ EOF fi echo $ac_n "checking for st_rdev in struct stat""... $ac_c" 1>&6 -echo "configure:1663: checking for st_rdev in struct stat" >&5 +echo "configure:1701: checking for st_rdev in struct stat" >&5 if eval "test \"`echo '$''{'ac_cv_struct_st_rdev'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1672,7 +1710,7 @@ int main() { struct stat s; s.st_rdev; ; return 0; } EOF -if { (eval echo configure:1676: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1714: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_st_rdev=yes else @@ -1694,12 +1732,12 @@ fi echo $ac_n "checking for uint8_t""... $ac_c" 1>&6 -echo "configure:1698: checking for uint8_t" >&5 +echo "configure:1736: checking for uint8_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_uint8_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -1727,12 +1765,12 @@ EOF fi echo $ac_n "checking for uint16_t""... $ac_c" 1>&6 -echo "configure:1731: checking for uint16_t" >&5 +echo "configure:1769: checking for uint16_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_uint16_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -1760,12 +1798,12 @@ EOF fi echo $ac_n "checking for uint32_t""... $ac_c" 1>&6 -echo "configure:1764: checking for uint32_t" >&5 +echo "configure:1802: checking for uint32_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_uint32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -1794,7 +1832,7 @@ fi echo $ac_n "checking for long long""... $ac_c" 1>&6 -echo "configure:1798: checking for long long" >&5 +echo "configure:1836: checking for long long" >&5 if eval "test \"`echo '$''{'ac_cv_c_long_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1805,13 +1843,13 @@ if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1853: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_long_long=yes else @@ -1840,12 +1878,12 @@ else long64='unsigned long'; fi echo $ac_n "checking for uint64_t""... $ac_c" 1>&6 -echo "configure:1844: checking for uint64_t" >&5 +echo "configure:1882: checking for uint64_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_uint64_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -1876,7 +1914,7 @@ fi echo $ac_n "checking size of uint8_t""... $ac_c" 1>&6 -echo "configure:1880: checking size of uint8_t" >&5 +echo "configure:1918: checking size of uint8_t" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_uint8_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1884,7 +1922,7 @@ else ac_cv_sizeof_uint8_t=0 else cat > conftest.$ac_ext < #ifdef STDC_HEADERS @@ -1900,7 +1938,7 @@ main() exit(0); } EOF -if { (eval echo configure:1904: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1942: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_uint8_t=`cat conftestval` else @@ -1921,7 +1959,7 @@ EOF echo $ac_n "checking size of uint16_t""... $ac_c" 1>&6 -echo "configure:1925: checking size of uint16_t" >&5 +echo "configure:1963: checking size of uint16_t" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_uint16_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1929,7 +1967,7 @@ else ac_cv_sizeof_uint16_t=0 else cat > conftest.$ac_ext < #ifdef STDC_HEADERS @@ -1945,7 +1983,7 @@ main() exit(0); } EOF -if { (eval echo configure:1949: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1987: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_uint16_t=`cat conftestval` else @@ -1966,7 +2004,7 @@ EOF echo $ac_n "checking size of uint32_t""... $ac_c" 1>&6 -echo "configure:1970: checking size of uint32_t" >&5 +echo "configure:2008: checking size of uint32_t" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_uint32_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1974,7 +2012,7 @@ else ac_cv_sizeof_uint32_t=0 else cat > conftest.$ac_ext < #ifdef STDC_HEADERS @@ -1990,7 +2028,7 @@ main() exit(0); } EOF -if { (eval echo configure:1994: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2032: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_uint32_t=`cat conftestval` else @@ -2011,7 +2049,7 @@ EOF echo $ac_n "checking size of uint64_t""... $ac_c" 1>&6 -echo "configure:2015: checking size of uint64_t" >&5 +echo "configure:2053: checking size of uint64_t" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_uint64_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2019,7 +2057,7 @@ else ac_cv_sizeof_uint64_t=0 else cat > conftest.$ac_ext < #ifdef STDC_HEADERS @@ -2035,7 +2073,7 @@ main() exit(0); } EOF -if { (eval echo configure:2039: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2077: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_uint64_t=`cat conftestval` else @@ -2059,12 +2097,12 @@ EOF for ac_func in strerror strtoul do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2063: checking for $ac_func" >&5 +echo "configure:2101: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2129: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else diff --git a/configure.in b/configure.in index 111ba092..c1b166a9 100644 --- a/configure.in +++ b/configure.in @@ -41,6 +41,7 @@ AC_HEADER_STDC AC_HEADER_MAJOR AC_HEADER_SYS_WAIT AC_CHECK_HEADERS(unistd.h) +AC_CHECK_HEADERS(locale.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST diff --git a/doc/magic.man b/doc/magic.man index aebd9f95..55ad4a4f 100644 --- a/doc/magic.man +++ b/doc/magic.man @@ -36,7 +36,14 @@ A two-byte value (on most systems) in this machine's native byte order. .IP long A four-byte value (on most systems) in this machine's native byte order. .IP string -A string of bytes. +A string of bytes. The string type specification can be optionally followed +by /[Bbc]*. The ``B'' flag compacts whitespace in the target, which must +contain at least one whitespace character. If the magic has "n" consecutive +blanks, the target needs at least "n" consecutive blanks to match. The ``b'' +flag treats every blank in the target as an optional blank. Finally the ``c'' +flag, specifies case insensitive matching: lowercase characters in the magic +match both lower and upper case characters in the targer, whereas upper case +characters in the magic, only much uppercase characters in the target. .IP date A four-byte value interpreted as a unix date. .IP beshort @@ -205,4 +212,4 @@ indirect offsets. .\" the changes I posted to the S5R2 version. .\" .\" Modified for Ian Darwin's version of the file command. -.\" @(#)$Id: magic.man,v 1.15 1998/08/13 17:32:24 christos Exp $ +.\" @(#)$Id: magic.man,v 1.16 1999/11/28 20:02:29 christos Exp $ diff --git a/magic/Magdir/commands b/magic/Magdir/commands index 743336d8..16da1808 100644 --- a/magic/Magdir/commands +++ b/magic/Magdir/commands @@ -3,90 +3,46 @@ # commands: file(1) magic for various shells and interpreters # 0 string :\ shell archive or commands for antique kernel text -0 string #!/bin/sh Bourne shell script text -0 string #!\ /bin/sh Bourne shell script text -0 string #!\ /bin/sh Bourne shell script text -0 string #!/bin/csh C shell script text -0 string #!\ /bin/csh C shell script text -0 string #!\ /bin/csh C shell script text +0 string/b #!\ /bin/sh Bourne shell script text +0 string/b #!\ /bin/csh C shell script text # korn shell magic, sent by George Wu, gwu@clyde.att.com -0 string #!/bin/ksh Korn shell script text -0 string #!\ /bin/ksh Korn shell script text -0 string #!\ /bin/ksh Korn shell script text -0 string #!/bin/tcsh Tenex C shell script text -0 string #!\ /bin/tcsh Tenex C shell script text -0 string #!\ /bin/tcsh Tenex C shell script text -0 string #!/usr/local/tcsh Tenex C shell script text -0 string #!\ /usr/local/tcsh Tenex C shell script text -0 string #!/usr/local/bin/tcsh Tenex C shell script text -0 string #!\ /usr/local/bin/tcsh Tenex C shell script text -0 string #!\ /usr/local/bin/tcsh Tenex C shell script text +0 string/b #!\ /bin/ksh Korn shell script text +0 string/b #!\ /bin/tcsh Tenex C shell script text +0 string/b #!\ /usr/local/tcsh Tenex C shell script text +0 string/b #!\ /usr/local/bin/tcsh Tenex C shell script text + # # zsh/ash/ae/nawk/gawk magic from cameron@cs.unsw.oz.au (Cameron Simpson) -0 string #!/usr/local/bin/zsh Paul Falstad's zsh -0 string #!\ /usr/local/bin/zsh Paul Falstad's zsh -0 string #!\ /usr/local/bin/zsh Paul Falstad's zsh -0 string #!/usr/local/bin/ash Neil Brown's ash -0 string #!\ /usr/local/bin/ash Neil Brown's ash -0 string #!\ /usr/local/bin/ash Neil Brown's ash -0 string #!/usr/local/bin/ae Neil Brown's ae -0 string #!\ /usr/local/bin/ae Neil Brown's ae -0 string #!\ /usr/local/bin/ae Neil Brown's ae -0 string #!/bin/nawk new awk script text -0 string #!\ /bin/nawk new awk script text -0 string #!\ /bin/nawk new awk script text -0 string #!/usr/bin/nawk new awk script text -0 string #!\ /usr/bin/nawk new awk script text -0 string #!\ /usr/bin/nawk new awk script text -0 string #!/usr/local/bin/nawk new awk script text -0 string #!\ /usr/local/bin/nawk new awk script text -0 string #!\ /usr/local/bin/nawk new awk script text -0 string #!/bin/gawk GNU awk script text -0 string #!\ /bin/gawk GNU awk script text -0 string #!\ /bin/gawk GNU awk script text -0 string #!/usr/bin/gawk GNU awk script text -0 string #!\ /usr/bin/gawk GNU awk script text -0 string #!\ /usr/bin/gawk GNU awk script text -0 string #!/usr/local/bin/gawk GNU awk script text -0 string #!\ /usr/local/bin/gawk GNU awk script text -0 string #!\ /usr/local/bin/gawk GNU awk script text +0 string/b #!\ /usr/local/bin/zsh Paul Falstad's zsh +0 string/b #!\ /usr/local/bin/ash Neil Brown's ash +0 string/b #!\ /usr/local/bin/ae Neil Brown's ae +0 string/b #!\ /bin/nawk new awk script text +0 string/b #!\ /usr/bin/nawk new awk script text +0 string/b #!\ /usr/local/bin/nawk new awk script text +0 string/b #!\ /bin/gawk GNU awk script text +0 string/b #!\ /usr/bin/gawk GNU awk script text +0 string/b #!\ /usr/local/bin/gawk GNU awk script text # -0 string #!/bin/awk awk commands text -0 string #!\ /bin/awk awk commands text -0 string #!\ /bin/awk awk commands text -0 string #!/usr/bin/awk awk commands text -0 string #!\ /usr/bin/awk awk commands text -0 string #!\ /usr/bin/awk awk commands text +0 string/b #!\ /bin/awk awk commands text +0 string/b #!\ /usr/bin/awk awk commands text 0 string BEGIN awk commands text # For Larry Wall's perl language. The ``eval'' line recognizes an # outrageously clever hack for USG systems. # Keith Waclena -0 string #!/bin/perl perl commands text -0 string #!\ /bin/perl perl commands text -0 string #!\ /bin/perl perl commands text +0 string/b #!\ /bin/perl perl commands text 0 string eval\ "exec\ /bin/perl perl commands text -0 string #!/usr/bin/perl perl commands text -0 string #!\ /usr/bin/perl perl commands text -0 string #!\ /usr/bin/perl perl commands text +0 string/b #!\ /usr/bin/perl perl commands text 0 string eval\ "exec\ /usr/bin/perl perl commands text -0 string #!/usr/local/bin/perl perl commands text -0 string #!\ /usr/local/bin/perl perl commands text -0 string #!\ /usr/local/bin/perl perl commands text +0 string/b #!\ /usr/local/bin/perl perl commands text 0 string eval\ "exec\ /usr/local/bin/perl perl commands text # AT&T Bell Labs' Plan 9 shell -0 string #!/bin/rc Plan 9 rc shell script text -0 string #!\ /bin/rc Plan 9 rc shell script text -0 string #!\ /bin/rc Plan 9 rc shell script text +0 string/b #!\ /bin/rc Plan 9 rc shell script text # bash shell magic, from Peter Tobias (tobias@server.et-inf.fho-emden.de) -0 string #!/bin/bash Bourne-Again shell script text -0 string #!\ /bin/bash Bourne-Again shell script text -0 string #!\ /bin/bash Bourne-Again shell script text -0 string #!/usr/local/bin/bash Bourne-Again shell script text -0 string #!\ /usr/local/bin/bash Bourne-Again shell script text -0 string #!\ /usr/local/bin/bash Bourne-Again shell script text +0 string/b #!\ /bin/bash Bourne-Again shell script text +0 string/b #!\ /usr/local/bin/bash Bourne-Again shell script text # generic shell magic 0 string #!\ / a diff --git a/magic/Magdir/fonts b/magic/Magdir/fonts index 91fc7f8d..d0dc2259 100644 --- a/magic/Magdir/fonts +++ b/magic/Magdir/fonts @@ -46,3 +46,6 @@ 7 belong 0x00564944 DOS code page font data (from Linux?) 4098 string DOSFONT DOSFONT2 encrypted font data +# downloadable fonts for browser (prints type) anthon@mnt.org +0 string PFR1 PFR1 font +>102 string >0 \b: %s diff --git a/magic/Magdir/sgml b/magic/Magdir/sgml index 359b83b2..e831c3c3 100644 --- a/magic/Magdir/sgml +++ b/magic/Magdir/sgml @@ -3,26 +3,18 @@ # sgml: file(1) magic for Standard Generalized Markup Language # HyperText Markup Language (HTML) is an SGML document type, # from Daniel Quinlan (quinlan@yggdrasil.com) -0 string \32 lelong x (%d/ +>36 lelong x \b%d/ +>40 lelong x \b%d) diff --git a/src/acconfig.h b/src/acconfig.h index 43df0768..4cd46b7f 100644 --- a/src/acconfig.h +++ b/src/acconfig.h @@ -2,7 +2,7 @@ #define PACKAGE "file" /* Autoheader needs me */ -#define VERSION "3.27" +#define VERSION "3.29" /* Define if builtin ELF support is enabled. */ #undef BUILTIN_ELF diff --git a/src/apprentice.c b/src/apprentice.c index 46ac353d..07429c8c 100644 --- a/src/apprentice.c +++ b/src/apprentice.c @@ -33,7 +33,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$Id: apprentice.c,v 1.29 1999/10/31 22:23:03 christos Exp $") +FILE_RCSID("@(#)$Id: apprentice.c,v 1.30 1999/11/28 20:02:28 christos Exp $") #endif /* lint */ #define EATAB {while (isascii((unsigned char) *l) && \ @@ -336,6 +336,28 @@ int *ndx, check; ++l; m->mask = signextend(m, strtoul(l, &l, 0)); eatsize(&l); + } else if (STRING == m->type) { + m->mask = 0L; + if (*l == '/') { + while (!isspace(*++l)) { + switch (*l) { + case CHAR_IGNORE_LOWERCASE: + m->mask |= STRING_IGNORE_LOWERCASE; + break; + case CHAR_COMPACT_BLANK: + m->mask |= STRING_COMPACT_BLANK; + break; + case CHAR_COMPACT_OPTIONAL_BLANK: + m->mask |= + STRING_COMPACT_OPTIONAL_BLANK; + break; + default: + magwarn("string extension %c invalid", + *l); + return -1; + } + } + } } else m->mask = ~0L; EATAB; diff --git a/src/ascmagic.c b/src/ascmagic.c index 355881f6..bda23915 100644 --- a/src/ascmagic.c +++ b/src/ascmagic.c @@ -38,7 +38,7 @@ #include "names.h" #ifndef lint -FILE_RCSID("@(#)$Id: ascmagic.c,v 1.24 1999/02/14 17:16:00 christos Exp $") +FILE_RCSID("@(#)$Id: ascmagic.c,v 1.25 1999/11/28 20:02:29 christos Exp $") #endif /* lint */ /* an optimisation over plain strcmp() */ @@ -93,7 +93,7 @@ int nbytes; /* size actually read */ /* Make sure we are dealing with ascii text before looking for tokens */ for (i = 0; i < nbytes; i++) { - if (!isascii(buf[i])) + if (!isascii(buf[i]) && !isalpha(buf[i])) return 0; /* not all ASCII */ } diff --git a/src/compress.c b/src/compress.c index 951f864f..7b73e315 100644 --- a/src/compress.c +++ b/src/compress.c @@ -19,7 +19,7 @@ #include #endif #ifndef lint -FILE_RCSID("@(#)$Id: compress.c,v 1.14 1999/10/31 22:23:03 christos Exp $") +FILE_RCSID("@(#)$Id: compress.c,v 1.15 1999/11/28 20:02:29 christos Exp $") #endif @@ -35,6 +35,7 @@ static struct { { "\037\240", 2, { "gzip", "-cdq", NULL }, 1 }, /* SCO LZH */ /* the standard pack utilities do not accept standard input */ { "\037\036", 2, { "gzip", "-cdq", NULL }, 0 }, /* packed */ + { "BZh", 3, { "bzip2", "-d", NULL }, 1 }, /* bzip2-ed */ }; static int ncompr = sizeof(compr) / sizeof(compr[0]); diff --git a/src/file.c b/src/file.c index dc64bdb1..c32ccbef 100644 --- a/src/file.c +++ b/src/file.c @@ -49,13 +49,16 @@ #ifdef HAVE_UNISTD_H #include /* for read() */ #endif +#ifdef HAVE_LOCALE_H +#include +#endif #include /* for byte swapping */ #include "patchlevel.h" #ifndef lint -FILE_RCSID("@(#)$Id: file.c,v 1.47 1999/10/31 22:23:03 christos Exp $") +FILE_RCSID("@(#)$Id: file.c,v 1.48 1999/11/28 20:02:29 christos Exp $") #endif /* lint */ @@ -110,6 +113,10 @@ main(argc, argv) int c; int check = 0, didsomefiles = 0, errflg = 0, ret = 0, app = 0; +#ifdef LC_CTYPE + setlocale(LC_CTYPE, ""); /* makes islower etc work for other langs */ +#endif + if ((progname = strrchr(argv[0], '/')) != NULL) progname++; else diff --git a/src/file.h b/src/file.h index a481ef0d..0206fa89 100644 --- a/src/file.h +++ b/src/file.h @@ -1,6 +1,6 @@ /* * file.h - definitions for file(1) program - * @(#)$Id: file.h,v 1.29 1999/02/14 17:16:06 christos Exp $ + * @(#)$Id: file.h,v 1.30 1999/11/28 20:02:29 christos Exp $ * * Copyright (c) Ian F. Darwin, 1987. * Written by Ian F. Darwin. @@ -81,6 +81,15 @@ struct magic { char desc[MAXDESC]; /* description */ }; +#define BIT(A) (1 << (A)) +#define STRING_IGNORE_LOWERCASE BIT(0) +#define STRING_COMPACT_BLANK BIT(1) +#define STRING_COMPACT_OPTIONAL_BLANK BIT(2) +#define CHAR_IGNORE_LOWERCASE 'c' +#define CHAR_COMPACT_BLANK 'B' +#define CHAR_COMPACT_OPTIONAL_BLANK 'b' + + #include /* Include that here, to make sure __P gets defined */ #ifndef __P diff --git a/src/patchlevel.h b/src/patchlevel.h index d6327671..c5a05cfd 100644 --- a/src/patchlevel.h +++ b/src/patchlevel.h @@ -1,11 +1,15 @@ #define FILE_VERSION_MAJOR 3 -#define patchlevel 28 +#define patchlevel 29 /* * Patchlevel file for Ian Darwin's MAGIC command. - * $Id: patchlevel.h,v 1.28 1999/10/31 22:11:48 christos Exp $ + * $Id: patchlevel.h,v 1.29 1999/11/28 20:02:29 christos Exp $ * * $Log: patchlevel.h,v $ + * Revision 1.29 1999/11/28 20:02:29 christos + * new string/[Bcb] magic from anton, and adjustments to the magic files to + * use it. + * * Revision 1.28 1999/10/31 22:11:48 christos * - add "char" type for compatibility with HP/UX * - recognize HP/UX syntax &=n etc. diff --git a/src/print.c b/src/print.c index 03f9b0c5..38dfcb3b 100644 --- a/src/print.c +++ b/src/print.c @@ -41,7 +41,7 @@ #include #ifndef lint -FILE_RCSID("@(#)$Id: print.c,v 1.29 1999/10/31 22:23:04 christos Exp $") +FILE_RCSID("@(#)$Id: print.c,v 1.30 1999/11/28 20:02:29 christos Exp $") #endif /* lint */ #define SZOF(a) (sizeof(a) / sizeof(a[0])) @@ -68,8 +68,20 @@ struct magic *m; (void) fprintf(stderr, " %s%s", (m->flag & UNSIGNED) ? "u" : "", /* Note: type is unsigned */ (m->type < SZOF(typ)) ? typ[m->type] : "*bad*"); - if (m->mask != ~((uint32)0)) - (void) fprintf(stderr, " & %.8x", m->mask); + if (m->mask != ~((uint32)0)) { + if(STRING != m->type) + (void) fprintf(stderr, " & %.8x", m->mask); + else { + (void) fputc('/', stderr); + if (m->mask & STRING_IGNORE_LOWERCASE) + (void) fputc(CHAR_IGNORE_LOWERCASE, stderr); + if (m->mask & STRING_COMPACT_BLANK) + (void) fputc(CHAR_COMPACT_BLANK, stderr); + if (m->mask & STRING_COMPACT_OPTIONAL_BLANK) + (void) fputc(CHAR_COMPACT_OPTIONAL_BLANK, + stderr); + } + } (void) fprintf(stderr, ",%c", m->reln); diff --git a/src/softmagic.c b/src/softmagic.c index 4a4ba80e..ea6fac56 100644 --- a/src/softmagic.c +++ b/src/softmagic.c @@ -27,6 +27,7 @@ #include #include +#include #include #include #include @@ -34,7 +35,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$Id: softmagic.c,v 1.39 1999/02/14 17:16:12 christos Exp $") +FILE_RCSID("@(#)$Id: softmagic.c,v 1.40 1999/11/28 20:02:30 christos Exp $") #endif /* lint */ static int match __P((unsigned char *, int)); @@ -428,30 +429,58 @@ struct magic *m; v = p->l; break; - case STRING: - l = 0; - /* What we want here is: + case STRING: { + /* + * What we want here is: * v = strncmp(m->value.s, p->s, m->vallen); * but ignoring any nulls. bcmp doesn't give -/+/0 * and isn't universally available anyway. */ + register unsigned char *a = (unsigned char*)m->value.s; + register unsigned char *b = (unsigned char*)p->s; + register int len = m->vallen; + l = 0; v = 0; - { - register unsigned char *a = (unsigned char*)m->value.s; - register unsigned char *b = (unsigned char*)p->s; - register int len = m->vallen; - + if (0L == m->mask) { /* normal string: do it fast */ while (--len >= 0) if ((v = *b++ - *a++) != '\0') - break; + break; + } else { /* combine the others */ + while (--len >= 0) { + if ((m->mask & STRING_IGNORE_LOWERCASE) && + islower(*a)) { + if ((v = tolower(*b++) - *a++) != '\0') + break; + } else if ((m->mask & STRING_COMPACT_BLANK) && + isspace(*a)) { + a++; + if (isspace(*b++)) { + while (isspace(*b)) + b++; + } else { + v = 1; + break; + } + } else if (isspace(*a) && + (m->mask & STRING_COMPACT_OPTIONAL_BLANK)) { + a++; + while (isspace(*b)) + b++; + } else { + if ((v = *b++ - *a++) != '\0') + break; + } + } } break; + } default: error("invalid type %d in mcheck().\n", m->type); return 0;/*NOTREACHED*/ } - v = signextend(m, v) & m->mask; + if(m->type != STRING) + v = signextend(m, v) & m->mask; switch (m->reln) { case 'x':