#!	/bin/csh -f
#
# Copyright 1993, 1994, 1995 by the Regents of the University of California.
# see the file "Copyright" in the distribution for conditions of use.
#
#
#	user friendly quota info
#
set awkf = `mktemp -c`
#
#
#	
#	show home, mail, /tmp file systems, but don't show others
#	if negligible usage - would only confuse user or
#	encourage saving where we don't want it.
#	
cat << "EOT" >! $awkf
{
	if( NF > 6 && $1 != "Disc" && $1 != "Filsys" ) {
		print " ";
		sys = $1;
		cur = $2;
		ind = index( cur, "*" );
		if( ind != 0 ) {
			quota_status = "*** over quota ***";
			cur = substr( cur, 1, ind - 1 );
		} else {
			quota_status = "under quota";
		}

		if( index( sys, "uclink" ) != 0 ) {
		    whatfor = "home directory and mail folders except inbox";
		} else if( sys == "/tmp" ) {
			whatfor = "temporary files"
		} else if( index( sys, "mail" ) != 0 ) {
			whatfor = "mail inbox";
		} else if( usage < 200 ) {
			continue;
		} else {
			whatfor = "unknown";
		}

		soft = $3;
		hard = $4;
		
		print "File system:     ", sys;
		print "Purpose:         ", whatfor;
		print "Usage:           ", cur, "kilobytes.";
		print "Quota:           ", soft
		print "Absolute limit:  ", hard
		print "Quota status:    ", quota_status;
	}
}
END {
print "\nIf you exceed a quota, it becomes an absolute limit in your third"
print "subsequent login session."
print "\nFor more information on quotas and disk management, look in the"
print "UCLink Gopher (accessible by \"g\" from the menu system) in the"
print "\"Using UCLink\" menu."
}
"EOT"
#
(echo " "; \
	echo "Disk quota information for account ${USER}:"; \
	quota | awk -f $awkf ) | $PAGER
/bin/rm $awkf
#

