: # Use perl
    eval 'exec perl -S $0 "$@"'
    if 0;


$folder= @ARGV[0];
$outDir= "/home/B10E/msen7/.netscape/BOOKMARKs/";
$outfile=$folder;
$outfile=~ s/ //g;
$outfile=$outDir.$outfile.".html";

$infile="/home/B10E/msen7/.netscape/bookmarks.html";

print " open bookmarks.html for $folder \n";
open(IN,$infile)||print "Can not open bookmarks.html\n" ;

while( !($line =~ /$folder/ )){
    $line=<IN>; 

}
print " open output file: $outfile";
open(OUT,">$outfile");
$dlc=0; $start=0;
&printHeaders;

while ( ($dlc != 0) || !$start ){
    $tab="";
    for($i=0;$i<$dlc;$i++){ $tab.= "    ";}
    $skip=0;$dir=0;
    if ($line =~ /<DL><p>/) {
	$dlc++; $start++; $skip=1;
	print "$tab+\n";
	$line=~ s/<p>//g;
    }
    elsif ($line =~ /<\/DL><p>/) {
	$dlc--; print  "$tab-\n"; $skip=1;
	$line=~ s/<p>//g;
    }
    elsif (($line =~ /<DD>/)|| ($line =~ /<HR>/)) {$skip=1;}

    if ($line =~ /<\/H3>/) {
	$dir=1;
	$line=~ s/H3/H4/g;

    }
    if ($dir) {
	chop($line);
	$line="<font color=red>".$line."</font>\n";
    } 
    print OUT $line;

#print ".";
    $name=$line;
    $name=~ s/.*">//g;
    $name=~ s/<.*//g;

    if (!$skip) {print "$tab$name";}
    $line=<IN>;
}
close(IN);
&printFooters;
close(OUT);

sub printHeaders {
    print OUT <<EOF;
<HTML>
<HEAD>
<TITLE></TITLE>
<SCRIPT LANGUAGE="JAVASCRIPT">
<!--
function WinOpen() {
   open(this.document.location.href,"Window1","location,resize,top=100,left=150,toolbar,menubar,directories,status,scrollbars=yes,resizable,height=850,width=300, scrollbars=yes");

}
//-->
</script>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFDEAD" LINK="#0000EE" VLINK="#551A8B" ALINK="#FF0000" BACKGROUND="file:./bm.gif" >
<base target="bm">
<form>
<input type="button" name="WindowButton" value="Secondary Window--Click on me" onclick="WinOpen()">
</form>			
 <font face=Helvetica size=-1>
EOF
				}

sub printFooters{
    print OUT <<EOF;
</font>
</base>
</BODY>
</HTML>
EOF
		    }

