#!/usr/bin/perl

#
# DEBarc (c) Vladi Belperchinov-Shabanski <cade@biscom.net> 1999
# debian packages archive-like interface utility
# used to handle ( list/extract ) files inside a .deb file
# DEBarc is mainly distributed with VFU Filemanager which
# can be found at http://www.biscom.net/~cade/vfu
# + You can use/change/improve/whatever DEBarc w/o restrictions!
# + If you improve this utility I'll be glad to receive a copy !
# + I just want you to keep this text intact and add your credits
#   below:
#                                                         Thanx!
# ----------------------------------------------------------------
# CREDITS:
#
#
#

if ( $#ARGV < 1 )
  {
  die "usage: debarc cmd file.deb files...\ncmd is e[x]tract, [l]ist\n";
  };
 
if ( $ARGV[0] eq "l" )
  {
  ### these are standard ones
  print "---------- root/root         0 1970-01-01 01:01 control\n";
  print "---------- root/root         0 1970-01-01 01:01 debian-binary\n";
  print `ar p $ARGV[1] data.tar.gz | gzip -d | tar tvf -`;
  exit;
  };
 
if ( $ARGV[0] eq "x" )
  {
  if ( $ARGV[2] eq "control" )
    {
    system( "ar p $ARGV[1] control.tar.gz | gzip -d | tar xvf - control" );
    }
  elsif ( $ARGV[2] eq "debian-binary" )
    {
    system( "ar p $ARGV[1] debian-binary > debian-binary" );
    }
  else
    {
    system( "ar p $ARGV[1] data.tar.gz | gzip -d | tar xvf - $ARGV[2] $ARGV[3] $ARGV[4] $ARGV[5] $ARGV[6] $ARGV[7] " );
    }
  exit;
  };

print "usage: debarc cmd file.deb files...\ncmd is e[x]tract, [l]ist\n";


