RNALIB 2.2 beta - part 3 of 4

Paolo Ventafridda venta at otello.sublink.org
Mon Feb 11 06:54:51 AEST 1991


Archive-name: RNALIB-22_b1/part03

---- Cut Here and unpack ----
#!/bin/sh
# this is z-rnalib.03 (part 3 of RNALIB-22_b1)
# do not concatenate these parts, unpack them in order with /bin/sh
# file RNA continued
#
if touch 2>&1 | fgrep '[-amc]' > /dev/null
 then TOUCH=touch
 else TOUCH=true
fi
if test ! -r shar3_seq_.tmp; then
	echo "Please unpack part 1 first!"
	exit 1
fi
(read Scheck
 if test "$Scheck" != 3; then
	echo "Please unpack part $Scheck next!"
	exit 1
 else
	exit 0
 fi
) < shar3_seq_.tmp || exit 1
echo "x - Continuing file RNA"
sed 's/^X//' << 'zXqzXqzXq' >> RNA &&
X# file as a normal mail folder for programs like 'ELM'. Remember to
X# clear it out once every while ;-)
X# Be tidy! Keep it inside RNADIR.
XMAIL_LOG=$RNADIR/mail
X#
X# Name of the public directory for transfers using 'uucp' or 'uusend'.
X# We suggest a '~' (which leads to /usr/spool/uucppublic) as default;
X# if you are going to change this, remember that remote sites need this
X# path to be writable, or your files will be rejected!
X# Do also consider that some UUCP emulators - such as UFgate or Waffle -
X# do *not recognize "/usr/spool/uucppublic", but *accept "~".
XPUBDIR=~
X#
X# Debugging would occure on stdout, NOT on LOGFILE.
X# 1=debug (try it for fun), nodebug= leave it EMPTY (dont put a 0)
X# Debug is for interactive usage only. Do not set debug mode for daemon's tasks
X# Using rna's MAKE you can disable debug mode all the way.
XDEBUG=1
X#
X# Some progs never in the same place... please tell me: where is the mailer?
X# I mean the one you would use as 'mail user' to send mail to user. 
X# Usually /bin/mail, though on some systems you could try /bin/rmail.
X# Since RNA adds its own Subject line, be sure the mailer does not ask for it!
X# If RNA messages comes without a Subject this is the reason..
XMAILER=/bin/mail
X#
X# Where is 'uuencode'? I assume you have this utility. If you don't have this
X# utility you are not likely to ship binary files via mail, unless you have
X# btoa. In this case leave it EMPTY (nothing after the =).
X#
XUUENCODE=/usr/local/bin/uuencode
X#
X# Where is 'btoa'? If you don't have it, leave it EMPTY  (nothing after the = )
X# Btoa is better than uuencode: it saves some 15% space. You don't really
X# need it for RNA, but if you happen to have btoa put it here. Default encoding
X# still will be the good-old uuencode. Beware: i am referring to the second
X# version of btoa, the one that does not need 'atob' to convert back.
X# Still this version is compatible with the old release, BUT syntax to use
X# is quite different. If you have an old version of btoa, no problem: find
X# the RNA procedure called 'Convert_File()'; there's a 'case' inside, and
X# a notice about this matter.
XBTOA=/usr/local/bin/btoa
X#
X# Where is 'compress'? If you don't have it, leave it EMPTY 
X# (nothing after the =). It sounds pretty strange to me an empty declaration
X# here, since the whole world nowdays has compress. Ask for GNU-compress!
XCOMPRESS=/usr/local/bin/compress
X#
X# Where is 'lharc'? If you don't have it, leave it EMPTY
X# (nothing after the =). It is compatible with the same program under
X# MsDos and it is better than compress: it saves some 20% space but it is
X# more slow during compression.
XLHARC=
X#
X# Where is 'zoo'? If you don't have it, leave it EMPTY
X# (nothing after the =). It is compatible with the same program under
X# MsDos; it's not better than compress, anyhow it's used around, so ..
XZOO=
X#
X# Where is 'tar'? If you want to convert files between "compress" "lharc"
X# and "zoo" you must have it. A public domain 'tar' is also available from
X# the GNU guys. 
XTAR=/usr/local/bin/tar
X#
X# Where do you keep 'uucp', the usual command?
X# I know everybody has one. If you don't want files travelling over
X# the network with 'uucp' then omit the declaration: files will be
X# travelling in ascii format via normal e-mail. 
X# Caution: read Operator's Guide chapter 'Transmission layers'!
XUUCP=/usr/bin/uucp
X#
X# Where is 'uusend'? If you don't have it, leave it EMPTY (nothing after 
X# the = ). This is a common utility which replaces 'uuto' and 'uucp' on
X# some old (V7) uucp based systems. 
X# Caution: read Operator's Guide chapter 'Transmission layers'!
XUUSEND=/usr/local/bin/uusend
X#
X# Where is 'file'? As you should know, this is a Berkeley utility now
X# commonly distributed with almost *every serious unix system.
X# 'file' examines a specified file and gives informations about it.
X# Since RNA has to figure out by itself whether or not requested files
X# are ASCII or BINARY, we definitively *need* the berklish 'file'.
X# So know, com'on..
XBKFILE=/bin/file
X#
X# Where is 'strings' ? we use it just a couple of times, to grep out
X# blank lines from 'pathsize' (you'll learn about it later on).
X# This command is pretty standard, however my 3B2 with Unix 3.2 is
X# missing it (*sic)! I wrote a small 'strings.c' which you might
X# compile and use in case there's no 'strings' on your system.
X# If you don't have a C compiler on your system, grasp a bottle of
X# Wild Turkey.
XSTRINGS=$BINDIR/strings
X# 
X# This is important (;-)). RNA needs an index file containing libraries'
X# names along with their real paths. Since you are installing RNA for
X# something, i assume you HAVE at least one 'library', don't you?
X# With RNA distribution comes a file named 'libindex' which contains
X# some more docs about its structure. "libindex" is my suggested name for..
X# [ NOTE: inside OPER.GUIDE we always refer to this suggested name. ]
XLIBIND=$RNADIR/libindex
X#
X# If you plan to use 'Lists', you need an index file for them also.
X# With 'lists' we mean lists of users whose email addresses are 
X# inserted automatically by sending special commands to rna.
X# So we are talking of handling mailing lists, basically.
X# With RNA distribution comes a file named 'lstindex' which contains
X# some more docs about its structure. "lstindex" is my suggested name for..
X# [NOTE: inside OPER.GUIDE we always refer to this suggested name. 
X#  If you are not going to use the 'Lists' capability of RNA, leave
X#  this field BLANK, i.e. nothing after the = ).   ]
X# LSTIND=$RNADIR/lstindex
XLSTIND=$RNADIR/lstindex
X#
X# This file contains names/paths which are not allowed to use RNA.
X# With RNA distribution comes a file named 'black' which contains some
X# more docs about its structure. "black" is my suggested name for..
X# [ NOTE: inside OPER.GUIDE we always refer to this suggested name. ]
XBLACKLIST=$RNADIR/black
X#
X# This file contains names/paths which are authorized to forward RNA requests
X# for others, i.e.: send files to other people. Normally RNA sends back to
X# the original user/system who sent the mail.
X# With RNA distribution comes a file named 'white' which contains some
X# more docs about its structure. "white" is my suggested name for..
X# [ NOTE: inside OPER.GUIDE we always refer to this suggested name. ]
XWHITELIST=$RNADIR/white
X#
X# If something goes wrong with the mail, RNA will receive back its stuff
X# from somewhere. Of course this is a dangerous situation, so RNA will
X# recognize and skip this mail. A copy will be put inside..
X# [ NOTE: inside OPER.GUIDE we always refer to this suggested name. ]
XREJECTED=$RNADIR/rejected
X#
X#
X# You may choose to limit rna activities within certain paths to
X# a definite amount of bytes transmitted. For instance, you would
X# like to keep an host under control: if that host asks for more than
X# -say- 300.000 bytes, any further request should be denied. This is
X# called 'pathsizing'. RNA will check that any request coming from somewhere
X# has 'credits' before accepting its query; afterwards, its credits will be
X# updated. Following variable contains the name of the file which is going
X# to keep paths&credits notes. 
X# If you don't care about 'pathsizing', leave it blank.
X# [ NOTE: inside OPER.GUIDE we always refer to this suggested name. ]
X# PATHSIZE=$RNADIR/pathsize
XPATHSIZE=$RNADIR/pathsize
X#
X# (Needed only if you chose pathsizing above) 
X# If a path is not appearing inside pathsize, by default a no-limit credit
X# is given. You may want RNA to automatically add any new path to its
X# pathsize, with a default credit given. So...
X# Put a  0   if you want that new sites ask to be registered before being
X#            authorized to use your RNA service. Any new path will be notified
X#            that a membership is required in order to use your service.
X# Put a size in bytes -say 200000 (do not put any fullstops!)- as default
X#            credit limit for any new path. 'pathsize' will be updated with
X#            this new path and this number.
X# Leave it BLANK if you don't want to limit new paths. This way only paths
X#            already included inside 'pathsize' will be affected by pathsizing.
X# More info inside RNA Operator's Guide, chapter 'Pathsizing'.
XCREDIT=300000
X#
X# Where is 'shar' ? If you want to send your files via e-mail and you also
X# would like to let users split them into several smaller parts, you need
X# shar version 3.xx.  We are using shar 3.24, actually.
X# If you don't have it, leave it EMPTY (nothing after the =), in this case
X# the SPLIT command will not be available (don't worry).
X# WATCH OUT: we are asking for 'shar', not for 'split'!
XSPLIT=/usr/local/bin/shar
X#
X# You may choose to limit shar activity within certain parameters;
X# please set these variables:
X# The minimum amount of Kbytes allowed for a split file (in K)
X# A user cannot ask for splitting with values lower than...
XMIN_SPLIT=10
X# The maximum amount of Kbytes after which a file to be sent over email
X# will be split automatically. No matter if the user asked for it or not.
XMAX_SPLIT=100
X# A user can ask for file splitting without giving a value.
X# In any case, this is your default split size.
XDEF_SPLIT=50
X#
X# No matter of what the 'SPLIT' family variables say, you might need to
X# limit email size. For instance, our network policy here allows sites
X# to cut email longer than 300k bytes. This limit overrides SPLIT, 
X# so be careful not to choose a smaller one if you use SPLIT. Well,
X# i think you can understand yourself this possible problem!
XMAIL_LIMIT=300
X#
X# You are done. No more variables to configure. You need to check for
X# RNADIR TMPDIR CONVDIR and (if not '~') PUBDIR existance; remind!
X# NOW search forward for ' %%FIX%% ' : these are entry points for
X# possible configuration-dependent problems. Do check every %%FIX%%
X# and be sure everything is ok. The last %%FIX%% has some more 
X# informations for you. Do carefully follow %%FIX%% (again) until
X# the last one (it tell's you that you got to the final fix, don't
X# worry). Happy 'tuning'!
X# 
X# ==============================================================
X#
X# Internal tmp files.
X# -------------------
XMBOX_COPY=$TMPDIR/tmp
XMBOX_CUT=$TMPDIR/cut
XCMDS=$TMPDIR/tmpcmds
XCMDLOG=$TMPDIR/commlog
XPOINTERS=$TMPDIR/punt
XERRSTAT=$TMPDIR/err
XOUTFILE=$TMPDIR/outfile
XUUCP_ADDRESS=$TMPDIR/address
XFNAME=$TMPDIR/name
XSPLITLOG=$TMPDIR/splitlog
X# -------------------- some procedures... ----
X
X#
XExport() {
X# This is needed only for running external programs through RNALIB.
X# Only these variables are exported to subprograms.
X#
X# Primary environment
Xexport RNAVERS PATH RNADIR HELPDIR TMPDIR CONVDIR SPLITDIR LOGNAME UNAME
Xexport POSTMASTER LISTMASTER MAXLENGTH MAILBOX LOGFILE MAIL_LOG PUBDIR
Xexport DEBUG MAILER UUENCODE BTOA COMPRESS LHARC ZOO TAR UUCP UUSEND
Xexport BKFILE STRINGS LIBIND LSTIND BLACKLIST WHITELIST REJECTED PATHSIZE
Xexport CREDIT SPLIT MIN_SPLIT MAX_SPLIT DEF_SPLIT MAIL_LIMIT 
X#
X# Secondary environment
Xexport MBOX_COPY MBOX_CUT CMDS CMDLOG POINTERS ERRSTAT OUTFILE UUCP_ADDRESS
Xexport FNAME SPLITLOG ARPA_SENDER UUCP_SENDER 
X}
X
X# %%FIX%%
XGetMail() {
X#	This function does three things; 1st) moves rnalib mailbox into
X#	a temporary file. 2nd) creates back a new empty rnalib mailbox
X#	3rd) archives the temporary files inside another mailbox file.
X#	You might need to fix JUST the 2ND thing..
X	rm -r $TMPDIR 2>/dev/null; mkdir $TMPDIR 2>/dev/null
X	chown rnalib $TMPDIR; chgrp mail $TMPDIR
X#	rm $MBOX_COPY 2>/dev/null
X	mv $MAILBOX $MBOX_COPY
X#	.. here it is: we CREATE BACK THE ORIGINAL MAILBOX, for instance
X#	/usr/spool/mail/rnalib   or  /usr/mail/rnalib  or whatever.
X#	A simple 'touch $MAILBOX' could do; HOWEVER be *very *sure that
X#	the new mailbox has the right owner/group permissions once created.
X#	This is all you need: a regular empty folder, just like a normal one.
X#	Here are some suggestions:
X#	'>$MAILBOX'    (easy to start with)
X#	'touch $MAILBOX; chown $LOGNAME $MAILBOX; chgrp mail $MAILBOX;
X#	 chmod 620 $MAILBOX'   etc. Watch out for that 620, you might need
X#	to change it; just an example!
X#	Don't panic and carefully fix the following line:
X#
X	touch $MAILBOX; chown $LOGNAME $MAILBOX; chgrp mail $MAILBOX; chmod 666 $MAILBOX
X#
X#	That's all. Leave the rest as-it-is. Go on for the next fix..	
X	touch $MAIL_LOG; echo "`cat $MBOX_COPY`\n" >>$MAIL_LOG 
X}
X
XStartup() {
X	touch $LOGFILE
X	message=1
X}
X
XClrTmpFiles() {
X	rm -f $CMDLOG 2>/dev/null; touch $CMDLOG
X	rm -f $ERRSTAT 2>/dev/null; touch $ERRSTAT
X	rm -f $CMDS 2>/dev/null
X	rm -r $CONVDIR 2>/dev/null; mkdir $CONVDIR 2>/dev/null
X	chown rnalib $CONVDIR; chgrp mail $CONVDIR
X	rm -r $SPLITDIR 2>/dev/null; mkdir $SPLITDIR 2>/dev/null
X	chown rnalib $SPLITDIR; chgrp mail $SPLITDIR
X	rm -f $SPLITLOG 2>/dev/null; touch $SPLITLOG
X	rm -f $FNAME 2>/dev/null; touch $FNAME
X	rm -f $UUCP_ADDRESS 2>/dev/null; touch $UUCP_ADDRESS
X	rm -f $OUTFILE 2>/dev/null; touch $OUTFILE
X	ARPA_SENDER=""; UUCP_SENDER=""; REQUEST_DATE=""; UUCP_HOST=""
X	UUCP_DESTIN=""; FCPRTIPE=""
X}
X
XCutMail() {
XNotTheFirst=0
Xrm -f $POINTERS 2>/dev/null; touch $POINTERS
X
Xgrep -n '^From ' $MBOX_COPY | PrintSumm
Xset `cat $MBOX_COPY | wc -l`; echo $1 >>$POINTERS
X}
X
XPrintSumm()
X{
X    IFSorg=$IFS
X    while read Linea
X    do
X	IFS=$IFSorg
X	set $Linea
X
X# %%FIX%%
X# 	This is a VERY IMPORTANT FIX- watch out!
X#	Question: how many fields has the very first 'From' line of a
X#	          mail message on YOUR system? 
X#	To answer, do a shell escape from your editor NOW and mail yourself
X#	a message. Then edit your mailbox, and examine the first From, the
X#	one WITHOUT colons. Here's mine, for instance:
X#       From deejay!gear!marlor Wed Feb 21 12:32:44 1990
X#	 1            2          3   4  5     6       7
X#	So i know my mailer adds a 7-fields' From header.
X#	Your mailer could add a timezone as well, and you would get 8 fields.
X#	RNA does not trust by default any (apparently) valid header.
X#	We extract the beginning of a mail inside our mailbox looking for
X#	a 'From '(note the space) standing on a 7 (or whatever) fields line.
X#	[ELM 2.2 just looks for a From with a space and more than 2 fields]
X#	Replace the following number with the one you need:
X
X	if [ $# = 7 ]
X	then
X	    IFS=":$IFSorg"
X	    set $Linea
X	    NumDiLinea=$1
X	    if [ $NotTheFirst != 0 ]
X	    then
X		echo "`expr $NumDiLinea - 2`" >>$POINTERS
X	    fi
X	    echo "$NumDiLinea \c" >>$POINTERS
X	    NotTheFirst=1
X	fi
X    done
X
X    IFS=$IFSorg
X}
X
XCut_Address() {
X	echo "$UUCP_SENDER" >> $UUCP_ADDRESS
Xif [ "$destination" != "DEFAULT" ]; then
X# arpa address, now can be used only for local nodes
X   if [ "`echo $UUCP_SENDER | grep '@'`" != "" ]; then 
X	set `sed -e "s/@/@ /" $UUCP_ADDRESS`; UUCP_HOST=$2"!"
X	
X# bang address, can be used for all the nodes in the world!	
X   elif [ "`echo $UUCP_SENDER | grep '!'`" != "" ]; then 
X	set `sed -e "s/[A-Za-z0-9]*$//g" $UUCP_ADDRESS`; UUCP_HOST=$1
X   fi	
Xelse
X	set `sed -e "s/[A-Za-z0-9]*$//g" $UUCP_ADDRESS`; UUCP_HOST=$1
Xfi
X}
X
XGetMessage() {
X	set `sed -n "$1 l" $POINTERS`
X#
X#	sed -n "$1,$2 l" $MBOX_COPY  >$MBOX_CUT
X#	This ^^^ sed in RNA 2.0 was giving problems. Now fixed.
X	sed -n "$1,$2 p" $MBOX_COPY  >$MBOX_CUT
X}
X
XGetDir()
X# this function gets a library name and returns its related path.
X# If library does not exist, nothing is returned. An argument is
X# expected. Lines containing " # " in $LIBIND are simply skipped.
X{
Xsearch=$1
Xset ""
Xset -f `grep -v '^#' $LIBIND`
Xwhile [ "$1" != "" ]
Xdo
X	test "$1" = "$search" && shift && echo $1 && break
X	shift
Xdone
X}
X
XGetDirLst()
X# this function gets a list name and returns its related path.
X# If list does not exist, nothing is returned. An argument is
X# expected. Lines containing " # " in $LSTIND are simply skipped.
X{
Xsearch=$1
Xset ""
Xset -f `grep -v '^#' $LSTIND`
Xwhile [ "$1" != "" ]
Xdo
X	test "$1" = "$search" && shift && echo $1 && break
X	shift
Xdone
X}
X
XCreaLst()
X{
Xsearch=$1
Xtest -r "$search/users" || {
X	>$search/users
X	test $DEBUG && echo "CreaLst: \"$search/users\" created (first time)"
X	echo "List \"$search/users\" created" >>$LOGFILE
X	}
X}
X
XChkUsrLst()
X# search for user address inside $1/users.
X# First we check his bang address (UUCP_SENDER); then his ARPA_SENDER address, if existing.
X# We give priority to the From line, since it's harder to fake than the From: one.
X# However, if no arpa address was found, parser copies the uucp one. I don't like this method,
X# but by the time being its better than nothing ;-)
X# Returns: matched name or nothing
X{
Xsearch="$1/users"
Xgrep "$UUCP_SENDER" $search
Xtest "$?" = "0" && return
Xgrep "$ARPA_SENDER" $search
X}
X
XAddUsrLst()
X# add $1 inside $2/users
X# returns: nothing
X{
Xecho "$1" >>$2/users
Xtest $DEBUG && echo "AddUsrLst: \"$1\" added to \"$2/users\" "
Xecho "Added $1 to \"$argument\" mailing list" >>$LOGFILE
X}
X
XRmvUsrLst()
X# removes $1 inside $2/users
X# returns: nothing, hopefully!
X{
Xsearch="$1"; lsearch="$2/users"
Xtest $DEBUG && echo "Removing \"$search\" from \"$lsearch\" "
Xcp $lsearch $TMPDIR/ousers
Xgrep -v "$search" $TMPDIR/ousers >$lsearch
Xecho "Removed $1 from \"$argument\" mailing list" >>$LOGFILE
X
X}
X
X
XStripPermAndLink()
X{
X    while read line
X    do
X	set -- $line
X	echo "$3\t$4,$5\t$6\t$7"
X    done
X}
X
X
XFileType()
X# Arg: file_path  (full)
X# Returns: null if file is ASCII-TEXT; output of "file" command if not.
X{
Xfilename=$1; IFSorg=$IFS
XIFS=":"; set `echo "dummy"; $BKFILE $filename | grep -v text`; IFS=$IFSorg
Xtest -n "$2" && echo $2
X}
X
X
X
XGetFile()
X# Parameters: static $argument $from
X# Returns:  path_to_file; null if file does not exist
X{
XGFpath=`GetDir $from`
Xif [ "$GFpath" != "" ]; then
X	test -r $GFpath/$argument && echo $GFpath/$argument 
Xfi	
X}
X
XListLib()
X# Parameters: library
X{
XLLlib=$1
XLLpath=`GetDir $LLlib`
Xecho "\nList of files inside \c"
X
Xif [ "$LLlib" = "DEFAULT" ]; then
X	echo "RNA system library:";
Xelse
X	echo "\"$LLlib\" library:\n"
Xfi
X
Xif [ "$LLpath" = "" ] 
Xthen
X	NoLibrary_Msg
Xelse
X	ls -got $LLpath | StripPermAndLink
Xfi
X}
X
XFindMe()
X# Parameters: none.
X# returns: mailing-lists with arpa_sender or uucp_sender, if any.
X{
XFFchars="" ; FFmatch=""
Xecho "\nLooking for your name inside available mailing lists here.\n"
X
Xif [ "$ARPA_SENDER" = "$UUCP_SENDER" ] ; then
X	echo "\
XYour current mail address does not contain a valid \"arpa\" header:\n\
Xsearching only for \"$UUCP_SENDER\" ..."
Xelse
X	echo "\
XYour current mail address is showing two valid \"From\" headers:\n\
Xoriginal   UUCP-from is: <$UUCP_SENDER>\n\
Xadditional ARPA-from is: <$ARPA_SENDER>\n\
XSearching for both of them: under some circumstances you might get\n\
Xthe same address twice- don't worry.  An address is  always unique\n\
Xinside the same mailing list.\n"
Xfi
X	
Xecho "====================================================================="
Xset "" ; set -f `grep -v '#' $LSTIND`
Xwhile [ "$1" != "" ]
Xdo
X	FFlib=$1; FFpath=$2; FFmatch="" 
X###	rnalib 2.2 a07:
X###	grep $UUCP_SENDER $FFpath/users && FFmatch="ok" 
X	test -r $FFpath/users && grep $UUCP_SENDER $FFpath/users && FFmatch="ok" 
X	if [ "$UUCP_SENDER" != "$ARPA_SENDER" ]; then
X		test -r $FFpath/users && grep $ARPA_SENDER $FFpath/users && FFmatch="ok"
X	fi
X	test -n "$FFmatch" && FFchars="ok" && echo "\
X=============== found inside mailing-list: \"$FFlib\""
X	shift; shift
Xdone
Xtest -z "$FFchars" && echo "\
XApparently, your name (network address) could not be found here.\n\
XLooks like you are not subscribed to any mailing list- Sorry\n\
X====================================================================="
X}
X
X
X
XFindFile()
X# Parameters: characters to match in searched file
X# Returns: matching libraries and files, if any
X{
XFFchars=$1; FFmatch=
Xecho "\nREQUEST: search for file names containing <$FFchars>."
Xecho "         Look inside all available libraries, and\n\
X         try  both  lower/upper case combinations.\n"
Xecho "=====================================================\n"
Xset ""
Xset -f `grep -v '#' $LIBIND`
Xwhile [ "$1" != "" ]
Xdo
X	FFlib=$1; FFpath=$2;
X# %%FIX%%
X# On Unix V.3.2 (?) like the one from SCO, the 3B2 etc., grep's family
X# commands follow Posix. Posix suppressed '-y' and added '-i'.
X# Jesus, all we want is a non-case sensitive grep! If you run sco-xenix 386,
X# 'grep -y' should work. If you are on SCO-unix, 'fgrep -y' will.
X# Generally, 'fgrep -i' is a good chance (3B2 Unix 3.2)
X# Have a look at your grep/fgrep and pick up the right one. Change the
X# following line, if needed..................
X	ls -got $FFpath | StripPermAndLink | fgrep -i $FFchars && {
X#                                            ^^^^^^^^^
X		echo "\nfound inside library: \"$FFlib\""
X		echo "\n=====================================================\n"
X		FFmatch=ok
X		}
X	shift; shift
Xdone
Xtest -z "$FFmatch" && {
X	echo "\tNo matching files found - sorry"
X	echo "\n=====================================================\n"
X	}
X
X}
X
XCut_Ls()
X# %%FIX%%
X# We need to grep out of 'ls -log' the bytes number. Since the output
X# of that 'ls' is:   -rwxr-xr-x   1   33275 Feb  8 12:25 RNA
X# we use 'cut' (a common text utility) to pick up the right field.
X# On my system it came out from the 15th to 23th characters. Check yours too,
X# and find the right "-cn-n" (n=number) which extracts bytes. Good luck.
X# (DON'T PANIC: on sco xenix386, sco unix, olivetti lsx, hp-ux and at&t 3b2
X#  the 15-23 was fine. Probably it's ok for your site also!)
X#
X{
Xcut -c15-23
X}
X
XGetCat()
X{
Xlibr=$1
Xif [ "`GetDir $libr`" = "" ]; then
X	NoLibrary_Msg
Xelse
X	file="`GetDir $libr`/INDEX"
X	test -r $file && echo "\n`cat $file`" || echo "\n\
XNo index available for \"$1\" library, sorry.\n\
XHere comes a list of contents..."
Xfi
X}
X
XGetCatLst()
X{
Xlibr=$1
Xif [ "`GetDirLst $libr`" = "" ]; then
X	NoList_Msg
Xelse
X	file="`GetDirLst $libr`/NOTES"
X	test -r $file && echo "\n`cat $file`" || echo "\n\
XNotes unavailable for \"$1\" mailing list, sorry."
Xfi
X}
X
XBlackList()
X# Gets internal uucp-from path and checks if it's blacklisted.
X# Returns: blacklist matching, or nothing at all.
X{
Xset ""
Xset -f `grep -v '#' $BLACKLIST`
Xwhile [ "$1" != "" ]
Xdo
X	test -n "`echo $UUCP_SENDER | grep $1`" && {
X	echo "<$1> is matched inside <$UUCP_SENDER>" && break; }
X	shift
Xdone
X}
X
XToCheck()
X# checks if sender is authorized to use "To" or not.
X# returns a string if it's ok, nothing if not.
X{
Xset ""
Xset -f `grep -v '#' $WHITELIST`
Xwhile [ "$1" != "" ]
Xdo
X	test -n "`echo $UUCP_SENDER | grep $1`" && {
X	echo "<$1> is matched inside <$UUCP_SENDER>" && break; }
X	shift
Xdone
X}
X
XWith_Type() 
X{
Xencode_type="none"; compress_type="none" 
Xcase $with in 
X	compr|Compr|COMPR|\
X	compress|COMPRESS|Compress)
X		encode_type="uuencode"
X		compress_type="compress" 
X		;;
X
X	compr-btoa|Compr-Btoa|COMPR-BTOA|\
X	compress-btoa|COMPRESS-BTOA|\
X	Compress-Btoa)
X		encode_type="btoa"
X		compress_type="compress" 
X		;;
X	
X	compr-uuenc|Compr-Uuenc|COMPR-UUENC|\
X	compress-uuencode|COMPRESS-UUENCODE|\
X	compress-encode|COMPRESS-ENCODE|\
X	Compress-Uuencode|Compress-Encode)
X		encode_type="uuencode"
X		compress_type="compress" 
X		;;
X
X	lharc|Lharc|LHARC)
X		encode_type="uuencode"
X		compress_type="lharc"
X		;;
X
X	lharc-btoa|Lharc-Btoa|LHARC-BTOA)
X		encode_type="btoa"
X		compress_type="lharc"
X		;;
X
X	lharc-uuenc|Lharc-Uuenc|LHARC-UUENC|\
X	lharc-uuencode|LHARC-UUENCODE|\
X	lharc-encode|LHARC-ENCODE|\
X	Lharc-Uuencode|Lharc-Encode)
X		encode_type="uuencode"
X		compress_type="lharc"
X		;;
X
X	zoo|Zoo|ZOO)
X		encode_type="uuencode"
X		compress_type="zoo"
X		;;
X
X	zoo-btoa|Zoo-Btoa|ZOO-BTOA)
X		encode_type="btoa"
X		compress_type="zoo"
X		;;
X
X	zoo-uuenc|Zoo-Uuenc|ZOO-UUENC|\
X	zoo-uuencode|ZOO-UUENCODE|\
X	zoo-encode|ZOO-ENCODE|\
X	Zoo-Uuencode|Zoo-Encode)
X		encode_type="uuencode"
X		compress_type="zoo"
X		;;
X
X	DEFAULT|UUENCODE|ENCODE|\
X	uuencode|encode|ascii|\
X	Uuencode|Encode|ASCII)
X		encode_type="uuencode"
X		compress_type="none"
X		;;
X
X	BTOA|btoa|Btoa)	
X        	encode_type="btoa"
X		compress_type="none"
X		;;
X
X#	%%FIX%%
X#	The sender used a strange "with" field; a default behaviour
X#	follows. Put 'reject' as encode_type if you do not want any mailing
X#	whenever there's an invalid 'with'. 
X#	Currently this error is ignored (with a warning) and the stuff is
X#	shipped all the same using uuencode.
X#	This is just to let you know you can do it. No need to touch it
X#	for a normal usage.
X
X	*)	
X        	encode_type="uuencode"
X		compress_type="none"
X		WithError_Msg >>$OUTFILE
X		NeedHelp_Msg >>$OUTFILE
X		;;
Xesac
X
Xif [ "$compress_type" != "none" ]; then
X
X#  Check if file is already compress and what is the type of compression
X
X	cd $TMPDIR
X	echo "$argument" > $FNAME
X	set `sed -e "s/\.Z/ \.Z/" $FNAME`; FCPRTIPE=$2; FNAME=$1
X	if [ "$FCPRTIPE" != ".Z" ]; then
X	echo "$argument" > $FNAME
X	set `sed -e "s/\.lzh/ \.lzh/" $FNAME`; FCPRTIPE=$2; FNAME=$1
X	fi
X	if [ "$FCPRTIPE" != ".lzh" ] && [ "$FCPRTIPE" != ".Z" ]; then
X	echo "$argument" > $FNAME
X	set `sed -e "s/\.zoo/ \.zoo/" $FNAME`; FCPRTIPE=$2; FNAME=$1
X	fi
X
Xcase $compress_type in
X
X	compress)
X
X	set `echo $FNAME | wc -c`; length=`expr $1 - 1`
X    if [ "$length" -gt "$MAXLENGTH" ]; then
X	NoSuffix_Msg >> $OUTFILE
X	echo "\
XSubject: WARNING, file name too long for RNA compress\n\n\
X	Please rename file: \"$fname\" if possible.\n\
X	Its name is longer than \"$MAXLENGTH\" characters and\n\
X	RNA users can't ask for \"$COMPRESS\" shippings.\n\n\
X	                      Your friendly RNALIB DAEMON\n" | $MAILER $POSTMASTER 
X	return
X    else
X	FCPRNAME=$CONVDIR/$FNAME".Z"
X    fi
X#	Check if 'compress' is available.
X
X	test $COMPRESS || { NoCompr_Msg >> $OUTFILE; return; } &&  cd $CONVDIR
X	rm -f $TMPDIR/*.lzh
X	rm -f $TMPDIR/*.zoo
X	rm -rf $CONVDIR 2>/dev/null
X	cp $fname $CONVDIR
X
X    case $FCPRTIPE in
X
X	.lzh)
X		$LHARC x $CONVDIR/$argument
X		rm -f $CONVDIR/$argument
X		set `ls $CONVDIR | wc -l`
X		if [ "$1" -gt "1" ]; then
X		$TAR cvf $TMPDIR/convname "."
X		$COMPRESS -c $TMPDIR/convname >$FCPRNAME
X		fname=$FCPRNAME
X		argument=$FNAME".tar.Z"
X		else
X		$COMPRESS -c $FNAME >$FCPRNAME
X		fname=$FCPRNAME
X		argument=$FNAME".Z"
X		fi
X		UNCOMPRESS="uncompress or compress -d"
X		Compr_Msg >>$OUTFILE
X		;;
X	.zoo)
X		$ZOO -extract $CONVDIR/$argument
X		rm -f $CONVDIR/$argument
X		set `ls $CONVDIR | wc -l`
X		if [ "$1" -gt "1" ]; then
X		$TAR cvf $TMPDIR/convname "."
X		$COMPRESS -c $TMPDIR/convname >$FCPRNAME
X		fname=$FCPRNAME
X		argument=$FNAME".tar.Z"
X		else
X		$COMPRESS -c $FNAME >$FCPRNAME
X		fname=$FCPRNAME
X		argument=$FNAME".Z"
X		fi
X		UNCOMPRESS="uncompress or compress -d"
X		Compr_Msg >>$OUTFILE
X		;;
X	.Z)
X		Already_Msg >> $OUTFILE
X		rm -r $CONVDIR 2>/dev/null
X		return
X		;;
X	*)
X		$COMPRESS -c $FNAME >$FCPRNAME
X		fname=$FCPRNAME
X		argument=$FNAME".Z"
X		UNCOMPRESS="uncompress or compress -d"
X		Compr_Msg >>$OUTFILE
X		;;
X		
X    esac
X
X	;;
X
X	lharc)
X
X#	Check if 'lharc' is available.
X
X	test $LHARC || { NoCompr_Msg >> $OUTFILE; return; } &&  cd $CONVDIR
X	rm -f $TMPDIR/*.lzh
X	rm -f $TMPDIR/*.zoo
X	rm -rf $CONVDIR 2>/dev/null
X	cp $fname $CONVDIR
X
X    case $FCPRTIPE in
X
X	.Z)
X		TARNAME=""
X		$COMPRESS -d $CONVDIR/$argument
X		set `ls $CONVDIR`; TARNAME=$1
X		$TAR xf $TARNAME 2>$ERRSTAT
X	    if test -s $ERRSTAT; then
X		argument=$FNAME
X	    else
X		echo "$TARNAME" > $FNAME
X		set `sed -e "s/\.tar/ \.tar/" $FNAME`; FNAME=$1
X		argument=$FNAME
X		rm -f $CONVDIR/$TARNAME
X	    fi
X		;;
X	.zoo)
X		$ZOO -extract $CONVDIR/$argument
X		rm -f $CONVDIR/$argument
X		argument=$FNAME
X		;;
X	.lzh)
X		Already_Msg >> $OUTFILE
X		rm -r $CONVDIR 2>/dev/null
X		return
X		;;
X
X    esac
X
X   {
X
X	set `ls $CONVDIR`
X   while [ "$1" != "" ]
X   do
X	$LHARC a $TMPDIR/$FNAME".lzh" $1
X	rm $1; shift
X   done
X
X   }
X
X	fname=$TMPDIR/$FNAME.lzh
X	argument=$argument".lzh"
X	UNCOMPRESS="lharc x" 
X	Compr_Msg >>$OUTFILE
X	;;
X
X	zoo)
X
X#	Check if 'zoo' is available.
X
X	test $ZOO || { NoCompr_Msg >> $OUTFILE; return; } &&  cd $CONVDIR
X	rm -f $TMPDIR/*.lzh
X	rm -f $TMPDIR/*.zoo
X	rm -rf $CONVDIR 2>/dev/null
X	cp $fname $CONVDIR
X
X    case $FCPRTIPE in
X
X	.Z)
X		TARNAME=""
X		$COMPRESS -d $CONVDIR/$argument
X		set `ls $CONVDIR`; TARNAME=$1
X		$TAR xf $TARNAME 2>$ERRSTAT
X	    if test -s $ERRSTAT; then
X		argument=$FNAME
X	    else
X		echo "$TARNAME" > $FNAME
X		set `sed -e "s/\.tar/ \.tar/" $FNAME`; FNAME=$1
X		argument=$FNAME
X		rm -f $CONVDIR/$TARNAME
X	    fi
X		;;
X
X	.lzh)
X		$LHARC x $CONVDIR/$argument
X		rm -f $CONVDIR/$argument
X		argument=$FNAME
X		;;
X
X	.zoo)
X		Already_Msg >> $OUTFILE
X		rm -r $CONVDIR 2>/dev/null
X		return
X		;;
X    esac
X
X   {
X
X	set `ls $CONVDIR`
X   while [ "$1" != "" ]
X   do
X	$ZOO -add $TMPDIR/$FNAME".zoo" $1
X	rm $1; shift
X   done
X
X   }
X	fname=$TMPDIR/$FNAME.zoo
X	argument=$argument".zoo"
X	UNCOMPRESS="zoo -extract" 
X	Compr_Msg >>$OUTFILE
X	;;
X
Xesac
Xfi
X
X}
X
XConvert_File()
X{
Xftype=""; ftype="`FileType $fname`"
X
Xif [ "$viasped" != "NO_MAIL" ]; then
X
X# Did the sender request a special "with" for a simple ASCII file?
X# If so, we reject his request and ship the file as-it-is.
Xtest $with != "DEFAULT"  && test "$ftype" = ""  && NoNeed_Msg >>$OUTFILE 
X
Xif [ "$ftype" = "" ]; then
Xencode_type="none"
Xfi
X
X# If user asked for btoa encoding, see if btoa is available.
X# If btoa is not available we WON'T use uuencode; i suppose the sender had 
X# some reasons to choose btoa...
Xif [ "$encode_type" = "btoa" ]; then
X	test $BTOA || { NoBtoa_Msg >>$OUTFILE; return; } && Convert_Msg >>$OUTFILE
Xfi
X# The following 'fi' refers to 'viasped != no_mail'.
Xfi
X
Xtest "$encode_type" = "uuencode" && test "$viasped" != "NO_MAIL" && Convert_Msg >>$OUTFILE
X
X# We are about to ship the stuff; let's see if the destination address is 
X# different from the sender. If so, it's an authorized "external request"
X# and we want to notify the destination about it. 
X# Beware of 'reject' encode_type: we want to be sure that the stuff is sent
X# to the external destination only, in this case. Error announcements HAVE
X# to go to the original sender (what a mess!).
Xif [ "$encode_type" != "reject" ]; then
X	if [ "$destination" != "DEFAULT" ]; then
X		echo "\n\
XNote: this is an external request forwarded by $ARPA_SENDER for you.\n\
X      Original mail path is: <$UUCP_SENDER> .\n\
X		     " >>$OUTFILE
X	fi
Xfi
X
X# Verify that file will be split in several parts
X
Xtest -s $SPLITLOG && set `cat $SPLITLOG`
Xif [ "$1" = "N" ]; then
XNoSplit_Msg >>$OUTFILE
Xfi
X
Xtest "$viasped" != "NO_MAIL" &&
X	echo "\n-rnalib---------------------- cut here for \"$argument\" ------------" >>$OUTFILE
X
Xcase $encode_type in
X
X#	syntax: uuencode path/file internal_filename
X	uuencode)
X		if [ "$viasped" = "NO_MAIL" ]; then
X			NoConv_Msg >> $OUTFILE
X		else
X			$UUENCODE $fname $argument >>$OUTFILE
X		fi ;;
X
X#	%%FIX%%
X#	Syntax: btoa path/file -- warning: using old versions of btoa requires
X#	'cat $fname | btoa >>$OUTFILE' or something like. Get the new release!
X	btoa)
X		if [ "$viasped" = "NO_MAIL" ]; then
X			NoConv_Msg >> $OUTFILE
X		else
X			$BTOA $fname >>$OUTFILE
X		fi ;;
X
X#	encode_type equals "none" only if file is not binary, or if it
X#	going to be shipped with uusend or uucp (if available)
X	none)
X		if [ "$viasped" = "NO_MAIL" ]; then
X			NoConv_Msg >> $OUTFILE
X		else
X			cat $fname >>$OUTFILE
X		fi ;;
X
X#	Configuration choice: if $with is not a valid argument don't ship
X#	the binary encoding with "uuencode"; notify the sender, though.
X	reject) echo "\nPlease re-submit your request with proper parameter\n" >>$OUTFILE;;
X	
X	*) echo "\nRNA INTERNAL ERROR inside procedure Convert_File\n" >>$OUTFILE
X	echo "WARNING convert internal error (notified to operator)" >>$LOGFILE
X	test $DEBUG && echo "Internal error: encode_type=$encode_type";;
X
Xesac
X
Xtest "$viasped" != "NO_MAIL" &&
X	echo "\n-rnalib----------------------- end of file \"$argument\" ------------" >>$OUTFILE
X
X#	Be *very sure we are not shipping errors to an external destination!
Xif [ "$encode_type" != "reject" ]; then
X	if [ "$destination" != "DEFAULT" ]; then
X
X#		change destination...and good luck for delivery!
X
X		UUCP_SENDER=$destination	
X		ARPA_SENDER=$destination
X	fi
X	echo "Sent < $argument from $from - via $via > to $ARPA_SENDER" >>$LOGFILE
Xfi
X       
X}
X
X
XMail_File()
X{
Xtest $DEBUG && echo "Now mailing: $UUCP_SENDER"
XSignature >>$OUTFILE
X
X# We need to grep out of 'ls -log' the bytes number. 
Xset `ls -log $OUTFILE | Cut_Ls`
X
XN_KBYTES=`expr $1 / 1024`
Xtest $MAIL_LIMIT && test $N_KBYTES -gt $MAIL_LIMIT && {
Xtest $DEBUG && echo "File was not sent via e-mail because exceeding the limit"
Xrm -f $OUTFILE 2 >/dev/null; touch $OUTFILE
XHeaders_Msg >>$OUTFILE
XNoMail_Msg >>$OUTFILE
X#
X# %%FIX%%
X# If you trust or NEED domain addressing, then change $UUCP_SENDER
X# with $ARPA_SENDER. Think about this twice; let the bang routing
X# unless you *know *what *you *are *doing. Using SENDMAIL or any
X# mailer standing on a realtime network (internet for instance)
X# might require ARPA_SENDER. However, both formats might work.
X# This won't work with external destinations, of course.
X# If mail header did not contain an rfc822 arpa address then
X# don't worry: arpa_sender will just be a copy of uucp_sender.
X# Other FIXes on this matter follows here..
Xcat $OUTFILE | $MAILER $UUCP_SENDER
X#
Xrm -f $OUTFILE 2 >/dev/null; touch $OUTFILE
Xecho "\
XX-Mailer: $RNAVERS\n\
XSubject: Mail exceeded the limit permitted \n\n\
XWARNING: requested file \"$argument\" (size $N_KBYTES Kbytes)\n\
Xfrom $UUCP_SENDER has not been sent.\n\
X" >>$OUTFILE
XSignature >> $OUTFILE
Xcat $OUTFILE | $MAILER $POSTMASTER
Xreturn
X}
X
Xecho "SENTBYTES $1 <$UUCP_SENDER>" >>$LOGFILE
Xtest -n "$PATHSIZE" && Bill $OUTFILE
X
Xif [ "$SPLIT" != "" ]; then
X   if [ "$N_KBYTES" -ge "$MAX_SPLIT" ] || test -s $SPLITLOG && [ "$N_KBYTES" -ge "$MIN_SPLIT" ]; then
X       N_KBYTES=""; SPLIT_PARTS=""
X       NUM_PART=1
X       test -s $SPLITLOG && { set `cat $SPLITLOG`; N_KBYTES=$1; } || N_KBYTES=$DEF_SPLIT
X
X# %%FIX%%
X# The standard output and standard error of "split" will be redirected
X# to the file "$LOGFILE" to avoid annoying messages from cron when RNALIB
X# is NOT running in interactive mode.
X
X       test $DEBUG && echo "Now splitting the file, please wait a moment......"
X       $SPLIT -a -n$argument -f -L$N_KBYTES -o$SPLITDIR/sha $OUTFILE 2>>$LOGFILE
X       set `ls $SPLITDIR | wc -l`; SPLIT_PARTS=$1
X       Headers_Msg >$OUTFILE
X       Split_Msg >>$OUTFILE
X       cat $OUTFILE | $MAILER $UUCP_SENDER
X       cd $SPLITDIR
X       set ""
X       set `ls $SPLITDIR`
X   while [ "$1" != "" ]
X   do
X       echo "X-Mailer: $RNAVERS\nX-Sender: $ARPA_SENDER" >$OUTFILE
X       echo "Subject: Shar \"$argument\" part $NUM_PART of $SPLIT_PARTS\n" >>$OUTFILE
X       cat $1 >>$OUTFILE
X       cat $OUTFILE | $MAILER $UUCP_SENDER
X       test $DEBUG && echo "Sent file \"$argument\" part $NUM_PART of $SPLIT_PARTS"
X       NUM_PART=`expr $NUM_PART + 1`
X       rm $1; shift
X   done
X	rm -f $SPLITLOG 2>/dev/null; touch $SPLITLOG
X   else
X       cat $OUTFILE | $MAILER $UUCP_SENDER
X   fi    
Xelse
Xcat $OUTFILE | $MAILER $UUCP_SENDER
Xfi
Xrm -f $OUTFILE 2>/dev/null; touch $OUTFILE
X}
X
X
XCheck_PathSize()
X# $1 = path/user to check
X# returns: null if unknown path; otherwise current credit size.
X{
Xps_origin=$1
X# Warning: file 'pathsize' in this version of RNA needs a dummy line
X# like ' user 0 '  or 'user at host 0' for the *very *first user update.
X# In other words, if you are applying pathsizing, your 'pathsize'
X# has to contain a first line to work on. Pathsize cannot be empty!
X# Technically, what happens is that shell gets angry since it
X# cannot shift 'ps_credit'. This will be fixed in future versions.
X# RNA 2.2 UPDATE: FIXED, NO MORE SUCH PROBLEMS.
Xset ""
Xset -f `grep -v '#' $PATHSIZE`
Xwhile [ "$1" != "" ]; do
X	ps_path=$1; ps_credit=$2; shift; shift
X 	test -n "`echo $ps_origin | grep $ps_path`" && echo $ps_credit && break
Xdone
X}
X
X
XAdd_PathSize()
X# It's named 'Add', but really it subtracts sizes! 
X# $1 = path/user to update; $2 = umount to subtract
X{
Xps_origin=$1; ps_size=$2;
X# strip comments, as usual
Xset ""
Xset -f `grep -v '#' $PATHSIZE`
Xwhile [ "$1" != "" ]; do
X	test $DEBUG && echo "pspath=$1 = $2 (checking)"
X	ps_path=$1; ps_credit=$2; shift; shift
X#	Is this path matching the one we are checking?
X 	test -n "`echo $ps_origin | grep $ps_path`" && {
X#		Yep. Let's calculate the new credit, and...
X 		ps_size=`expr $ps_credit - $ps_size`
X 		test $DEBUG && echo "Add_PathSize: matched \"$ps_path\" nsize=$ps_size"
X#		..update the pathsize database. Ugly 'ed' script!
X		ed - $PATHSIZE >/dev/null <<OoPs
X			/$ps_path.*$ps_credit/
X			s/\(.*\) \(.*\)/\1 $ps_size/
X			w
X			q
XOoPs
X#		All done; get back!
X		return
X 	}
Xdone
X# This path does not exist inside our pathsize database. Uhm..
X# If CREDIT is defined, we add the new path to our database. We assume
X# that CREDIT is not '0': a previous check on this value would have
X# rejected any request and we wouldn't be here. So either 'credit' has
X# a value different from zero, or it is not defined at all. Trust me!
Xtest -n "$CREDIT" && {
X	ps_size=`expr $CREDIT - $ps_size`
X	test $DEBUG && echo "Add_PathSize: creating new entry \"$ps_origin $ps_size\""
X	echo "$ps_origin $ps_size" >>$PATHSIZE
X	}
X}
X
XBill() {
X
Xif [ "$credit" != "UNLIMITED" ]; then
X
X# bill destination of $1 lenght
X	( set `ls -log $1 | Cut_Ls`
X	Add_PathSize $UUCP_SENDER $1
X	)
Xfi
X}
X
XTopics() {
X#
Xif test -n "$HELPDIR" ; then
X	echo "\n\
X================================================================\n\
XHelp is also available on the following topics:\n\
X================================================================\n\
X`ls -x $HELPDIR`\n\
X================================================================"
Xfi
X}
X
X
X#
X# RNALIB MESSAGES - If you feel our english is bad, what about mailing us
X# suggestions, phrases, corrections? ;-)
X#
X
XHeaders_Msg()
X{
X# DON'T CHANGE the 'X-Mailer' line. Future versions of
X# RNA will talk to each other (sort-of networking!) and will need
X# to know exactly which version is standing on the other side.
Xspedresult=`Reference_Cmd`
Xecho "\
XX-Mailer: $RNAVERS\n\
XX-Sender: $ARPA_SENDER\n\
XSubject: RNA answer: $spedresult"
X
Xtest -s $RNADIR/notice && cat $RNADIR/notice 
X}
X
XNoHuman_Msg()
X{
Xecho "\n\
XThis message has been generated by a program. To talk to a human,\n\
Xsend mail to $POSTMASTER. Special requests of details on\n\
XRNALIB delivery may be submitted to this address only."
X}
X
XAskLstMan_Msg()
X{
X	echo "\n\
XThe person in charge of the mailing lists service here is\n\
X$LISTMASTER : if you need help try to contact him\n\
Xat the address above.\n"
X}
X
XExample_Msg()
X{
Xecho "\
XHere are some example requests, in case syntax is the problem:\n\
X\n\
X	@@ help {topic}\n\
X	@@ index\n\
X	@@ index {library}\n\
X	@@ list {library}\n\
X	@@ find {filename}\n\
X	@@ credits\n\
X	@@ split {Kbytes}\n\
X	@@ send {file} from {library}\n\
X	@@ send {file} from {library} with {compress-uuencode}\n\
X	@@ send {file} from {library} with {btoa} via {uucp}\n\
X	@@ send {file} from {library} with {uuencode} via {uusend}\n\
Xetc.etc."
X}
X
XNeedHelp_Msg()
X{
Xecho "\
XIf you need help on RNA commands syntax, a doc file is available\n\
Xhere. You might get it by mailing  $LOGNAME@$UNAME , with either\n\
Xmessage body or Subject containing:  @@ help."
X}
X
XNoHelpDir_Msg()
X{
Xecho "\n\
XSorry, 'sharp help' is not available here. There are currently\n\
Xno topics configured. Try a simple @@ help , without arguments."
X}
X
XNoHelpFor_Msg()
X{
Xecho "\n\
XNo help found for topic: \"$argument\" , sorry.\n\
XValid topics are:\n\
X`ls -x $HELPDIR`\n"
X}
X
X
X
XNoFile_Msg()
X# $1=LIBRARY  $2=FILE-NAME
X{
Xif [ "$1" != "DEFAULT" ]; then 
X	echo "\n\
XSorry, no such file was found. Recheck library contents.\n\
XTo do that, use the RNAlib command:   @@ list $1\n\
XFor a verbose description of files use:   @@ index $1" 
Xelse
X	echo "\
XSorry no such file was found inside RNALIB system directory.\n\
XPlease recheck library contents with :   @@ list\n\
XFor a list of available libraries and description of \n\
Xavailable system files try: @@ index " 
Xfi
Xecho "\n\
XYou may also scan the whole library system looking for a particular\n\
Xfile-name or part of it; use: @@ find {chars}. Example: @@ find doc\n\
Xwould list all available files whose names contain \"doc\". \n\
XIf you insist on this file-name, then try: @@ find $2  \n\
XIf all of this doesn't explain the problem, send a complaint\n\
Xto postmaster here: $POSTMASTER"
X}
X
XNoLibrary_Msg()
X{
Xecho "\
XSorry, this library does not exist! Recheck the general index.\n\
XTo do that, try the RNA command: @@ index \n\
XIf that doesn't explain the problem, send a complaint\n\
Xto: $POSTMASTER"
X}
X
XNoList_Msg()
X{
Xecho "\n\
XSorry, this mailing list does not exist! \n\
XCheck the list-index with rna-command: @@ lindex \n\
XIf that doesn't explain the problem, send a complaint\n\
Xto: $LISTMASTER"
X}
X
XCantAccess_Msg()
X{
Xecho "\
XSorry, i could not read \"$argument\" inside selected library : \n\
Xthere might be local problems with fileystem permissions here.\n\
XTry contacting the postmaster for some explanations."
X}
X
XYourMail_Msg()
X{
Xecho "\nYour mail, as received here, was...\n\
X--------------------------------------------"
Xcat -v $MBOX_CUT
Xecho "\n--------------------------------------------"
X}
X
XSyntax_Msg()
X{
Xecho "\
XSorry, the RNAlib program could not understand your request.\n"
XNeedHelp_Msg
Xecho; Example_Msg; echo; YourMail_Msg
X}
X
XBadChars_Msg()
X{
Xecho "\
XYour request included shell magic characters inside $1 command line(s).\n\
XSuch characters like \*, | , / , dots etc. are PROHIBITED for security\n\
Xreasons: the whole message has been discarded for this reason."
X}
X
XNoCommands_Msg()
X{
Xecho "\
XRNAlib could not find any command-lines inside your mail-request.\n"
XNeedHelp_Msg
Xecho; Example_Msg; echo; YourMail_Msg
X}
X
XNoTo_Msg()
X{
Xecho "\
XSorry, you are not authorized to use the \"TO\" field inside RNA requests.\n\
XSpecial permissions should be submitted to $POSTMASTER, along with\n\
Xsome good reasons for such capability."
X}
X
XBlackListed_Msg()
X{
Xecho "\
XSorry, you cannot forward RNALIB-requests here: your site is off-limits.\n\
XThere's also a chance that your site is placed on a blacklisted path,\n\
Xand though rejected;  it could also be that your address and/or name\n\
Xjust looks exactly as a blacklisted one."
X}
X
XDeliver_Msg()
X{
Xecho "\
XThis is the RNALIB output for a request destinated to you.\n\
XEnquiry was sent on $REQUEST_DATE  by <$ARPA_SENDER>."
X}
X
X
XReference_Cmd()
X{
Xtest -z "$action" && echo "problems." && exit
Xecho "\"$action\c"
Xtest "$argument" != "DEFAULT" && echo " $argument\c"
Xtest "$from" != "DEFAULT" && echo " [from] $from\c"
Xtest "$destination" != "DEFAULT" && echo " [to] $destination\c"
Xtest "$with" != "DEFAULT" && echo " [with] $with\c"
Xtest "$via" != "DEFAULT" && echo " [via] $via\c"
Xecho "\"\n"
X}	
X
XReference_Msg()
X{
Xecho "Command referenced: `Reference_Cmd`" 
X}
X
XConvert_Msg()
X{
Xecho "\
XThis file appears to be a $ftype:\n\
Xit has been transformed into an ASCII-format using \"$encode_type\".\n\
X"
X}
X
XNoNeed_Msg()
X{
Xecho "\
XField \"with\" ignored: file is already ASCII-text."
X}
X
XNoSuffix_Msg()
X{
Xecho "\
XWARNING: requested file \"$fname\"\n\
X         has NOT been compressed since it's longer than \"$MAXLENGTH\"\n\
X         characters permitted by \"$COMPRESS\". The problem has been\n\
X         notified to $POSTMASTER here. Sorry for the inconvenience.\n\
X"
X}
X
XNoConv_Msg()
X{
Xecho "\
XField \"with\" ignored: file hasn't been converted since\n\
Xit comes via \"$via\".\n\
X"
X}
X
XCompr_Msg()
X{
Xecho "\
XThis file has been converted with utility \"$compress_type\"\n\
XYou need to convert it back with something like \"$UNCOMPRESS\".\n\
X"
X}
X
XShip_Msg()
X{
Xecho "\
XFile requested for \"$ARPA_SENDER\" and destinated to \"$UUCP_HOST\"\n\
Xis coming inside your system public directory via \"$via\".\n\
XCheck it out! It should already be there.\n\
X"
X}
X
XNoCompr_Msg()
X{
Xecho "\
XWARNING: \"$compress_type\" is not available here!\n\
XYour file has been sent without any compression. Sorry.\n\
X"
X}
X
XNoSplit_Msg()
X{
Xecho "\
XWARNING: \"Utility shar\" is not available here!\n\
XYour file has been sent without any splitting. Sorry.\n\
X"
X}
X
XAlready_Msg()
X{
Xecho "\n\
XThis file hasn't been compressed since it ALREADY was compressed!\n\
XAny file whose name terminates with a \".Z\" or \".lzh\" or \".zoo\"\n\
Xis compressed: take care!\n\
XYou can get a list of file names inside a specific library\n\
Xwith RNA command \"list library\".\n\
X"
X}
X
XViaError_Msg()
X{
Xecho "\
XWarning! Field \"with\" ignored: <$with> is not a valid identifier.\n\
XThis file has been sent via normal \"e-mail\".\n\
X"
X}
X
XPending_Msg() {
Xecho "\
XX-Mailer: $RNAVERS\n\
XSubject: RNA is out of service on $UNAME\n\n\
XHello. RNALIB on $UNAME is temporarily out of service.\n\
XYour request of $REQUEST_DATE has been queued and will be processed\n\
Xas soon as the service is resumed.\n\n\
X`cat $RNADIR/hold`\n\n\
X`YourMail_Msg`\n\
X`Signature`"
X}
X
XWithError_Msg()
X{
Xecho "\
XWarning! Field \"with\" ignored: <$with> is not a valid identifier.\n\
XThis file has been transformed into an ASCII-format using \"uuencode\"."
X}
X
XNoBtoa_Msg()
X{
Xecho "\n\
XWARNING: \"btoa\" translation is not available here!\n\
XPlease re-submit your request without further \"with\" field;\n\
Xnon-ascii files will be treated with \"uuencode\"."
X}
X
XSignature()
X{
Xecho "\n\
X--\n\
X|RNALIB|SERVER|  | running at: \"$UNAME\"\n\
X|rnalib|server|  | postmaster: $POSTMASTER"
X}
X
XNoCredit_Msg() {
X	echo "\
XX-Mailer: $RNAVERS\n\
XSubject: your path is out of RNA credits\n\n\
XThe mail path you are coming from has exceeded its transmission's limits.\n\
XIn order to keep network trafic under control, we fix a credit size for\n\
Xcertain paths: currently your site results to be out of credits.\n\
XYou may ask $POSTMASTER for a credit reset; until then, all\n\
Xrnalib queries from your path are ignored.\n\
XYou may in the future ask rnalib which is the current credit size which\n\
Xapplies to your path, using: \"@@ credits\".\n"
XYourMail_Msg
XNoHuman_Msg
XSignature	
X}
X
XSubScribe_Msg() {
X	echo "\
XX-Mailer: $RNAVERS\n\
XSubject: Please subscribe for rnalib service\n\n\
XHello.\n\
XRNALIB service here on $UNAME requires a subscription to the \n\
Xauthorized user's list.\n\
XPlease mail $POSTMASTER asking for registration before any further query.\n\
X        Thank You\n"
XYourMail_Msg
XNoHuman_Msg
XSignature
X}
X
XNotUsingList_Msg() {
X	echo "\n\
XHey hey hey..\n\
XMAILING LISTS ARE NOT USED BY THE RNALIB SERVER HERE!\n\
X=====================================================\n\
XThus any rna command related to mailing lists is \n\
Xsimply ignored and has no effect.\n\
XPlease mail $POSTMASTER for details about rna server\n\
Xrunning on this site. \n\
X       Sorry!"
XYourMail_Msg
XNoHuman_Msg
X}
X
XAlreadyLst_Msg() {
X	echo "\n\
XYou seem to be already subscribed to this mailing list!\n\
XThe address matched inside \"$argument\" mailing-list seems to be:\n\
X ---> $1\n\n\
XIf this is wrong, please send mail to $LISTMASTER.\n\
X	Sorry!"
X}
X
XNotLst_Msg() {
Xecho "\nApparently, you are NOT a member of the \"$argument\" mailing list.\n\
XYour address \"$UUCP_SENDER\" was not found;"
Xtest "$ARPA_SENDER" = "$UUCP_SENDER" || echo "\
Xalso \"$ARPA_SENDER\" (arpa) was missing;"
Xecho "your request to un-subscribe from \"$argument\" seems useless!\n\
XIf this is wrong, please send mail to $LISTMASTER"
X}
X
XInLst_Msg() {
X	echo "\n\
XYour name has been added to the \"$argument\" mailing list\n\
Xwith email-address: \"$1\" .\n\
XIf this is wrong, please send mail to $LISTMASTER.\n\n\
XSincerely,"
X}
X
XOutLst_Msg() {
X	echo "\n\
XYour email-address \"$1\" has been removed\n\
Xfrom the \"$argument\" mailing list here.\n\
X(If this is wrong, please send mail to $LISTMASTER)\n\n\
XSincerely,"
X}
X
XReview_Msg() {
Xsearch=$1
X	echo "\n\
XMembers of the \"$argument\" mailing-list (email addresses):\n\
zXqzXqzXq
echo "End of RNALIB-22_b1 part 3"
echo "File RNA is continued in part 4"
echo "4" > shar3_seq_.tmp
exit 0
-- 
Paolo Ventafridda     -*-     INTERNET: venta at otello.sublink.org
TELEMATIX MILANO - Via C.Gomes 10, 20124 Milano -  +39-2-6706012



More information about the Alt.sources mailing list