diff -a -x CVS -x Root -x Repository -x Tag -x Entries -x Entries.Log -x .svn -x '*.rej' -x '*.orig' -x .cvsignore -N -r -u ./config/configure.in ./config/configure.in
--- ./config/configure.in	2006-05-06 00:52:26.000000000 +0200
+++ ./config/configure.in	2006-05-12 14:24:03.000000000 +0200
@@ -253,6 +253,9 @@
 BZIP2=yes
 AC_ARG_ENABLE(bzip2,       [  --disable-bzip2         disable the use of bzip2], [BZIP2="$enableval"])
 
+MAGIC=yes
+AC_ARG_ENABLE(magic,       [  --disable-magic         disable the use of libmagic (GNU file)], [MAGIC="$enableval"])
+
 ifelse(AC_ACVERSION, [2.13], [],
 [dnl Large file enabled
    AC_SYS_LARGEFILE
@@ -594,6 +597,16 @@
   AC_DEFINE(USE_BZIP2, 1, [Define to 1 if you have bzip2 support.])
 fi
 
+if test "$MAGIC" != "no"; then
+  AC_CHECK_HEADERS(magic.h,[AC_CHECK_LIB(magic,magic_file,[MAGIC=yes],[MAGIC=no])],[MAGIC=no])
+fi
+
+if test "$MAGIC" = "yes"; then
+  MAGICLIB=Magic_magic
+else
+  MAGICLIB=Magic_nomagic
+fi
+
 AC_CHECK_HEADERS(byteswap.h,,)
 
 if test "$ICONV" = "yes"; then
@@ -1238,6 +1251,8 @@
 AC_SUBST(GD_CFLAGS)
 AC_SUBST(GD_LDFLAGS)
 AC_SUBST(BZIP2)
+AC_SUBST(MAGIC)
+AC_SUBST(MAGICLIB)
 
 BUILD_SYSTEM="`uname -s` `uname -m` `uname -r`"
 AC_SUBST(BUILD_SYSTEM)
@@ -1253,6 +1268,7 @@
   Makefile.config \
   mldonkey.rc \
   $AUTOCONF.new $GTK_AUTOCONF.new \
+   ../src/utils/lib/magic.ml \
    ../src/networks/donkey/donkeySui.ml \
    ../src/daemon/driver/driverGraphics.ml \
    ../packages/rpm/mldonkey.spec \
@@ -1372,6 +1388,13 @@
   echo "        disabled"
 fi
 
+echo -n " - libmagic          "
+if test "$MAGIC" = "yes"; then
+  echo "enabled"
+else
+  echo "        disabled"
+fi
+
 echo -n " - graphical stats   "
 if test "$GD" = "yes"; then
   echo "enabled"
diff -a -x CVS -x Root -x Repository -x Tag -x Entries -x Entries.Log -x .svn -x '*.rej' -x '*.orig' -x .cvsignore -N -r -u ./config/Makefile.config.in ./config/Makefile.config.in
--- ./config/Makefile.config.in	2006-02-11 20:52:57.000000000 +0100
+++ ./config/Makefile.config.in	2006-05-12 14:24:03.000000000 +0200
@@ -50,6 +50,7 @@
 GLIBC_VERSION=@GLIBC_VERSION@
 ICONV=@ICONV@
 BZIP2=@BZIP2@
+MAGIC=@MAGIC@
 
 GD=@GD@
 GD_JPG=@GD_JPG@
diff -a -x CVS -x Root -x Repository -x Tag -x Entries -x Entries.Log -x .svn -x '*.rej' -x '*.orig' -x .cvsignore -N -r -u ./config/Makefile.in ./config/Makefile.in
--- ./config/Makefile.in	2006-05-09 18:31:37.000000000 +0200
+++ ./config/Makefile.in	2006-05-12 14:37:44.000000000 +0200
@@ -193,6 +193,14 @@
   $(LIB)/stubs_c.c  $(LIB)/set2.ml $(LIB)/queues.ml \
   $(LIB)/charsetstubs.c $(LIB)/charset.ml
 
+ifeq ("$(MAGIC)", "yes")
+  MAGIC_LIBS_flags += -cclib -lmagic
+  MAGIC_SRCS = $(LIB)/magiclib.ml $(LIB)/magic_magic.ml $(LIB)/magiclib_stub.c
+else
+  MAGIC_SRCS = $(LIB)/magic_nomagic.ml
+endif
+MAGIC_SRCS += $(LIB)/magic.ml
+
 NET_SRCS = \
   $(NET)/basicSocket.ml \
   $(NET)/ip.ml $(NET)/ip_set.ml $(NET)/geoip.ml $(NET)/mailer.ml $(NET)/base64.ml  \
@@ -519,7 +527,7 @@
   $(CDK_SRCS) $(LIB_SRCS) tools/mlsplit.ml
 
 MAKE_TORRENT_SRCS = \
-  $(CDK_SRCS) $(LIB_SRCS) $(NET_SRCS) $(MP3TAG_SRCS) \
+  $(MAGIC_SRCS) $(CDK_SRCS) $(LIB_SRCS) $(NET_SRCS) $(MP3TAG_SRCS) \
   $(CHAT_SRCS) $(COMMON_SRCS) $(COMMON_CLIENT_SRCS) $(BITTORRENT_SRCS) \
   tools/make_torrent.ml
 
@@ -562,16 +570,16 @@
 ICONS_CMXA=icons.cmxa
 
 CDK_CMXA=cdk.cmxa
-MLNET_CMXA=cdk.cmxa common.cmxa client.cmxa core.cmxa driver.cmxa
+MLNET_CMXA=$(CDK_CMXA) magic.cmxa common.cmxa client.cmxa core.cmxa driver.cmxa
 MLNET_SRCS= $(MAIN_SRCS)
 
 ifeq ("$(GUI)", "newgui2")
 mlnet+gui_CMXA= \
-  cdk.cmxa common.cmxa client.cmxa core.cmxa driver.cmxa \
+  magic.cmxa cdk.cmxa common.cmxa client.cmxa core.cmxa driver.cmxa \
   icons.cmxa guibase.cmxa gui.cmxa
 else
 mlnet+gui_CMXA= \
-  cdk.cmxa common.cmxa client.cmxa core.cmxa driver.cmxa \
+  magic.cmxa cdk.cmxa common.cmxa client.cmxa core.cmxa driver.cmxa \
   gmisc.cmxa icons.cmxa guibase.cmxa gui.cmxa
 endif
 
@@ -749,6 +757,7 @@
   $(COMMON)/commonTypes.ml \
   $(COMMON)/commonOptions.ml \
   $(COMMON)/commonMessages.ml \
+  $(COMMON)/commonUserDb.ml \
   $(COMMON)/commonGlobals.ml \
   $(COMMON)/commonWeb.ml \
   $(COMMON)/commonHasher.ml \
@@ -1362,7 +1371,7 @@
 runtop: top
 	./mldonkeytop $(INCLUDES)
 
-TOP_CMXA=cdk.cmxa common.cmxa client.cmxa core.cmxa
+TOP_CMXA+=cdk.cmxa magic.cmxa common.cmxa client.cmxa core.cmxa
 TOP_SRCS= 
 
 define([[EXPAND_LIB]],[[
@@ -1403,7 +1412,7 @@
 
 endif
 
-$1_CMXA= cdk.cmxa common.cmxa client.cmxa $1.cmxa driver.cmxa
+$1_CMXA+= cdk.cmxa magic.cmxa common.cmxa client.cmxa $1.cmxa driver.cmxa
 
 ifeq ("$2", "DONKEY")
 $1_SRCS+= $(CRYPTOPP_SRCS) $(MAIN_SRCS)
@@ -1438,6 +1447,7 @@
 EXPAND_DRIVER(mlslsk,SOULSEEK,soulseek)
 
 libcdk_SRCS=  $(CDK_SRCS) $(LIB_SRCS) $(NET_SRCS) $(MP3TAG_SRCS)
+libmagic_SRCS= $(MAGIC_SRCS)
 libcommon_SRCS= $(CHAT_SRCS) $(COMMON_SRCS)
 libclient_SRCS= $(COMMON_CLIENT_SRCS)
 ifeq ("$(GUI)", "newgui2")
@@ -1452,6 +1462,7 @@
 
 EXPAND_LIB(libicons,icons)
 EXPAND_LIB(libcdk,cdk)
+EXPAND_LIB(libmagic,magic)
 EXPAND_LIB(libcommon,common)
 EXPAND_LIB(libclient,client)
 EXPAND_LIB(DRIVER,driver)
@@ -1506,17 +1517,43 @@
 TMPSOURCES += $($1_ML4:.ml4=.ml) $($1_MLT:.mlt=.ml) $($1_MLP:.mlcpp=.ml) $($1_MLL:.mll=.ml) $($1_MLY:.mly=.ml) $($1_MLY:.mly=.mli) $($1_ZOG:.zog=.ml) 
  
 $2: $($1_OBJS) $($1_CMXS) $($1_CMXAS)
-	$(OCAMLOPT) -linkall $(PLUGIN_FLAG) -o $[[@]] $($1_OBJS) $(LIBS_opt) $(LIBS_flags) $($3_LIBS_opt) $($3_LIBS_flags) $($5_LIBS_opt) $($5_LIBS_flags) $($6_LIBS_opt) $($6_LIBS_flags) -I build $($1_CMXAS) $($1_CMXS) 
+	$(OCAMLOPT) -linkall $(PLUGIN_FLAG) -o $[[@]] \
+	$($1_OBJS) $(LIBS_opt) $(LIBS_flags) \
+	$($3_LIBS_opt) $($3_LIBS_flags) \
+	$($5_LIBS_opt) $($5_LIBS_flags) \
+	$($6_LIBS_opt) $($6_LIBS_flags) \
+	$($7_LIBS_opt) $($7_LIBS_flags) \
+	-I build $($1_CMXAS) $($1_CMXS) 
  
 $2.byte: $($1_OBJS) $($1_CMOS) $($1_CMAS)
-	$(OCAMLC) -linkall -o $[[@]] $($1_OBJS) $(LIBS_byte) $(LIBS_flags) $($3_LIBS_byte) $($3_LIBS_flags) $($5_LIBS_byte) $($5_LIBS_flags) $($6_LIBS_byte) $($6_LIBS_flags) -I build $($1_CMAS) $($1_CMOS) 
+	$(OCAMLC) -linkall -o $[[@]] \
+	$($1_OBJS) $(LIBS_byte) $(LIBS_flags) \
+	$($3_LIBS_byte) $($3_LIBS_flags) \
+	$($5_LIBS_byte) $($5_LIBS_flags) \
+	$($6_LIBS_byte) $($6_LIBS_flags) \
+	$($7_LIBS_byte) $($7_LIBS_flags) \
+	-I build $($1_CMAS) $($1_CMOS) 
  
 $2.static: $($1_OBJS) $($1_CMXS) $($1_CMXAS)
-	$(OCAMLOPT) -linkall $(PLUGIN_FLAG) -ccopt -static -o $[[@]] $($1_OBJS) $(LIBS_opt) $(LIBS_flags) $($3_LIBS_flags) $($3_STATIC_LIBS_opt) $($5_LIBS_flags) $($5_STATIC_LIBS_opt) $($6_LIBS_flags) $($6_STATIC_LIBS_opt) -I build $($1_CMXAS) $($1_CMXS)
+	$(OCAMLOPT) -linkall $(PLUGIN_FLAG) -ccopt -static -o $[[@]] \
+	$($1_OBJS) $(LIBS_opt) $(LIBS_flags) \
+	$($3_LIBS_flags) $($3_STATIC_LIBS_opt) \
+	$($5_LIBS_flags) $($5_STATIC_LIBS_opt) \
+	$($6_LIBS_flags) $($6_STATIC_LIBS_opt) \
+	$($7_LIBS_flags) $($7_STATIC_LIBS_opt) \
+	-I build $($1_CMXAS) $($1_CMXS)
 ]])
 
-EXPAND(mldonkey,mldonkey,NO,mldonkey,GD,CRYPTOPP)
-EXPAND(mldonkey+gui,mldonkey+gui,GTK,mldonkey+gui,GD,CRYPTOPP)
+# $1 = source-code collection
+# $2 = make target
+# $3 = GUI type (NO/GTK)
+# $4 = not used
+# $5 = if set link GD code
+# $6 = if set link CryptoPP code (only for targets mlnet, mldonkey)
+# $7 = if set link libmagic code (only for p2p core, not for GUIs, tools etc.)
+
+EXPAND(mldonkey,mldonkey,NO,mldonkey,GD,CRYPTOPP,MAGIC)
+EXPAND(mldonkey+gui,mldonkey+gui,GTK,mldonkey+gui,GD,CRYPTOPP,MAGIC)
 EXPAND(MLPROGRESS, mlprogress,GTK, MLPROGRESS)
 EXPAND(MLDONKEYGUI,mlgui,GTK,MLDONKEYGUI)
 
@@ -1524,31 +1561,31 @@
  EXPAND(MLDONKEYGUI2,mlgui2,GTK,MLDONKEYGUI2)
 endif
 
-EXPAND(mldc,mldc,NO,mldc,GD)
-EXPAND(mldc+gui,mldc+gui,GTK,mldc+gui,GD)
-EXPAND(mlnap,mlnap,NO,mlnap,GD)
-EXPAND(mlnap+gui,mlnap+gui,GTK,mlnap+gui,GD)
-EXPAND(MLNET,mlnet,NO,MLNET,GD,CRYPTOPP)
-EXPAND(mlnet+gui,mlnet+gui,GTK,mlnet+gui,GD,CRYPTOPP)
-EXPAND(mlgnut,mlgnut,NO,mlgnut,GD)
-EXPAND(mlgnut+gui,mlgnut+gui,GTK,mlgnut+gui,GD)
-EXPAND(mlg2,mlg2,NO,mlg2,GD)
-EXPAND(mlg2+gui,mlg2+gui,GTK,mlg2+gui,GD)
-EXPAND(mlbt,mlbt,NO,mlbt,GD)
-EXPAND(mlbt+gui,mlbt+gui,GTK,mlbt+gui,GD)
-EXPAND(mlfasttrack,mlfasttrack,NO,mlfasttrack,GD)
-EXPAND(mlfasttrack+gui,mlfasttrack+gui,GTK,mlfasttrack+gui,GD)
-EXPAND(mlfileTP,mlfiletp,NO,mlfileTP,GD)
-EXPAND(mlfileTP+gui,mlfiletp+gui,GTK,mlfileTP+gui,GD)
-EXPAND(mlslsk,mlslsk,NO,mlslsk,GD)
-EXPAND(mlslsk+gui,mlslsk+gui,GTK,mlslsk+gui,GD)
+EXPAND(mldc,mldc,NO,mldc,GD,NO,MAGIC)
+EXPAND(mldc+gui,mldc+gui,GTK,mldc+gui,GD,NO,MAGIC)
+EXPAND(mlnap,mlnap,NO,mlnap,GD,NO,MAGIC)
+EXPAND(mlnap+gui,mlnap+gui,GTK,mlnap+gui,GD,NO,MAGIC)
+EXPAND(MLNET,mlnet,NO,MLNET,GD,CRYPTOPP,MAGIC)
+EXPAND(mlnet+gui,mlnet+gui,GTK,mlnet+gui,GD,CRYPTOPP,MAGIC)
+EXPAND(mlgnut,mlgnut,NO,mlgnut,GD,NO,MAGIC)
+EXPAND(mlgnut+gui,mlgnut+gui,GTK,mlgnut+gui,GD,NO,MAGIC)
+EXPAND(mlg2,mlg2,NO,mlg2,GD,NO,MAGIC)
+EXPAND(mlg2+gui,mlg2+gui,GTK,mlg2+gui,GD,NO,MAGIC)
+EXPAND(mlbt,mlbt,NO,mlbt,GD,NO,MAGIC)
+EXPAND(mlbt+gui,mlbt+gui,GTK,mlbt+gui,GD,NO,MAGIC)
+EXPAND(mlfasttrack,mlfasttrack,NO,mlfasttrack,GD,NO,MAGIC)
+EXPAND(mlfasttrack+gui,mlfasttrack+gui,GTK,mlfasttrack+gui,GD,NO,MAGIC)
+EXPAND(mlfileTP,mlfiletp,NO,mlfileTP,GD,NO,MAGIC)
+EXPAND(mlfileTP+gui,mlfiletp+gui,GTK,mlfileTP+gui,GD,NO,MAGIC)
+EXPAND(mlslsk,mlslsk,NO,mlslsk,GD,NO,MAGIC)
+EXPAND(mlslsk+gui,mlslsk+gui,GTK,mlslsk+gui,GD,NO,MAGIC)
 EXPAND(MLDONKEY_IM,mlim,GTK,MLDONKEY_IM)
 EXPAND(STARTER,mlguistarter,GTK)
 EXPAND(MLCHAT,mlchat,GTK,MLCHAT)
 EXPAND(OBSERVER,observer)
 EXPAND(MLD_HASH,mld_hash)
 EXPAND(OCAMLPP,ocamlpp)
-EXPAND(MAKE_TORRENT,make_torrent)
+EXPAND(MAKE_TORRENT,make_torrent,NO,NO,NO,NO,MAGIC)
 EXPAND(SUBCONV,subconv)
 EXPAND(MLSPLIT,mlsplit)
 EXPAND(CONTESTER,contester,CRYPT)
@@ -1590,8 +1627,12 @@
 TMPSOURCES += $(TOP_ML4:.ml4=.ml) $(TOP_MLL:.mll=.ml) $(TOP_MLY:.mly=.ml) $(TOP_MLY:.mly=.mli) $(TOP_ZOG:.zog=.ml) 
 
 mldonkeytop: $(TOP_OBJS) $(TOP_CMOS) $(TOP_CMAS)
-	$(OCAMLMKTOP) -linkall $(PLUGIN_FLAG) -o $@  $(TOP_OBJS) $(LIBS_byte) $(LIBS_flags) $(_LIBS_byte) $(_LIBS_flags) $(CRYPTOPP_LIBS_byte) $(CRYPTOPP_LIBS_flags) -I build $(TOP_CMAS) $(TOP_CMOS)
-
+	$(OCAMLMKTOP) -linkall $(PLUGIN_FLAG) -o $@  \
+	$(TOP_OBJS) \
+	$(LIBS_byte) $(LIBS_flags) $(_LIBS_byte) $(_LIBS_flags) \
+	$(CRYPTOPP_LIBS_byte) $(CRYPTOPP_LIBS_flags) \
+	$(MAGIC_LIBS_byte) $(MAGIC_LIBS_flags) \
+	-I build $(TOP_CMAS) $(TOP_CMOS)
 
 
 #######################################################################
@@ -1699,6 +1740,7 @@
 	rm -f src/utils/lib/autoconf.ml.new
 	rm -f src/utils/lib/gAutoconf.ml
 	rm -f src/utils/lib/gAutoconf.ml.new
+	rm -f src/utils/lib/magic.ml
 	rm -f src/utils/lib/misc2.ml
 	rm -f src/utils/cdk/tar.ml
 	rm -f icons/tux/*.ml_icons
diff -a -x CVS -x Root -x Repository -x Tag -x Entries -x Entries.Log -x .svn -x '*.rej' -x '*.orig' -x .cvsignore -N -r -u ./distrib/mldonkey_gui_started_for_macosx ./distrib/mldonkey_gui_started_for_macosx
--- ./distrib/mldonkey_gui_started_for_macosx	2002-02-09 10:47:12.000000000 +0100
+++ ./distrib/mldonkey_gui_started_for_macosx	1970-01-01 01:00:00.000000000 +0100
@@ -1,6 +0,0 @@
-#! /bin/sh 
-
-DYLD_LIBRARY_PATH=/sw/lib 
-export DYLD_LIBRARY_PATH
-
-./mldonkey_gui & 
\ Kein Zeilenumbruch am Dateiende.
diff -a -x CVS -x Root -x Repository -x Tag -x Entries -x Entries.Log -x .svn -x '*.rej' -x '*.orig' -x .cvsignore -N -r -u ./src/daemon/common/commonComplexOptions.ml ./src/daemon/common/commonComplexOptions.ml
--- ./src/daemon/common/commonComplexOptions.ml	2006-04-03 22:50:08.000000000 +0200
+++ ./src/daemon/common/commonComplexOptions.ml	2006-05-12 14:24:03.000000000 +0200
@@ -99,18 +99,20 @@
                 normalize_time (get_value "file_age" value_to_int)
             with _ -> ());
           set_file_state file file_state;       
-          if !verbose then
-          (match file_state with
-              FileDownloading -> lprintf_nl () "New downloading file - check complete";
-            | FileDownloaded -> lprintf_nl () "New downloaded file - check complete";
-            | _ -> lprintf_nl () "New file with other state - check complete"
-          );
-          
+
           (try
               set_file_best_name file
               (get_value "file_filename" value_to_string)
             with _ -> ());
           set_file_priority file priority;
+
+          if !verbose then lprintf_nl () "New %s file %s"
+	      (match file_state with
+                 FileDownloading -> "downloading"
+               | FileDownloaded -> "downloaded"
+               | _ -> "other")
+	     (file_best_name file);
+
           file
       | _ -> assert false
           
diff -a -x CVS -x Root -x Repository -x Tag -x Entries -x Entries.Log -x .svn -x '*.rej' -x '*.orig' -x .cvsignore -N -r -u ./src/daemon/common/commonFile.ml ./src/daemon/common/commonFile.ml
--- ./src/daemon/common/commonFile.ml	2006-01-16 17:05:14.000000000 +0100
+++ ./src/daemon/common/commonFile.ml	2006-05-12 14:24:03.000000000 +0200
@@ -58,6 +58,7 @@
     mutable impl_file_last_received : (int64 * int) list;
     mutable impl_file_last_rate : float;
     mutable impl_file_best_name : string;
+    mutable impl_file_magic : string option;
     mutable impl_file_priority: int; (* normal = 0, low < 0, high > 0 *)
     mutable impl_file_last_seen : int;
     mutable impl_file_probable_name : string option;
@@ -128,6 +129,7 @@
     impl_file_last_received = [];
     impl_file_last_rate = 0.0;
     impl_file_best_name = "<UNKNOWN>";
+    impl_file_magic = None;
     impl_file_priority = 0;
     impl_file_last_seen = 0;
     impl_file_comment = "";
@@ -442,6 +444,14 @@
       file_must_update file
     end
 
+let file_magic file =
+  (as_file_impl file).impl_file_magic
+  
+let set_file_magic file magic =
+  match magic with
+    None -> ()
+  | Some magic -> (as_file_impl file).impl_file_magic <- Some (HashMagic.merge files_magic magic)
+    
 let set_file_last_seen file age =
   let impl = as_file_impl file in
   impl.impl_file_last_seen <- age
@@ -614,6 +624,13 @@
             info.G.file_chunks
         ) ];
 
+      (match file_magic file with
+        Some magic ->
+	    Printf.bprintf buf "\\</tr\\>\\<tr class=\\\"dl-2\\\"\\>";
+	    html_mods_td buf [
+            ("File type computed by libmagic", "sr br", "File magic");
+            ("", "sr", magic) ]
+       | _ -> ());
 
       file_print_html file buf;
       
@@ -622,10 +639,13 @@
 
     end else
     begin
-      Printf.bprintf buf "[%-s %5d]\n%s\n%s\nTotal   %10s\nPartial %10s\npriority %d\n"
+      Printf.bprintf buf "[%-s %5d]\n%s\n%s%s\nTotal   %10s\nPartial %10s\npriority %d\n"
         n.network_name
         (file_num file)
         (String2.shorten 80 (file_best_name file))
+	(match file_magic file with
+	   Some magic -> Printf.sprintf "%s\n" magic
+	 | None -> "")
         (string_of_uids info.G.file_uids)
         (Int64.to_string info.G.file_size)
         (Int64.to_string info.G.file_downloaded)
@@ -867,6 +887,9 @@
       ) files_by_num;
       Printf.bprintf buf "  files: %d\n" !counter;
       Printf.bprintf buf "  files_ops: %d\n" (List.length !files_ops);
+      let counter = ref 0 in
+      HashMagic.iter (fun _ -> incr counter) files_magic;
+      Printf.bprintf buf "  files_magic: %d\n" !counter;
   )
 
 
diff -a -x CVS -x Root -x Repository -x Tag -x Entries -x Entries.Log -x .svn -x '*.rej' -x '*.orig' -x .cvsignore -N -r -u ./src/daemon/common/commonFile.mli ./src/daemon/common/commonFile.mli
--- ./src/daemon/common/commonFile.mli	2006-01-16 17:05:14.000000000 +0100
+++ ./src/daemon/common/commonFile.mli	2006-05-12 14:24:03.000000000 +0200
@@ -33,6 +33,7 @@
   mutable impl_file_last_received : (int64 * int) list;
   mutable impl_file_last_rate : float;
   mutable impl_file_best_name : string;
+  mutable impl_file_magic : string option;
   mutable impl_file_priority : int;
     mutable impl_file_last_seen : int;
     mutable impl_file_probable_name : string option;
@@ -116,6 +117,8 @@
 val file_debug : CommonTypes.file -> string
 val set_file_comment : CommonTypes.file -> string -> unit
 val file_comment : CommonTypes.file -> string
+val file_magic : CommonTypes.file -> string option
+val set_file_magic : CommonTypes.file -> string option -> unit
   
 val recover_bytes : CommonTypes.file -> (int64 * int64) list
 val file_write : CommonTypes.file -> int64 -> string -> int -> int -> unit
diff -a -x CVS -x Root -x Repository -x Tag -x Entries -x Entries.Log -x .svn -x '*.rej' -x '*.orig' -x .cvsignore -N -r -u ./src/daemon/common/commonGlobals.ml ./src/daemon/common/commonGlobals.ml
--- ./src/daemon/common/commonGlobals.ml	2006-04-03 22:50:08.000000000 +0200
+++ ./src/daemon/common/commonGlobals.ml	2006-05-12 14:24:03.000000000 +0200
@@ -865,3 +865,10 @@
       activity := new_activity ()
   )
 
+module HashMagic = Weak.Make(struct
+        type t = string
+        let hash s = Hashtbl.hash s
+        let equal x y = x = y
+      end)
+
+let files_magic = HashMagic.create 100
diff -a -x CVS -x Root -x Repository -x Tag -x Entries -x Entries.Log -x .svn -x '*.rej' -x '*.orig' -x .cvsignore -N -r -u ./src/daemon/common/commonShared.ml ./src/daemon/common/commonShared.ml
--- ./src/daemon/common/commonShared.ml	2006-03-17 19:11:24.000000000 +0100
+++ ./src/daemon/common/commonShared.ml	2006-05-12 14:24:03.000000000 +0200
@@ -43,6 +43,7 @@
     mutable impl_shared_size : int64;
     mutable impl_shared_id : Md4.t;
     mutable impl_shared_requests : int;
+    mutable impl_shared_magic : string option
   }
   
 and 'a shared_ops = {
@@ -131,8 +132,6 @@
 let files_scanned_size = ref zero
   
 let new_shared dirname prio filename fullname =
-(*  lprintf "XXXXXXX\ndirname %s \nfilename %s \nfullname %s\n"
-    dirname filename fullname;  *)
   let fullname = Filename2.normalize fullname in
   let filename = Filename2.normalize filename in
   let dirname = try
@@ -209,6 +208,7 @@
     impl_shared_size = zero;
     impl_shared_id = Md4.null;
     impl_shared_requests = 0;
+    impl_shared_magic = None;
   }
   
   
diff -a -x CVS -x Root -x Repository -x Tag -x Entries -x Entries.Log -x .svn -x '*.rej' -x '*.orig' -x .cvsignore -N -r -u ./src/daemon/common/commonShared.mli ./src/daemon/common/commonShared.mli
--- ./src/daemon/common/commonShared.mli	2005-08-08 18:47:30.000000000 +0200
+++ ./src/daemon/common/commonShared.mli	2006-05-12 14:24:03.000000000 +0200
@@ -9,6 +9,7 @@
   mutable impl_shared_size : int64;
   mutable impl_shared_id : Md4.Md4.t;
   mutable impl_shared_requests : int;
+  mutable impl_shared_magic : string option
 } 
 and 'a shared_ops = {
   mutable op_shared_info : 'a -> GuiTypes.shared_info;
diff -a -x CVS -x Root -x Repository -x Tag -x Entries -x Entries.Log -x .svn -x '*.rej' -x '*.orig' -x .cvsignore -N -r -u ./src/daemon/common/commonUploads.ml ./src/daemon/common/commonUploads.ml
--- ./src/daemon/common/commonUploads.ml	2006-02-05 14:17:40.000000000 +0100
+++ ./src/daemon/common/commonUploads.ml	2006-05-12 14:24:03.000000000 +0200
@@ -690,6 +690,7 @@
           impl_shared_ops = shared_ops;
           impl_shared_val = sh;
           impl_shared_requests = 0;
+          impl_shared_magic = None
         }
       and sh = {
           shared_info = index;
diff -a -x CVS -x Root -x Repository -x Tag -x Entries -x Entries.Log -x .svn -x '*.rej' -x '*.orig' -x .cvsignore -N -r -u ./src/daemon/common/guiDecoding.ml ./src/daemon/common/guiDecoding.ml
--- ./src/daemon/common/guiDecoding.ml	2006-03-17 19:33:16.000000000 +0100
+++ ./src/daemon/common/guiDecoding.ml	2006-05-12 14:24:03.000000000 +0200
@@ -509,7 +509,7 @@
   get_list (fun s pos ->
     let name, pos = get_string s pos in
     let size, pos = get_int64 s pos, pos+8 in
-    (name, size), pos
+    (name, size, Some ""), pos
   ) s pos
   
 let get_file proto s pos = 
diff -a -x CVS -x Root -x Repository -x Tag -x Entries -x Entries.Log -x .svn -x '*.rej' -x '*.orig' -x .cvsignore -N -r -u ./src/daemon/common/guiEncoding.ml ./src/daemon/common/guiEncoding.ml
--- ./src/daemon/common/guiEncoding.ml	2006-03-29 17:41:33.000000000 +0200
+++ ./src/daemon/common/guiEncoding.ml	2006-05-12 14:24:03.000000000 +0200
@@ -541,7 +541,7 @@
       buf_string buf x
     
 let buf_sub_files buf l =
-  buf_list buf (fun buf (name, size) ->
+  buf_list buf (fun buf (name, size, _) ->
     buf_string buf name;
     buf_int64 buf size
   ) l
diff -a -x CVS -x Root -x Repository -x Tag -x Entries -x Entries.Log -x .svn -x '*.rej' -x '*.orig' -x .cvsignore -N -r -u ./src/daemon/common/guiTypes.ml ./src/daemon/common/guiTypes.ml
--- ./src/daemon/common/guiTypes.ml	2006-01-16 17:05:14.000000000 +0100
+++ ./src/daemon/common/guiTypes.ml	2006-05-12 14:24:03.000000000 +0200
@@ -142,7 +142,7 @@
     mutable file_last_seen : int;
     mutable file_priority : int;
     mutable file_uids : Uid.t list;
-    mutable file_sub_files : (string * int64) list;
+    mutable file_sub_files : (string * int64 * string option) list;
   }
   
 type user_info = {
@@ -246,7 +246,7 @@
     mutable shared_uploaded : int64;
     mutable shared_requests : int;
     mutable shared_uids : Uid.t list; (* net file UID *)
-    mutable shared_sub_files : (string * int64) list;
+    mutable shared_sub_files : (string * int64 * string option) list;
   }
   
   
diff -a -x CVS -x Root -x Repository -x Tag -x Entries -x Entries.Log -x .svn -x '*.rej' -x '*.orig' -x .cvsignore -N -r -u ./src/daemon/driver/driverCommands.ml ./src/daemon/driver/driverCommands.ml
--- ./src/daemon/driver/driverCommands.ml	2006-05-11 23:24:41.000000000 +0200
+++ ./src/daemon/driver/driverCommands.ml	2006-05-12 14:24:03.000000000 +0200
@@ -2044,6 +2044,23 @@
          _s ""
      ), "debug command (example: disk .)";
 
+     "debug_dir", Arg_one (fun arg o ->
+         let buf = o.conn_buf in
+	 let filelist = Unix2.list_directory arg in
+         Printf.bprintf buf "%d entries in dir %s\n" (List.length filelist) arg;
+	 List.iter (fun file ->
+           Printf.bprintf buf "%s\n     %s\nMime %s\n\n"
+	     file
+	     (match Magic.M.magic_fileinfo (Filename.concat arg file) false with
+	        None -> "unknown"
+	      | Some fileinfo -> fileinfo)
+	     (match Magic.M.magic_fileinfo (Filename.concat arg file) true with
+	        None -> "unknown"
+	      | Some fileinfo -> fileinfo)
+	 ) filelist;
+         _s ""
+     ), "debug command (example: disk .)";
+
      "debug_fileinfo", Arg_one (fun arg o ->
          let buf = o.conn_buf in
 	 (try
@@ -2285,10 +2302,9 @@
           (if !!html_mods_use_js_tooltips then
                         Printf.bprintf buf " onMouseOver=\\\"mOvr(this);setTimeout('popLayer(\\\\\'%s<br>%s\\\\\')',%d);setTimeout('hideLayer()',%d);return true;\\\" onMouseOut=\\\"mOut(this);hideLayer();setTimeout('hideLayer()',%d)\\\"\\>"
                         (Http_server.html_real_escaped (Filename.basename impl.impl_shared_codedname))
-(*			(match file_magic (file_find file.file_num) with
+			(match impl.impl_shared_magic with
 			   None -> ""
-			 | Some magic -> "File type: " ^ magic ^ "<br>") *)
-                        ""
+			 | Some magic -> "File type: " ^ magic ^ "<br>")
 			!!html_mods_js_tooltips_wait
 			!!html_mods_js_tooltips_timeout
 			!!html_mods_js_tooltips_wait
diff -a -x CVS -x Root -x Repository -x Tag -x Entries -x Entries.Log -x .svn -x '*.rej' -x '*.orig' -x .cvsignore -N -r -u ./src/daemon/driver/driverInteractive.ml ./src/daemon/driver/driverInteractive.ml
--- ./src/daemon/driver/driverInteractive.ml	2006-03-29 17:41:33.000000000 +0200
+++ ./src/daemon/driver/driverInteractive.ml	2006-05-12 14:24:03.000000000 +0200
@@ -125,6 +125,23 @@
     close_log ()
   end
 
+let file_magic_check () =
+  if !Autoconf.magic_works then begin
+    if !verbose then lprintf_nl () "computing file magic values";
+    let check_magic file =
+      match Magic.M.magic_fileinfo (file_disk_name file) false with
+        None -> ()
+      | Some magic -> set_file_magic file (Some magic)
+    in
+    List.iter (fun file ->
+      let magic = file_magic file in
+      match magic with
+        None -> check_magic file
+      | Some magic when magic = "data" -> check_magic file
+      | _ -> ()
+    ) !!files
+  end
+
 (* ripped from gui_downloads *)
 
 let calc_file_eta f =
@@ -669,8 +686,11 @@
         [|
           (if !!html_mods_use_js_tooltips then
                         Printf.sprintf "
-                                onMouseOver=\\\"mOvr(this);setTimeout('popLayer(\\\\\'%s<br>File#: %d<br>Network: %s\\\\\')',%d);setTimeout('hideLayer()',%d);return true;\\\" onMouseOut=\\\"mOut(this);hideLayer();setTimeout('hideLayer()',%d)\\\"\\>"
+                                onMouseOver=\\\"mOvr(this);setTimeout('popLayer(\\\\\'%s<br>%sFile#: %d<br>Network: %s\\\\\')',%d);setTimeout('hideLayer()',%d);return true;\\\" onMouseOut=\\\"mOut(this);hideLayer();setTimeout('hideLayer()',%d)\\\"\\>"
                         (Http_server.html_real_escaped file.file_name)
+			(match file_magic (file_find file.file_num) with
+			   None -> ""
+			 | Some magic -> "File type: " ^ magic ^ "<br>")
 			file.file_num
                         (net_name file)
 			!!html_mods_js_tooltips_wait
@@ -1774,6 +1794,14 @@
 	  ^ (if Autoconf.has_gd && not Autoconf.has_gd_png && Autoconf.has_gd_jpg then " gd(jpg)" else "")
 	  ^ (if not Autoconf.has_gd then " no-gd" else "")
           ^ (if Autoconf.has_iconv then " iconv" else " no-iconv")
+          ^ (if Autoconf.magic then
+	       begin
+	         if !Autoconf.magic_works then
+		   " magic(active)"
+		 else
+		   " magic(inactive)"
+	       end
+	     else " no-magic")
           ^ (if Autoconf.check_bounds then " check-bounds" else " no-check-bounds")
   )
   in
@@ -1814,6 +1842,12 @@
       ^ (Printf.sprintf "\nIP blocking local: %d ranges, web: %d ranges"
           (Ip_set.bl_length !CommonBlocking.ip_blocking_list)
           (Ip_set.bl_length !CommonBlocking.web_ip_blocking_list))
+      ^ (if Autoconf.magic then
+           if !Autoconf.magic_works then
+             Printf.sprintf "\nLibmagic:\t file-type recognition database present"
+           else
+             Printf.sprintf "\nLibmagic:\t file-type recognition database not present"
+         else "")
       ^ (if not !dns_works then
 	    Printf.sprintf "\nDNS:\t\t DNS resolution not available, web_infos %s not work"
 	      (if Autoconf.bittorrent = "yes" then "and BT does" else "do")
diff -a -x CVS -x Root -x Repository -x Tag -x Entries -x Entries.Log -x .svn -x '*.rej' -x '*.orig' -x .cvsignore -N -r -u ./src/daemon/driver/driverMain.ml ./src/daemon/driver/driverMain.ml
--- ./src/daemon/driver/driverMain.ml	2006-04-09 02:27:03.000000000 +0200
+++ ./src/daemon/driver/driverMain.ml	2006-05-12 14:24:03.000000000 +0200
@@ -69,6 +69,7 @@
 
 let minute_timer () =
   DriverInteractive.hdd_check ();
+  DriverInteractive.file_magic_check ();
   CommonShared.shared_check_files ();
   CommonUploads.upload_credit_timer ();
   CommonInteractive.force_download_quotas ();
@@ -417,12 +418,26 @@
 or getting a binary compiled with glibc %s.\n\n")
           real_glibc_version Autoconf.glibc_version Autoconf.glibc_version
   );
+  (
+    if Autoconf.magic then
+      if Magic.M.magic_works () then
+        begin
+	  Autoconf.magic_works := true;
+          lprintf_nl () (_b "Libmagic file-type recognition database present")
+	end
+      else
+        begin
+	  Autoconf.magic_works := false;
+          lprintf_nl () (_b "Libmagic file-type recognition database not present")
+	end
+  );
   load_config ();
   
   add_infinite_option_timer download_sample_rate CommonFile.sample_timer;
 
 (*  lprintf "(1) CommonComplexOptions.load\n"; *)
   CommonComplexOptions.load ();
+  DriverInteractive.file_magic_check ();
   CommonUploads.load ();
 
 (*  lprintf "(2) CommonComplexOptions.load done\n"; *)
diff -a -x CVS -x Root -x Repository -x Tag -x Entries -x Entries.Log -x .svn -x '*.rej' -x '*.orig' -x .cvsignore -N -r -u ./src/networks/bittorrent/bTComplexOptions.ml ./src/networks/bittorrent/bTComplexOptions.ml
--- ./src/networks/bittorrent/bTComplexOptions.ml	2006-04-09 02:27:03.000000000 +0200
+++ ./src/networks/bittorrent/bTComplexOptions.ml	2006-05-12 14:24:03.000000000 +0200
@@ -254,7 +254,7 @@
       ("file_hashes", array_to_value
           (to_value Sha1.option) file.file_chunks) ::
       ("file_files", list_to_value
-          (fun (name, p1) ->
+          (fun (name, p1, _) ->
             SmallList [string_to_value name; int64_to_value p1])
         file.file_files) ::
       assocs
diff -a -x CVS -x Root -x Repository -x Tag -x Entries -x Entries.Log -x .svn -x '*.rej' -x '*.orig' -x .cvsignore -N -r -u ./src/networks/bittorrent/bTGlobals.ml ./src/networks/bittorrent/bTGlobals.ml
--- ./src/networks/bittorrent/bTGlobals.ml	2006-05-06 00:02:37.000000000 +0200
+++ ./src/networks/bittorrent/bTGlobals.ml	2006-05-12 14:24:03.000000000 +0200
@@ -235,7 +235,7 @@
           file_swarmer = None;
           file_trackers = [];
           file_chunks = t.torrent_pieces;
-          file_files = t.torrent_files;
+          file_files = (List.map (fun (file,size) -> (file,size,None)) t.torrent_files);
           file_blocks_downloaded = [];
           file_uploaded = Int64.zero;
           file_torrent_diskname = torrent_diskname;
diff -a -x CVS -x Root -x Repository -x Tag -x Entries -x Entries.Log -x .svn -x '*.rej' -x '*.orig' -x .cvsignore -N -r -u ./src/networks/bittorrent/bTInteractive.ml ./src/networks/bittorrent/bTInteractive.ml
--- ./src/networks/bittorrent/bTInteractive.ml	2006-04-09 02:27:03.000000000 +0200
+++ ./src/networks/bittorrent/bTInteractive.ml	2006-05-12 14:24:03.000000000 +0200
@@ -110,7 +110,9 @@
 
 (* During the commit operation, for security, the file_fd is destroyed. So
   we create it again to be able to share this file again. *)
-      set_file_fd (as_file file) (create_temp_file new_name file.file_files (file_state file));
+      set_file_fd
+        (as_file file)
+        (create_temp_file new_name (List.map (fun (file,size,_) -> (file,size)) file.file_files) (file_state file));
 
       if Unix32.destroyed (file_fd file) then
         lprintf_nl () "op_file_commit: FD is destroyed... could not repair!";
@@ -263,12 +265,17 @@
   print_first_tracker file.file_trackers;
 
   let cntr = ref 0 in
-  List.iter (fun (filename, size) ->
+  List.iter (fun (filename, size, magic) ->
     Printf.bprintf buf "\\</tr\\>\\<tr class=\\\"dl-%d\\\"\\>" (html_mods_cntr ());
     let fs = Printf.sprintf "File %d" !cntr in
+    let magic_string =
+      match magic with
+        None -> ""
+      | Some magic -> Printf.sprintf " / %s" magic
+    in
     html_mods_td buf [
       (fs, "sr br", fs);
-      ("", "sr", (Printf.sprintf "%s (%Ld bytes)" filename size)) 
+      ("", "sr", (Printf.sprintf "%s (%Ld bytes)%s" filename size magic_string)) 
     ];
     incr cntr;
   ) file.file_files
@@ -619,6 +626,32 @@
           lprintf_nl () "ft_retry: exception %s" (Printexc2.to_string e)
   ) ft_by_num
 
+let file_magic_check () =
+  if !Autoconf.magic_works then begin
+    if !verbose then lprintf_nl () "computing sub_file magic values";
+    let check_magic file = 
+      match Magic.M.magic_fileinfo file false with
+        None -> None
+      | Some s -> Some (HashMagic.merge CommonGlobals.files_magic s)
+    in
+    Hashtbl.iter (fun _ file ->
+      let updated = ref false in
+      let new_file_files = ref [] in
+      List.iter (fun (filename, size, magic) ->
+        let subfile = Filename.concat (file_disk_name file) filename in
+        let new_magic =
+          match magic with
+            None -> check_magic subfile
+          | Some magic when magic = "data" || magic = "empty" -> check_magic subfile
+          | _ -> magic
+        in
+        if new_magic <> magic then updated := true;
+        new_file_files := (filename, size, new_magic) :: !new_file_files
+        ) file.file_files;
+        if !updated then file.file_files <- !new_file_files
+    ) files_by_uid
+  end
+
 let load_torrent_from_web r ft =
   if !verbose then
       lprintf_nl () "Loading torrent from web";
diff -a -x CVS -x Root -x Repository -x Tag -x Entries -x Entries.Log -x .svn -x '*.rej' -x '*.orig' -x .cvsignore -N -r -u ./src/networks/bittorrent/bTMain.ml ./src/networks/bittorrent/bTMain.ml
--- ./src/networks/bittorrent/bTMain.ml	2006-03-05 11:40:04.000000000 +0100
+++ ./src/networks/bittorrent/bTMain.ml	2006-05-12 14:24:03.000000000 +0200
@@ -110,6 +110,7 @@
     BTClients.recover_files ();
     add_session_timer enabler 60.0 (fun timer ->
         BTClients.recover_files ();
+        BTInteractive.file_magic_check ()
     );
 
     add_session_timer enabler 120.0 (fun timer ->
@@ -125,6 +126,7 @@
 	      ) !current_files;
   );
 
+  BTInteractive.file_magic_check ();
   BTClients.listen ();
   ()
 
diff -a -x CVS -x Root -x Repository -x Tag -x Entries -x Entries.Log -x .svn -x '*.rej' -x '*.orig' -x .cvsignore -N -r -u ./src/networks/bittorrent/bTShare.ml ./src/networks/bittorrent/bTShare.ml
--- ./src/networks/bittorrent/bTShare.ml	2005-04-07 18:02:50.000000000 +0200
+++ ./src/networks/bittorrent/bTShare.ml	2006-05-12 14:24:03.000000000 +0200
@@ -44,6 +44,7 @@
           impl_shared_ops = shared_ops;
           impl_shared_val = file;
           impl_shared_requests = 0;
+          impl_shared_magic = None;
         } in
         file.file_shared <- Some impl;
         incr CommonGlobals.nshared_files;
diff -a -x CVS -x Root -x Repository -x Tag -x Entries -x Entries.Log -x .svn -x '*.rej' -x '*.orig' -x .cvsignore -N -r -u ./src/networks/bittorrent/bTTypes.ml ./src/networks/bittorrent/bTTypes.ml
--- ./src/networks/bittorrent/bTTypes.ml	2006-04-09 02:27:03.000000000 +0200
+++ ./src/networks/bittorrent/bTTypes.ml	2006-05-12 14:24:03.000000000 +0200
@@ -248,7 +248,7 @@
     mutable file_clients : ((Ip.t*int), client) Hashtbl.t ;
     mutable file_clients_num : int ;
     mutable file_chunks : Sha1.t array;
-    mutable file_files : (string * int64) list;
+    mutable file_files : (string * int64 * string option) list;
     mutable file_blocks_downloaded : int list;
     (* vvv probably a network specific value vvv ?what about file_downloaded?*)
     mutable file_uploaded : int64;
diff -a -x CVS -x Root -x Repository -x Tag -x Entries -x Entries.Log -x .svn -x '*.rej' -x '*.orig' -x .cvsignore -N -r -u ./src/networks/donkey/donkeyShare.ml ./src/networks/donkey/donkeyShare.ml
--- ./src/networks/donkey/donkeyShare.ml	2006-04-09 02:27:03.000000000 +0200
+++ ./src/networks/donkey/donkeyShare.ml	2006-05-12 14:24:03.000000000 +0200
@@ -48,9 +48,16 @@
   | Some _ -> ()
   | None ->
       new_shared := true;
+      let full_name = file_disk_name file in
+      let magic =
+        match Magic.M.magic_fileinfo full_name false with
+          None -> None
+        | Some magic -> Some (HashMagic.merge files_magic magic)
+      in
+
       let impl = {
           impl_shared_update = 1;
-          impl_shared_fullname = file_disk_name file;
+          impl_shared_fullname = full_name;
           impl_shared_codedname = codedname;
           impl_shared_size = file_size file;
           impl_shared_id = file.file_md4;
@@ -59,6 +66,7 @@
           impl_shared_ops = shared_ops;
           impl_shared_val = file;
           impl_shared_requests = 0;
+          impl_shared_magic = magic;
         } in
       file.file_shared <- Some impl;
       new_shared_files := file :: !new_shared_files;
@@ -268,6 +276,7 @@
 lprintf "Searching %s" fullname; lprint_newline ();
 *)
         let mtime = Unix32.mtime fullname in
+
         let s = Hashtbl.find shared_files_info
             (fullname, size, mtime) in
         (* if s.sh_mtime = mtime && s.sh_size = size then begin *)
@@ -289,6 +298,12 @@
 	  let found = ref false in
 	  List.iter (fun sh -> if sh.shared_name = fullname then found := true) !shared_files;
 	  if not !found then begin
+        let magic =
+          match Magic.M.magic_fileinfo fullname false with
+            None -> None
+          | Some magic -> Some (HashMagic.merge files_magic magic)
+        in
+
           let rec impl = {
               impl_shared_update = 1;
               impl_shared_fullname = fullname;
@@ -300,6 +315,7 @@
           	  impl_shared_id = Md4.null;
               impl_shared_val = pre_shared;
               impl_shared_requests = 0;
+              impl_shared_magic = magic;
             } and
             pre_shared = {
               shared_shared = impl;
diff -a -x CVS -x Root -x Repository -x Tag -x Entries -x Entries.Log -x .svn -x '*.rej' -x '*.orig' -x .cvsignore -N -r -u ./src/networks/fileTP/fileTPInteractive.ml ./src/networks/fileTP/fileTPInteractive.ml
--- ./src/networks/fileTP/fileTPInteractive.ml	2006-04-10 21:16:36.000000000 +0200
+++ ./src/networks/fileTP/fileTPInteractive.ml	2006-05-12 14:24:03.000000000 +0200
@@ -73,21 +73,12 @@
       remove_file file;
   );
   file_ops.op_file_info <- (fun file ->
-      {
+      { (impl_file_info file.file_file) with
         P.file_fields = P.Fields_file_info.all;
-        P.file_comment = file_comment (as_file file);
-        P.file_name = file_best_name file;
-        P.file_num = (file_num file);
         P.file_network = network.network_num;
         P.file_names = file.file_filenames;
-        P.file_md4 = Md4.null;
-        P.file_size = file_size file;
-        P.file_downloaded = file_downloaded file;
         P.file_all_sources = (List.length file.file_clients);
         P.file_active_sources = (List.length file.file_clients);
-        P.file_state = file_state file;
-        P.file_sources = None;
-        P.file_download_rate = file_download_rate file.file_file;
         P.file_chunks = (match file.file_swarmer with
           None -> "" | Some swarmer ->
             CommonSwarming.verified_bitmap swarmer);
@@ -96,12 +87,7 @@
           None -> "" | Some swarmer ->
             CommonSwarming.availability swarmer)];
         P.file_format = FormatNotComputed 0;
-        P.file_chunks_age = [|0|];
-        P.file_age = file_age file;
-        P.file_last_seen = BasicSocket.last_time ();
-        P.file_priority = file_priority (as_file file);
         P.file_uids = [Uid.create (FileTP file.file_id)];
-        P.file_sub_files = [];
       }
   )
 
diff -a -x CVS -x Root -x Repository -x Tag -x Entries -x Entries.Log -x .svn -x '*.rej' -x '*.orig' -x .cvsignore -N -r -u ./src/utils/lib/autoconf.ml.new.in ./src/utils/lib/autoconf.ml.new.in
--- ./src/utils/lib/autoconf.ml.new.in	2006-04-08 03:27:29.000000000 +0200
+++ ./src/utils/lib/autoconf.ml.new.in	2006-05-12 14:24:03.000000000 +0200
@@ -46,6 +46,8 @@
 let has_gd_jpg = if "@GD_JPG@" = "yes" then true else false
 
 let bzip2 = if "@BZIP2@" = "yes" then true else false
+let magic = if "@MAGIC@" = "yes" then true else false
+let magic_works = ref false
 
 let zlib__uncompress_string2 s = Zlib.uncompress_string2 s
 let zlib__compress_string s = Zlib.compress_string s
diff -a -x CVS -x Root -x Repository -x Tag -x Entries -x Entries.Log -x .svn -x '*.rej' -x '*.orig' -x .cvsignore -N -r -u ./src/utils/lib/magiclib.ml ./src/utils/lib/magiclib.ml
--- ./src/utils/lib/magiclib.ml	1970-01-01 01:00:00.000000000 +0100
+++ ./src/utils/lib/magiclib.ml	2006-05-12 14:24:03.000000000 +0200
@@ -0,0 +1,119 @@
+(* File: magic.ml
+
+   Copyright (C) 2005
+
+     Christophe Troestler
+     email: Christophe.Troestler@umh.ac.be
+     WWW: http://www.umh.ac.be/math/an/software/
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public License
+   version 2.1 as published by the Free Software Foundation, with the
+   special exception on linking described in file LICENSE.
+
+   This library is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the file
+   LICENSE for more details.
+*)
+(* 	$Id: magic.ml,v 1.2 2006/03/17 10:00:33 chris_77 Exp $	 *)
+
+
+
+exception Failure of string
+
+let () = Callback.register_exception "Magiclib.Failure" (Failure "message")
+
+type t (* hold magic_t *)
+
+external magic_open : int -> t = "ocaml_magic_open"
+external close : t -> unit = "ocaml_magic_close"
+external magic_file : t -> string -> string = "ocaml_magic_file"
+external magic_buffer : t -> string -> int -> string = "ocaml_magic_buffer"
+external magic_setflags : t -> int -> unit = "ocaml_magic_setflags"
+external magic_check_default : t -> bool = "ocaml_magic_check_default"
+external magic_check : t -> string -> bool = "ocaml_magic_check"
+external magic_compile_default : t -> unit = "ocaml_magic_compile_default"
+external magic_compile : t -> string -> unit = "ocaml_magic_compile"
+external magic_load_default : t -> unit = "ocaml_magic_load_default"
+external magic_load : t -> string -> unit = "ocaml_magic_load"
+
+type flag =
+  | Symlink
+  | Compress
+  | Devices
+  | Mime
+  | Continue
+  | Check    (* => flush stderr for all funs.  FIXME *)
+  | Preserve_atime
+  | Raw
+
+(* WARNING: Keep in sync with magic.h *)
+let int_of_flag = function
+  | Symlink	-> 0x002
+  | Compress	-> 0x004
+  | Devices	-> 0x008
+  | Mime	-> 0x010
+  | Continue	-> 0x020
+  | Check	-> 0x040
+  | Preserve_atime -> 0x080
+  | Raw		-> 0x100
+
+let int_of_flags flags =
+  List.fold_left (fun fs f -> fs lor (int_of_flag f)) 0x000 flags
+
+
+(* FIXME: is this escaping correct for libmagic??? *)
+let escape_colon s =
+  let len = String.length s in
+  let n = ref 0 in
+  for i = 0 to len - 1 do if s.[i] = ':' then incr n done;
+  if !n = 0 then s else
+    let s' = String.create (len + !n) in
+    let j = ref 0 in
+    for i = 0 to len - 1 do
+      if s.[i] = ':' then (s'.[!j] <- '\\'; incr j);
+      s'.[!j] <- s.[i]; incr j
+    done;
+    s'
+
+(* Concatenate the filenames with ":".  If ":" is present in a
+   filename, escape it. *)
+let concat filenames =
+  String.concat ":" (List.map escape_colon filenames)
+
+let load cookie = function
+  | [] -> magic_load_default cookie
+  | filenames -> magic_load cookie (concat filenames)
+
+let compile cookie = function
+  | [] -> magic_compile_default cookie
+  | filenames -> magic_compile cookie (concat filenames)
+
+let check cookie = function
+  | [] -> magic_check_default cookie
+  | filenames -> magic_check cookie (concat filenames)
+
+
+let create ?(flags=[]) filenames =
+  let cookie = magic_open(int_of_flags flags) in
+  load cookie filenames;
+  cookie
+
+let setflags cookie flags =
+  magic_setflags cookie (int_of_flags flags)
+
+let file cookie filename =
+  (* FIXME: For a strange reason the toplevel loops with an error "I/O
+     error: Bad file descriptor" when querying an unexisting file or a
+     char device,...  (this works fine when compiled). *)
+  magic_file cookie filename
+
+let buffer cookie ?len s =
+  let len = match len with
+  | None -> String.length s
+  | Some l ->
+      if 0 <= l && l <= String.length s then l
+      else invalid_arg(Printf.sprintf "Magiclib.buffer: len=%i not in [0, %i]"
+                         l (String.length s)) in
+  magic_buffer cookie s len
diff -a -x CVS -x Root -x Repository -x Tag -x Entries -x Entries.Log -x .svn -x '*.rej' -x '*.orig' -x .cvsignore -N -r -u ./src/utils/lib/magiclib.mli ./src/utils/lib/magiclib.mli
--- ./src/utils/lib/magiclib.mli	1970-01-01 01:00:00.000000000 +0100
+++ ./src/utils/lib/magiclib.mli	2006-05-12 14:24:03.000000000 +0200
@@ -0,0 +1,108 @@
+(* File: magic.mli
+
+   Copyright (C) 2005
+
+     Christophe Troestler
+     email: Christophe.Troestler@umh.ac.be
+     WWW: http://www.umh.ac.be/math/an/software/
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public License
+   version 2.1 as published by the Free Software Foundation, with the
+   special exception on linking described in file LICENSE.
+
+   This library is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the file
+   LICENSE for more details.
+*)
+(* 	$Id: magic.mli,v 1.2 2006/03/17 09:58:59 chris_77 Exp $	 *)
+
+
+(** Try to identify the type of file using some "magic number" tests. *)
+
+type t
+  (** Magic "cookies". *)
+
+exception Failure of string
+  (** Raised by the functions of this library when they fail.  The
+      string is an explanation of why the failure happened. *)
+
+type flag =
+  | Symlink	(** If the file queried is a symlink, follow it. *)
+  | Compress 	(** If the file is compressed, unpack it and look at the
+                    contents. *)
+  | Devices 	(** If the file is a block or character special device,
+                    then open the device and try to look in its
+                    contents. *)
+  | Mime	(** Return a mime string, instead of a textual description. *)
+  | Continue	(** Return all matches, not just the first. *)
+  | Check	(** Check the magic database for consistency and print
+		    warnings to stderr. *)
+  | Preserve_atime (** On systems that support utime(2) or utimes(2),
+		       attempt to preserve the access time of files
+		       analyzed. *)
+  | Raw		(** Don't translate unprintable characters to a \ooo octal
+		    representation. *)
+
+val create : ?flags:flag list -> string list -> t
+  (** [create ?flags filenames] creates a magic cookie, loading the
+      databases in [filenames].  If [filenames = []], the default
+      database is used.
+
+      @param flags specifies how the other magic functions should
+      behave (default: [[]]).
+      @raise Magic.Failure if there was an error allocating the magic cookie.
+      @raise Sys_error if there was an operating system error. *)
+
+val close : t -> unit
+  (** [close cookie] frees the resources associated with the cookie [c].
+      You need not to close cookies as the resources will be freed by
+      the garbage collector anyway. *)
+
+val file : t -> string -> string
+  (** [file cookie filename] returns a textual description of the
+      contents of the filename argument.
+
+      @raise Magic.Failure if an error occurred.
+      @raise Invalid_argument if the cookie is closed.
+      @raise Sys_error if there was an operating system error. *)
+
+val buffer : t -> ?len:int -> string -> string
+  (** [file cookie ?len buf] returns a textual description of the
+      contents of the filename argument.
+
+      @raise Magic.Failure if an error occurred.
+      @raise Invalid_argument if [cookie] is closed or if one does not
+      have [0 <= len <= String.length buf].  *)
+
+
+val setflags : t -> flag list -> unit
+  (** [setflags cookie flags] specifies how the other magic functions
+      should behave.
+
+      @raise Magic.Failure if {!Magic.Preserve_atime} is not supported
+      by the operating system.
+      @raise Invalid_argument if the cookie has been closed. *)
+
+val load : t -> string list -> unit
+  (** [load cookie filenames] loads the the list of database files
+      [filenames], or [] for the default database file.
+
+      @raise Invalid_argument if the cookie has been closed.
+      @raise Sys_error if there was an operating system error.  *)
+
+val compile : t -> string list -> unit
+  (** [compile cookie filenames] compiles the the list of database
+      files [filenames], or [] for the default database.  The compiled
+      files created are named from the basename(1) of each file
+      argument with ".mgc" appended to it.
+
+      @raise Invalid_argument if the cookie has been closed.
+      @raise Sys_error if there was an operating system error. *)
+
+val check : t -> string list -> bool
+  (** [check cookie filenames] checks the validity of entries in the
+      database files [filenames], or [] for the default database.
+
+      @raise Invalid_argument if the cookie has been closed. *)
diff -a -x CVS -x Root -x Repository -x Tag -x Entries -x Entries.Log -x .svn -x '*.rej' -x '*.orig' -x .cvsignore -N -r -u ./src/utils/lib/magiclib_stub.c ./src/utils/lib/magiclib_stub.c
--- ./src/utils/lib/magiclib_stub.c	1970-01-01 01:00:00.000000000 +0100
+++ ./src/utils/lib/magiclib_stub.c	2006-05-12 14:24:03.000000000 +0200
@@ -0,0 +1,271 @@
+/* File: magic.ml
+
+   Copyright (C) 2005
+
+     Christophe Troestler
+     email: Christophe.Troestler@umh.ac.be
+     WWW: http://www.umh.ac.be/math/an/software/
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public License
+   version 2.1 as published by the Free Software Foundation, with the
+   special exception on linking described in file LICENSE.
+
+   This library is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the file
+   LICENSE for more details.
+*/
+/* 	$Id: magic_stub.c,v 1.2 2006/03/17 10:26:43 chris_77 Exp $	 */
+
+#include <caml/mlvalues.h>
+#include <caml/memory.h>
+#include <caml/alloc.h>
+#include <caml/custom.h>
+#include <caml/fail.h>
+#include <caml/callback.h>
+
+#include <magic.h>
+#include <errno.h>
+#define _XOPEN_SOURCE 600
+#include <string.h>
+#include <stdio.h>
+
+/* Outputs an error message and terminates the program. */
+#define DEBUG(...) \
+  fprintf(stderr, "DEBUG magic_stub: " __VA_ARGS__);  \
+  printf("\n")
+
+#define CAML_MAGIC_VERSION "0.2"
+
+/*
+ * Failure
+ */
+
+static void raise_magic_failure(const char * msg)
+{
+  static value * exn = NULL;
+  if (exn == NULL) exn = caml_named_value("Magiclib.Failure");
+  raise_with_string(*exn, (char *) msg);
+}
+
+/* [fname] is the function name. */
+static void raise_on_error(const char* fname, magic_t cookie)
+{
+  const char *err_magic;
+  char *errmsg; /* For thread safety of error messages */
+  int flen;
+  
+  flen = strlen(fname);
+  if ((err_magic = magic_error(cookie)) != NULL) {
+    if ((errmsg = malloc(flen + strlen(err_magic) + 1)) == NULL)
+      raise_out_of_memory();
+    strcpy(errmsg, fname);
+    strcpy(errmsg + flen, err_magic);
+    raise_magic_failure(errmsg);
+  }
+  else {
+    int len = 80;  /* Initial buffer length */
+    int err;
+  
+    /* Allocate buffer [errmsg] until there is enough space for the
+     * error message. */
+    err = magic_errno(cookie);
+    if ((errmsg = malloc(len)) == NULL) raise_out_of_memory();
+    strcpy(errmsg, fname);
+    while (strerror_r(err, errmsg + flen, len - flen) < 0) {
+      len *= 2;
+      errmsg = realloc(errmsg, len);
+      if (errmsg == NULL) raise_out_of_memory();
+    }
+    raise_sys_error(copy_string(errmsg));
+  }
+}
+
+
+/*
+ * magic_t
+ */
+
+/* magic_t is a pointer on 'struct magic_set' so one can set it to NULL */
+#define COOKIE_VAL(v) (* ((magic_t *) Data_custom_val(v)))
+
+/* If the cookie has not been forcibly closed with [magic_close], free it. */
+static void free_cookie(value c)
+{
+  magic_t cookie = COOKIE_VAL(c);
+  if (cookie != NULL) {
+    magic_close(cookie);
+    COOKIE_VAL(c) = NULL;
+  }
+}
+
+/* compare magic_t pointers (=> total order) */
+static int compare_cookie(value c1, value c2)
+{
+  magic_t cookie1 = COOKIE_VAL(c1), cookie2 = COOKIE_VAL(c2);
+  
+  if (cookie1 == cookie2)      return 0;
+  else if (cookie1 < cookie2)  return -1;
+  else return 1;
+}
+
+static struct custom_operations cookie_ops = {
+    /* identifier */ "be.ac.umh.math/magic.cookie." CAML_MAGIC_VERSION,
+    /* finalize */ free_cookie,
+    /* compare */ compare_cookie,
+    /* hash */ custom_hash_default,
+    /* serialize */ custom_serialize_default,
+    /* deserialize */ custom_deserialize_default
+};
+
+#define ALLOC_COOKIE alloc_custom(&cookie_ops, sizeof(magic_t), \
+                     sizeof(magic_t), 40 * sizeof(magic_t))
+
+/*
+ * Stubs
+ */
+
+CAMLprim value ocaml_magic_open(value flags)
+{
+  CAMLparam1(flags);
+  CAMLlocal1(c);
+  char *errmsg;
+  int len = 80;
+  
+  c = ALLOC_COOKIE;
+  if ((COOKIE_VAL(c) = magic_open(Int_val(flags) | MAGIC_ERROR)) == NULL) {
+    if (errno == EINVAL)
+      /* An unsupported value for flags was given */
+      raise_magic_failure("Magiclib.create: Preserve_atime not supported");
+    else {
+      /* No cookie yet, so one cannot use the above generic err fun */
+      if ((errmsg = malloc(len)) == NULL) raise_out_of_memory();
+      strcpy(errmsg, "Magiclib.create: "); /* 14 chars */
+      while (strerror_r(errno, errmsg + 14, len - 14) < 0) {
+        len *= 2;
+        if ((errmsg = realloc(errmsg, len)) == NULL) raise_out_of_memory();
+      }
+      raise_sys_error(copy_string(errmsg));
+    }
+  }
+  CAMLreturn(c);
+}
+
+CAMLprim value ocaml_magic_close(value c)
+{
+  CAMLparam1(c);
+  magic_t cookie = COOKIE_VAL(c);
+  if (cookie != NULL) /* if first time it is called */
+    magic_close(cookie);
+  COOKIE_VAL(c) = NULL; /* For the finalization function & multiple calls */
+  CAMLreturn(Val_unit);
+}
+
+
+CAMLprim value ocaml_magic_file(value c, value fname)
+{
+  CAMLparam2(c, fname);
+  const char * ans;
+  magic_t cookie = COOKIE_VAL(c);
+
+  if (cookie == NULL) invalid_argument("Magiclib.file");
+  if ((ans = magic_file(cookie, String_val(fname))) == NULL) {
+    raise_on_error("Magiclib.file: ", cookie);
+  }
+  CAMLreturn(copy_string(ans));
+}
+
+CAMLprim value ocaml_magic_buffer(value c, value buf, value len)
+{
+  CAMLparam3(c, buf, len);
+  const char * ans;
+  magic_t cookie = COOKIE_VAL(c);
+
+  if (cookie == NULL) caml_invalid_argument("Magiclib.buffer");
+  if ((ans = magic_buffer(cookie, String_val(buf), Int_val(len)))
+      == NULL)
+    raise_on_error("Magiclib.buffer: ", cookie);
+  CAMLreturn(copy_string(ans));
+}
+
+
+CAMLprim value ocaml_magic_setflags(value c, value flags)
+{
+  CAMLparam2(c, flags);
+  magic_t cookie = COOKIE_VAL(c);
+
+  if (cookie == NULL) caml_invalid_argument("Magiclib.setflags");
+  if (magic_setflags(cookie, Int_val(flags)) < 0)
+    raise_magic_failure("Magiclib.setflags: Preserve_atime not supported");
+  CAMLreturn(Val_unit);
+}
+
+
+
+#define CHECK(fname) \
+  magic_t cookie = COOKIE_VAL(c); \
+  \
+  if (cookie == NULL) caml_invalid_argument("Magiclib.check"); \
+  if (magic_check(cookie, fname) < 0) \
+    CAMLreturn(Val_false); \
+  else \
+    CAMLreturn(Val_true)
+
+CAMLprim value ocaml_magic_check_default(value c)
+{
+  CAMLparam1(c);
+  CHECK(NULL);
+}
+CAMLprim value ocaml_magic_check(value c, value filenames)
+{
+  CAMLparam2(c, filenames);
+  CHECK(String_val(filenames));
+}
+
+
+
+#define COMPILE(fname) \
+  magic_t cookie = COOKIE_VAL(c); \
+  \
+  if (cookie == NULL) caml_invalid_argument("Magiclib.compile"); \
+  if (magic_compile(cookie, fname) < 0) \
+    raise_on_error("Magiclib.compile: ", cookie);  \
+  CAMLreturn(Val_unit)
+
+CAMLprim value ocaml_magic_compile_default(value c)
+{
+  CAMLparam1(c);
+  COMPILE(NULL);
+}
+
+CAMLprim value ocaml_magic_compile(value c, value filenames)
+{
+  CAMLparam2(c, filenames);
+  COMPILE(String_val(filenames));
+}
+
+
+
+#define LOAD(fname) \
+  magic_t cookie = COOKIE_VAL(c); \
+  \
+  if (cookie == NULL) caml_invalid_argument("Magiclib.load"); \
+  if (magic_load(cookie, fname) < 0) \
+    raise_on_error("Magiclib.load: ", cookie);  \
+  CAMLreturn(Val_unit)
+
+CAMLprim
+value ocaml_magic_load_default(value c)
+{
+  CAMLparam1(c);
+  LOAD(NULL);
+}
+
+CAMLprim
+value ocaml_magic_load(value c, value filenames)
+{
+  CAMLparam2(c, filenames);
+  LOAD(String_val(filenames));
+}
+
diff -a -x CVS -x Root -x Repository -x Tag -x Entries -x Entries.Log -x .svn -x '*.rej' -x '*.orig' -x .cvsignore -N -r -u ./src/utils/lib/magic_magic.ml ./src/utils/lib/magic_magic.ml
--- ./src/utils/lib/magic_magic.ml	1970-01-01 01:00:00.000000000 +0100
+++ ./src/utils/lib/magic_magic.ml	2006-05-12 14:24:03.000000000 +0200
@@ -0,0 +1,58 @@
+(* Copyright 2006 *)
+(*
+    This file is part of mldonkey.
+
+    mldonkey is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    mldonkey is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with mldonkey; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*)
+
+open Magiclib
+
+module type MagicInfo =
+sig
+  val magic_works : unit -> bool
+
+(* magic_fileinfo <file> <return mime value true/false> <libmagic result, None for exceptions> *)
+  val magic_fileinfo : string -> bool -> string option
+end
+
+module MagicInfo : MagicInfo = struct
+
+  let magic_cookie () =
+    Magiclib.create ?flags:(Some [Symlink;Preserve_atime]) []
+  let magic_cookie_mime () =
+    Magiclib.create ?flags:(Some [Mime;Symlink;Preserve_atime]) []
+
+  let magic_works () =
+    try
+      let cookie = magic_cookie_mime () in
+      Magiclib.close cookie;
+      true
+    with e -> false
+
+  let magic_fileinfo file mime =
+    try
+      let cookie =
+        if mime then magic_cookie_mime () else magic_cookie ()
+      in
+      try
+        let fileinfo = Magiclib.file cookie file in
+        Magiclib.close cookie;
+        Some fileinfo
+      with e ->
+        Magiclib.close cookie;
+        None
+    with e -> None
+
+end
diff -a -x CVS -x Root -x Repository -x Tag -x Entries -x Entries.Log -x .svn -x '*.rej' -x '*.orig' -x .cvsignore -N -r -u ./src/utils/lib/magic.ml.in ./src/utils/lib/magic.ml.in
--- ./src/utils/lib/magic.ml.in	1970-01-01 01:00:00.000000000 +0100
+++ ./src/utils/lib/magic.ml.in	2006-05-12 14:24:03.000000000 +0200
@@ -0,0 +1,28 @@
+(* Copyright 2006 *)
+(*
+    This file is part of mldonkey.
+
+    mldonkey is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    mldonkey is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with mldonkey; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*)
+
+open Printf2
+
+module type MagicInfo =
+sig
+  val magic_works : unit -> bool
+  val magic_fileinfo : string -> bool -> string option
+end
+
+module M : MagicInfo = @MAGICLIB@.MagicInfo
diff -a -x CVS -x Root -x Repository -x Tag -x Entries -x Entries.Log -x .svn -x '*.rej' -x '*.orig' -x .cvsignore -N -r -u ./src/utils/lib/magic_nomagic.ml ./src/utils/lib/magic_nomagic.ml
--- ./src/utils/lib/magic_nomagic.ml	1970-01-01 01:00:00.000000000 +0100
+++ ./src/utils/lib/magic_nomagic.ml	2006-05-12 14:24:03.000000000 +0200
@@ -0,0 +1,32 @@
+(* Copyright 2006 *)
+(*
+    This file is part of mldonkey.
+
+    mldonkey is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    mldonkey is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with mldonkey; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*)
+
+module type MagicInfo =
+sig
+  val magic_works : unit -> bool
+  val magic_fileinfo : string -> bool -> string option
+end
+
+module MagicInfo : MagicInfo = struct
+
+  let magic_works () = false
+
+  let magic_fileinfo file _ = None
+
+end
