#!/bin/sh
if [ "$1" = "" ]; then
   echo "usage: tardir <file.{tar|tgz|tar.gz|tar.bz2}>"
   exit 1
fi
ext=`echo "$1"|sed -e 's/.*\.//'`
if [ "$ext" = "bz2" ]; then
   bzcat "$1" | tar -tf -|sed -e 's/\/.*//'|sort -u
elif [ "$ext" = "gz" -o "$ext" = "tgz" ]; then
   tar -tzf "$1"|sed -e 's/\/.*//'|sort -u
else
   tar -tf "$1"|sed -e 's/\/.*//'|sort -u
fi
