#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create:
#	xarchia
#	xarchia-filter
# This archive created: Sun Mar  7 15:33:11 1993
export PATH; PATH=/bin:/usr/bin:$PATH
echo shar: "extracting 'xarchia'" '(3659 characters)'
if test -f 'xarchia'
then
	echo shar: "will not over-write existing file 'xarchia'"
else
sed 's/^	X//' << \SHAR_EOF > 'xarchia'
	X#!/usr/contrib/bin/wish -f
	X#
	X# This code is a modification of the alex tcl browser.
	X# It searches archia (new.archia to be precise) for files matching
	X# its parameter(s) and lets you browse them. As with the browser on
	X# which it's based, files and directories can be opened by double-
	X# clicking.
	X#       Brad Broom
	X#
	X# This code is a slight modification of the demo browser included
	X# with the tcl release found in /alex/edu/berkeley/sprite/tcl
	X#       Vince Cate    
	X#
	X# This script generates a directory browser, which lists the working
	X# directory and allows you to open files or subdirectories by
	X# double-clicking.
	X
	X# Create a scrollbar on the right side of the main window and a listbox
	X# on the left side.
	X
	Xscrollbar .scroll -command  "myscroll"
	Xlistbox .list -yscroll ".scroll set" -relief raised -geometry 80x30
	Xlistbox .list2 -yscroll ".scroll set" -relief raised -geometry 40x30
	X
	X# Use constant width fonts to make the directory listing readable.
	X.list  configure -font "-Adobe-courier-medium-R-Normal--*-120-*"
	X.list2 configure -font "-Adobe-courier-medium-R-Normal--*-120-*"
	X
	Xpack append . .scroll {right filly} .list2 {left} .list {left expand fill}
	X
	X# The procedure below scrolls both lists to the specified position.
	Xproc myscroll {loc} {
	X    .list yview $loc
	X    .list2 yview $loc
	X}
	X
	X# The procedure below is invoked to open a browser on a given file;  if the
	X# file is a directory then another instance of this program is invoked; if
	X# the file is a regular file then the Mx editor is invoked to display
	X# the file.
	X
	Xproc mybrowser {dir file} {
	X    if {[string compare $dir "."] != 0} {set file $dir/$file}
	X
	X    puts stdout "$file"
	X    flush stdout
	X
	X    if [file isdirectory $file] {
	X	exec browser $file &
	X
	X    } else {
	X        case $file {
	X           {*.gif}   {exec xloadimage $file       & }
	X           {*.gif.Z} {exec xloadimage $file       & }
	X           {*.pbm}   {exec xloadimage $file       & }
	X           {*.pbm.Z} {exec xloadimage $file       & }
	X           {*.ps}    {exec gv $file               & }
	X           {*.PS}    {exec gv $file               & }
	X           {*.dvi}   {exec xdvi $file             & }
	X           {*.au}    {exec cat $file > /dev/audio & }
	X           {default} {
	X                    if [file isfile $file] {
	X                        exec xedit $file &
	X    
	X                    } else {
	X                        puts stdout "\"$file\" ERROR - probably symlink to nowhere " 
	X                        flush stdout
	X                    }
	X            }
	X        }
	X    }
	X}
	X
	X# Give ourselves an information title.
	X
	Xif { $argc == 0 } { puts stderr "Usage: xarchia \[archia options\] searchstring ..."; exit }
	X
	Xwm title . "xarchia $argv"
	X
	X# Fill the listbox with a list of all the files matching the parameters (run
	X# the "archia" command and filter its output to get that information).
	X# The filter's output is a list of 2-tuples. The 0'th element of each is
	X# the alex file name. The 1'st element is the directory listing concerned.
	X
	Xforeach i [eval [list exec archia] $argv | xarchia-filter ] {
	X    .list insert end [ lindex $i 0 ]
	X    .list2 insert end [ lindex $i 1 ]
	X}
	X
	X# Set up bindings for the browser.
	X
	Xbind .list <Control-q> {destroy .}
	Xbind .list <Control-c> {destroy .}
	Xfocus .list
	Xbind .list <Double-Button-1> {foreach i [selection get] {mybrowser "." $i}}
	Xbind .list <Button-2> {destroy .}
	Xbind .list <Button-3> {destroy .}
	X
	X# Set up bindings for the directory list.
	X
	Xbind .list2 <Double-Button-1> {foreach i [.list2 curselection] {mybrowser "." [.list get $i]}}
	Xbind .list2 <Control-q> {destroy .}
	Xbind .list2 <Control-c> {destroy .}
	Xbind .list2 <Button-2> {destroy .}
	Xbind .list2 <Button-3> {destroy .}
	X
SHAR_EOF
if test 3659 -ne "`wc -c < 'xarchia'`"
then
	echo shar: "error transmitting 'xarchia'" '(should have been 3659 characters)'
fi
chmod +x 'xarchia'
fi
echo shar: "extracting 'xarchia-filter'" '(702 characters)'
if test -f 'xarchia-filter'
then
	echo shar: "will not over-write existing file 'xarchia-filter'"
else
sed 's/^	X//' << \SHAR_EOF > 'xarchia-filter'
	X#!/bin/sh -f
	X#
	X# Filter output from archia into a form xarchia can digest.
	X#
	X# The input is assummed to consist of entries like
	X#
	X# /alex/.../name
	X#          DIRECTORY directory-listing-waffle name
	X#
	X# /alex/..../name
	X#          FILE      directory-listing-waffle name
	X#
	X# The output consists of a single line for each entry, like:
	X#
	X#	{ /alex/.../name "DIR  directory-listing-waffle" }
	X#	{ /alex/.../name "FILE directory-listing-waffle" }
	X#
	X
	Xawk 'BEGIN { dq = sprintf ("%c", 34) }
	X     $1 ~ /^\/alex/ { file = $1 }
	X     $1 == "DIRECTORY" || $1 == "FILE" { print "{", file, dq, $0, dq, "}" }'  |
	Xsort -u |
	Xsed -e 's/[ 	]*DIRECTORY[ 	]*/DIR  /' -e 's/[ 	]*FILE[ 	]*/FILE /' -e 's/[ 	]*[^ 	]* " }$/" }/'
SHAR_EOF
if test 702 -ne "`wc -c < 'xarchia-filter'`"
then
	echo shar: "error transmitting 'xarchia-filter'" '(should have been 702 characters)'
fi
chmod +x 'xarchia-filter'
fi
exit 0
#	End of shell archive
