#!/usr/local/bin/perl -w-- # -*- perl -*-
#
# $Id: find_to_tree,v 1.2 1995/10/11 00:35:15 qjb Exp $
# $Source: /home/qjb/scripts/RCS/find_to_tree,v $
# $Author: qjb $
#
# Pipe 'find . -type f -print | sort' to this for a more useful output.
# 

# This code, from the perl manual page, forces this to be run by perl from 
# perl, sh, or csh.  It must be first.
eval '(exit $?0)' && eval 'exec /usr/local/bin/perl -S $0 ${1+"$@"}'
& eval 'exec /usr/local/bin/perl -S $0 $argv:q'
    if 0;

#$whoami = ($0 =~ m,([^/]*)$,) ? $1 : $0;

%printed = ();
while (<>)
{
    chop;
    s,^\./,,;
    @fields = split('/');
    $path = "";
    for ($i = 0; $i < @fields; $i++)
    {
	$path .= $fields[$i];
	if (! exists $printed{$path})
	{
	    $printed{$path} = 1;
	    print ' ' x ($i * 2);
	    print $fields[$i], "\n";
	}
	$path .= "/";
    }
}
