diff -ur tar2rubyscript-0.4.7.tar.gz/tar2rubyscript/CHANGELOG tar2rubyscript-0.4.8.tar.gz/tar2rubyscript/CHANGELOG
--- tar2rubyscript-0.4.7.tar.gz/tar2rubyscript/CHANGELOG	2005-06-24 01:51:23.000000000 +0200
+++ tar2rubyscript-0.4.8.tar.gz/tar2rubyscript/CHANGELOG	2006-03-08 17:20:08.000000000 +0100
@@ -1,5 +1,16 @@
 ----------------------------------------------------------------
 
+0.4.8 - 08.03.2006
+
+* Fixed a bug concerning looping symlinks.
+
+* Fixed a bug concerning "Too many open files".
+
+* Added support for hard links and symbolic links (not on
+  Windows).
+
+----------------------------------------------------------------
+
 0.4.7 - 24.06.2005
 
 * Fixed a serious bug concerning this message: "doesn't contain
diff -ur tar2rubyscript-0.4.7.tar.gz/tar2rubyscript/ev/ftools.rb tar2rubyscript-0.4.8.tar.gz/tar2rubyscript/ev/ftools.rb
--- tar2rubyscript-0.4.7.tar.gz/tar2rubyscript/ev/ftools.rb	2005-06-24 02:03:13.000000000 +0200
+++ tar2rubyscript-0.4.8.tar.gz/tar2rubyscript/ev/ftools.rb	2006-03-08 17:52:37.000000000 +0100
@@ -9,8 +9,10 @@
       File.mkpath(todir)
 
       Dir.chdir(from)
-        Dir.new(".").each do |e|
-          Dir.copy(e, todir+"/"+e)	if not [".", ".."].include?(e)
+        Dir.open(".") do |dir|
+          dir.each do |e|
+            Dir.copy(e, todir+"/"+e)	if not [".", ".."].include?(e)
+          end
         end
       Dir.chdir(pdir)
     else
@@ -28,14 +30,19 @@
   end
 
   def self.rm_rf(entry)
-    File.chmod(0755, entry)
+    begin
+      File.chmod(0755, entry)
+    rescue
+    end
 
     if File.ftype(entry) == "directory"
       pdir	= Dir.pwd
 
       Dir.chdir(entry)
-        Dir.new(".").each do |e|
-          Dir.rm_rf(e)	if not [".", ".."].include?(e)
+        Dir.open(".") do |dir|
+          dir.each do |e|
+            Dir.rm_rf(e)	if not [".", ".."].include?(e)
+          end
         end
       Dir.chdir(pdir)
 
@@ -71,8 +78,10 @@
         Dir.chdir(entry)
 
         begin
-          Dir.new(".").each do |e|
-            res += Dir.find(e, mask).collect{|e| entry+"/"+e}	unless [".", ".."].include?(e)
+          Dir.open(".") do |dir|
+            dir.each do |e|
+              res += Dir.find(e, mask).collect{|e| entry+"/"+e}	unless [".", ".."].include?(e)
+            end
           end
         ensure
           Dir.chdir(pdir)
@@ -84,7 +93,7 @@
       res += [entry]	if mask.nil? or entry =~ mask
     end
 
-    res
+    res.sort
   end
 end
 
@@ -159,11 +168,44 @@
     catch :stop do
       ENV["PATH"].split(/#{sep}/).reverse.each do |d|
         if File.directory?(d)
-          Dir.new(d).each do |e|
-             if e.downcase == file.downcase
-               res	= File.expand_path(e, d)
-               throw :stop
+          Dir.open(d) do |dir|
+            dir.each do |e|
+              if (linux? and e == file) or (windows? and e.downcase == file.downcase)
+                res	= File.expand_path(e, d)
+                throw :stop
+              end
+            end
+          end
+        end
+      end
+    end
+
+    res
+  end
+
+  def self.same_content?(file1, file2, blocksize=4096)
+    res	= false
+
+    if File.file?(file1) and File.file?(file2)
+      res	= true
+
+      data1	= nil
+      data2	= nil
+
+      File.open(file1, "rb") do |f1|
+        File.open(file2, "rb") do |f2|
+          catch :not_the_same do
+            while (data1 = f1.read(blocksize))
+              data2	= f2.read(blocksize)
+
+              unless data1 == data2
+                res	= false
+
+                throw :not_the_same
+              end
             end
+
+            res	= false	if f2.read(blocksize)
           end
         end
       end
diff -ur tar2rubyscript-0.4.7.tar.gz/tar2rubyscript/ev/oldandnewlocation.rb tar2rubyscript-0.4.8.tar.gz/tar2rubyscript/ev/oldandnewlocation.rb
--- tar2rubyscript-0.4.7.tar.gz/tar2rubyscript/ev/oldandnewlocation.rb	2005-06-24 02:03:13.000000000 +0200
+++ tar2rubyscript-0.4.8.tar.gz/tar2rubyscript/ev/oldandnewlocation.rb	2006-03-08 17:52:37.000000000 +0100
@@ -3,7 +3,7 @@
 
 ENV["OLDDIR"]	= Dir.pwd								unless ENV.include?("OLDDIR")
 ENV["NEWDIR"]	= File.expand_path(File.dirname($0))					unless ENV.include?("NEWDIR")
-ENV["OWNDIR"]	= File.expand_path(File.dirname((caller[-1] or $0).gsub(/:\d+$/, "")))	unless ENV.include?("OWNDIR")
+ENV["APPDIR"]	= File.expand_path(File.dirname((caller[-1] or $0).gsub(/:\d+$/, "")))	unless ENV.include?("APPDIR")
 ENV["TEMPDIR"]	= dir									unless ENV.include?("TEMPDIR")
 
 class Dir
@@ -14,8 +14,10 @@
       pdir	= Dir.pwd
 
       Dir.chdir(entry)
-        Dir.new(".").each do |e|
-          Dir.rm_rf(e)	if not [".", ".."].include?(e)
+        Dir.open(".") do |dir|
+          dir.each do |e|
+            Dir.rm_rf(e)	if not [".", ".."].include?(e)
+          end
         end
       Dir.chdir(pdir)
 
@@ -77,10 +79,10 @@
 end
 
 begin
-  ownlocation
+  applocation
 rescue NameError
-  def ownlocation(file="")
-    dir	= ENV["OWNDIR"]
+  def applocation(file="")
+    dir	= ENV["APPDIR"]
     res	= nil
 
     if block_given?
diff -ur tar2rubyscript-0.4.7.tar.gz/tar2rubyscript/init.rb tar2rubyscript-0.4.8.tar.gz/tar2rubyscript/init.rb
--- tar2rubyscript-0.4.7.tar.gz/tar2rubyscript/init.rb	2005-06-24 01:18:21.000000000 +0200
+++ tar2rubyscript-0.4.8.tar.gz/tar2rubyscript/init.rb	2006-02-04 00:14:13.000000000 +0100
@@ -93,7 +93,15 @@
   end
 
   if DIRMODE
-    Dir.copy(tarfile, ".")
+    dir		= File.dirname(tarfile)
+    file	= File.basename(tarfile)
+    begin
+      tar	= "tar"
+      system(backslashes("#{tar} c -C #{dir} #{file} | #{tar} x"))
+    rescue
+      tar	= backslashes(newlocation("tar.exe"))
+      system(backslashes("#{tar} c -C #{dir} #{file} | #{tar} x"))
+    end
   end
 
   entries	= Dir.entries(".")
@@ -130,7 +138,7 @@
     what	= "*.*"	if windows?
     tar		= "tar"
     tar		= backslashes(newlocation("tar.exe"))	if windows?
-    archive	= IO.popen("#{tar} ch #{what}", "rb"){|f| [f.read].pack("m").split("\n").collect{|s| "# " + s}.join("\n")}
+    archive	= IO.popen("#{tar} c #{what}", "rb"){|f| [f.read].pack("m").split("\n").collect{|s| "# " + s}.join("\n")}
   end
 
 Dir.chdir(pdir)
diff -ur tar2rubyscript-0.4.7.tar.gz/tar2rubyscript/LICENSE tar2rubyscript-0.4.8.tar.gz/tar2rubyscript/LICENSE
--- tar2rubyscript-0.4.7.tar.gz/tar2rubyscript/LICENSE	2003-10-19 18:43:27.000000000 +0200
+++ tar2rubyscript-0.4.8.tar.gz/tar2rubyscript/LICENSE	2005-06-26 13:05:01.000000000 +0200
@@ -13,3 +13,6 @@
 # License along with this program; if not, write to the Free
 # Software Foundation, Inc., 59 Temple Place, Suite 330,
 # Boston, MA 02111-1307 USA.
+# 
+# Parts of the code for Tar2RubyScript are based on code from
+# Thomas Hurst <tom@hur.st>.
diff -ur tar2rubyscript-0.4.7.tar.gz/tar2rubyscript/README tar2rubyscript-0.4.8.tar.gz/tar2rubyscript/README
--- tar2rubyscript-0.4.7.tar.gz/tar2rubyscript/README	2004-12-03 23:10:19.000000000 +0100
+++ tar2rubyscript-0.4.8.tar.gz/tar2rubyscript/README	2005-08-06 09:05:44.000000000 +0200
@@ -1,19 +1,24 @@
-The best way to use Tar2RubyScript is the RB, not this TAR.GZ.
-The latter is just for playing with the internals. Both are
-available on the site.
+----------------------------------------------------------------
 
- Usage: ruby init.rb application.tar [application.rb [licence.txt]]
-        or
-        ruby init.rb application[/] [application.rb [licence.txt]]
+Tar2RubyScript transforms a directory tree, containing your
+application, into one single Ruby script, along with some code
+to handle this archive. This script can be distributed to our
+friends. When they've installed Ruby, they just have to double
+click on it and your application is up and running!
 
-If "application.rb" is not provided or equals to "-", it will
-be derived from "application.tar" or "application/".
+So, it's a way of executing your application, not of installing
+it. You might think of it as the Ruby version of Java's JAR...
+Let's call it an RBA (Ruby Archive).
 
-If a license is provided, it will be put at the beginning of
-The Application.
-
-Parts of the code for Tar2RubyScript are based on code from
-Thomas Hurst <tom@hur.st>.
+"It's Ruby's JAR..."
 
 For more information, see
 http://www.erikveen.dds.nl/tar2rubyscript/index.html .
+
+----------------------------------------------------------------
+
+The best way to use Tar2RubyScript is the RB, not this TAR.GZ.
+The latter is just for playing with the internals. Both are
+available on the site.
+
+----------------------------------------------------------------
diff -ur tar2rubyscript-0.4.7.tar.gz/tar2rubyscript/tarrubyscript.rb tar2rubyscript-0.4.8.tar.gz/tar2rubyscript/tarrubyscript.rb
--- tar2rubyscript-0.4.7.tar.gz/tar2rubyscript/tarrubyscript.rb	2005-06-24 02:01:28.000000000 +0200
+++ tar2rubyscript-0.4.8.tar.gz/tar2rubyscript/tarrubyscript.rb	2006-02-04 00:53:35.000000000 +0100
@@ -78,14 +78,19 @@
 
 class Dir
   def self.rm_rf(entry)
-    File.chmod(0755, entry)
+    begin
+      File.chmod(0755, entry)
+    rescue
+    end
 
     if File.ftype(entry) == "directory"
       pdir	= Dir.pwd
 
       Dir.chdir(entry)
-        Dir.new(".").each do |e|
-          Dir.rm_rf(e)	if not [".", ".."].include?(e)
+        Dir.open(".") do |d|
+          d.each do |e|
+            Dir.rm_rf(e)	if not [".", ".."].include?(e)
+          end
         end
       Dir.chdir(pdir)
 
@@ -170,7 +175,19 @@
 
   def extract
     if not @header.name.empty?
-      if @header.dir?
+      if @header.symlink?
+        begin
+          File.symlink(@header.linkname, @header.name)
+        rescue SystemCallError => e
+          $stderr.puts "Couldn't create symlink #{@header.name}: " + e.message
+        end
+      elsif @header.link?
+        begin
+          File.link(@header.linkname, @header.name)
+        rescue SystemCallError => e
+          $stderr.puts "Couldn't create link #{@header.name}: " + e.message
+        end
+      elsif @header.dir?
         begin
           Dir.mkdir(@header.name, @header.mode)
         rescue SystemCallError => e
@@ -196,7 +213,11 @@
 
   def list
     if not @header.name.empty?
-      if @header.dir?
+      if @header.symlink?
+        $stderr.puts "s %s -> %s" % [@header.name, @header.linkname]
+      elsif @header.link?
+        $stderr.puts "l %s -> %s" % [@header.name, @header.linkname]
+      elsif @header.dir?
         $stderr.puts "d %s" % [@header.name]
       elsif @header.file?
         $stderr.puts "f %s (%s)" % [@header.name, @header.size]
@@ -208,7 +229,7 @@
 end
 
 class Header
-  attr_reader(:name, :uid, :gid, :size, :mtime, :uname, :gname, :mode, :linkflag)
+  attr_reader(:name, :uid, :gid, :size, :mtime, :uname, :gname, :mode, :linkflag, :linkname)
   attr_writer(:name)
 
   def initialize(header)
@@ -230,6 +251,7 @@
       @name, @mode, @uid, @gid, @size, @mtime, @chksum, @linkflag, @linkname, @magic, @uname, @gname, @devmajor, @devminor	= converted
 
       @name.gsub!(/^\.\//, "")
+      @linkname.gsub!(/^\.\//, "")
 
       @raw	= header
     rescue ArgumentError => e
@@ -239,10 +261,8 @@
     raise "Magic header value #{@magic.inspect} is invalid."	if not MAGICS.include?(@magic)
 
     @linkflag	= LF_FILE			if @linkflag == LF_OLDFILE or @linkflag == LF_CONTIG
-    @linkflag	= LF_DIR			if @name[-1] == '/' and @linkflag == LF_FILE
-    @linkname	= @linkname[1,-1]		if @linkname[0] == '/'
+    @linkflag	= LF_DIR			if @linkflag == LF_FILE and @name[-1] == '/'
     @size	= 0				if @size < 0
-    @name	= @linkname + '/' + @name	if @linkname.size > 0
   end
 
   def file?
@@ -253,6 +273,14 @@
     @linkflag == LF_DIR
   end
 
+  def symlink?
+    @linkflag == LF_SYMLINK
+  end
+
+  def link?
+    @linkflag == LF_LINK
+  end
+
   def longname?
     @linkflag == GNUTYPE_LONGNAME
   end
@@ -262,11 +290,13 @@
   @@count	= 0	unless defined?(@@count)
 
   def initialize
+    @@count += 1
+
     @archive	= File.open(File.expand_path(__FILE__), "rb"){|f| f.read}.gsub(/\r/, "").split(/\n\n/)[-1].split("\n").collect{|s| s[2..-1]}.join("\n").unpack("m").shift
     temp	= ENV["TEMP"]
     temp	= "/tmp"	if temp.nil?
     temp	= File.expand_path(temp)
-    @tempfile	= "#{temp}/tar2rubyscript.f.#{Process.pid}.#{@@count += 1}"
+    @tempfile	= "#{temp}/tar2rubyscript.f.#{Process.pid}.#{@@count}"
   end
 
   def list
@@ -291,12 +321,14 @@
   @@count	= 0	unless defined?(@@count)
 
   def initialize
+    @@count += 1
+
     @archive	= File.open(File.expand_path(__FILE__), "rb"){|f| f.read}.gsub(/\r/, "").split(/\n\n/)[-1].split("\n").collect{|s| s[2..-1]}.join("\n").unpack("m").shift
     @olddir	= Dir.pwd
     temp	= ENV["TEMP"]
     temp	= "/tmp"	if temp.nil?
     temp	= File.expand_path(temp)
-    @tempfile	= "#{temp}/tar2rubyscript.f.#{Process.pid}.#{@@count += 1}"
+    @tempfile	= "#{temp}/tar2rubyscript.f.#{Process.pid}.#{@@count}"
     @tempdir	= "#{temp}/tar2rubyscript.d.#{Process.pid}.#{@@count}"
 
     @@tempspace	= self
@@ -384,8 +416,10 @@
         Dir.chdir(entry)
 
         begin
-          Dir.new(".").each do |e|
-            touch(e)	unless [".", ".."].include?(e)
+          Dir.open(".") do |d|
+            d.each do |e|
+              touch(e)	unless [".", ".."].include?(e)
+            end
           end
         ensure
           Dir.chdir(pdir)
@@ -549,6 +583,8 @@
   $:.unshift(newlocation)
   $:.push(oldlocation)
 
+  verbose	= $VERBOSE
+  $VERBOSE	= nil
   s	= ENV["PATH"].dup
   if Dir.pwd[1..2] == ":/"	# Hack ???
     s << ";#{templocation.gsub(/\//, "\\")}"
@@ -560,6 +596,7 @@
     s << ":#{oldlocation}"
   end
   ENV["PATH"]	= s
+  $VERBOSE	= verbose
 
   TAR2RUBYSCRIPT	= true	unless defined?(TAR2RUBYSCRIPT)
 
diff -ur tar2rubyscript-0.4.7.tar.gz/tar2rubyscript/VERSION tar2rubyscript-0.4.8.tar.gz/tar2rubyscript/VERSION
--- tar2rubyscript-0.4.7.tar.gz/tar2rubyscript/VERSION	2005-06-24 02:03:13.000000000 +0200
+++ tar2rubyscript-0.4.8.tar.gz/tar2rubyscript/VERSION	2006-03-08 17:52:37.000000000 +0100
@@ -1 +1 @@
-0.4.7
+0.4.8