#!/bin/sh

# This file is part of the KDE project
# Copyright (C) 2002 Paul Chitescu <paulc-devel@null.ro>
# License: Open Source, Use On Your Own Risk
#
# Konqueror/Embedded Tar+Gzip to HTML data filter
#
# Requires: sh, sed, tar, zcat (gzip)
#
# Usage: in your konq-embedrc file,
#
# [MIME Handlers]
# application/x-tgz,.tgz,.tar.gz=|text/html|/path/to/this/file

# you shouldn't need to change anything below
sedhtml='s/&/\&amp;/g; s/"/\&quot;/g; s/</\&lt;/g; s/>/\&gt;/g'
title='tar.gz: '`echo -n "$FILTER_URL" | sed "$sedhtml"`
echo -n "<HTML><HEAD><TITLE>$title</TITLE></HEAD><BODY>"
echo "<PRE><B>$title</B><BR/><HR/>"
zcat -f | tar tf - | sed "$sedhtml"
echo '</PRE></BODY></HTML>'
