#!/bin/sh 
#
# Filter output from archia into a form xarchia can digest.
#
# The input is assummed to consist of entries like
#
# /alex/.../name
#          DIRECTORY directory-listing-waffle name
#
# /alex/..../name
#          FILE      directory-listing-waffle name
#
# The output consists of a single line for each entry, like:
#
#	{ /alex/.../name "DIR  directory-listing-waffle" }
#	{ /alex/.../name "FILE directory-listing-waffle" }
#

awk 'BEGIN { dq = sprintf ("%c", 34) }
     $1 ~ /^\/alex/ { file = $1 }
     $1 == "DIRECTORY" || $1 == "FILE" { print "{", file, dq, $0, dq, "}" }'  |
sort -u |
sed -e 's/[ 	]*DIRECTORY[ 	]*/DIR  /' -e 's/[ 	]*FILE[ 	]*/FILE /' -e 's/[ 	]*[^ 	]* " }$/" }/'
