#!/bin/sh

tmpfile=`mktemp` || exit 1

nice -n19 ssindex -i "$1" > "$tmpfile"

nice -n19 xsltproc - "$tmpfile" <<EOF
<?xml version="1.0"?>
<xsl:stylesheet 
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   version="1.0">

  <xsl:output method="text"/>
  <xsl:output omit-xml-declaration="yes"/>

  <xsl:template match="*">
    <xsl:value-of select="."/>
  </xsl:template>

</xsl:stylesheet>
EOF

rm "$tmpfile"
