0N/A##########################################################################
0N/A# This script allows the user to email a file or directory to another
0N/A# user. It will gzip and uuencode files (if necessary) and tar
2362N/A# directories. If the COMPRESS enviroment variable is set, it will
0N/A# use the program COMPRESS instead of gzip.
2362N/A##########################################################################
0N/Aif [[ $tk_version = "" ]]
0N/A tk_version=xxx exec tksh $0
0N/A print -u2 "This script requires Tksh"
2362N/A########################### Open File Dialog Box #########################
0N/Afunction GetFile # msg default
0N/A typeset msg="${1-"Select a file:"}" olddir="$(pwd)" f="${2-"$(pwd)/"}"
0N/A typeset w=$(toplevel .fileselect -bd 4 -class Getfile)
0N/A wm title .fileselect "$msg"
2981N/A tkwait variable GetFileDone
2981N/Afunction GetFileWindow # w msg
0N/A typeset w=$1 msg="$2"
0N/A message $
w.msg -aspect 1000 -text "$msg"
0N/A -command $'#!ksh\n'"GetFileName='' ; GetFileDone=1"
0N/A # Take this out if you want a generic open file dialog box
0N/Afunction GetFileResources
0N/A option add "*Getfile*
l.text" Selection: startup
0N/Afunction MkXYScroll # widget
0N/Afunction GetFileSetFiles # widget
0N/A if [[ -d $GetFileName ]]
0N/A $dwidget delete 0 end
0N/A $fwidget delete 0 end
0N/A $dwidget insert end ..
0N/A [[ -f $i ]] && w=$fwidget
0N/Afunction GetFileSClick # widget point
0N/A GetFileName=$(pwd)/$($1 get $($1 nearest $2))
0N/Afunction GetFileDClick # widget point
0N/A##########################################################################
0N/AGetFile "Select file to send:"
0N/A[[ $GetFileName == "" ]] && exit 0
0N/A[[ $Dest == "" ]] && exit 0
0N/Aname=$(basename $GetFileName)
28N/A *.gz) uuencode $name < $GetFileName | mail $Dest ;;
28N/A *.tgz) uuencode $name < $GetFileName | mail $Dest ;;
0N/A *.uu) mail $Dest < $GetFileName ;;
2241N/A tar -cvpf - $GetFileName | COMPRESS | uuencode \
0N/A $COMPRESS < $GetFileName | uuencode $name.$EXT | mail $Dest