Subject: Re: Notify after sorting.

From: [email-masked] (Jonathan Doughty)
Date: Tue, 23 Aug 1994 17:12:08 +0500

>>>>> "Rick" == Rick Busdiecker <[email-masked]> writes:

Rick>     Date: Tue, 23 Aug 1994 15:30:23 +0059 (EDT)
Rick>     From: Rick Troxel <[email-masked]>
    
Rick>     On Tue, 23 Aug 1994, Roman Czyborra wrote:
    
>> To reduce the startup time for rsh, start your .cshrc with
>> 
>> if (! $?prompt) exit
    
Rick>     No, don't do *that*!  Since dot files are sourced, this will kill your 
Rick>     shell.  Probably an if/endif construct is required.

Rick> Rick Troxel is incorrect in his claim.  Roman's advice is just fine
Rick> and does not cause the shell to exit.

... Quote from un-attributed csh man page deleted.

Not to start a shell war, but, quoting from the O'Reilly 'Unix Power
Tools' book (p. 49 for the pedantic):

  Note:  Some books tell you to use a test like this instead:
  		if (! $?prompt) exit
  
  		# commands for interactive shells only:

   But some C shells will log out when they see an exit command in a
   .cshrc file.  Using goto cshrc_end [with an appropriate cshrc_end:
   label] is more portable.

While I haven't experienced such a broken csh yet (perhaps Rick Troxel
has), I'll take UPT's word for it and use the dreaded goto in csh scripts
in the name of portability.

And, just to add some value to this discussion, I've recently discovered
xbuffy from ftp.x.org's contrib directory.  From the man page: 

    Xbuffy keeps track of multiple mailboxes.  You can
    either specify mailbox files on the command line, in a
    Xresources file, in a text configuration file, or set your 
    MAILPATH environment variable (a colon separated list of 
    files).  It will display the number of new messages in each 
    mail file in a box.
    
    Another key feature of xbuffy is that it will use NNTP
    to watch newsgroups in the same way it watches mailboxes.
    You can also specify newsgroups on the command line, in 
    Xresources, in a text configuration file (the same file 
    can specify both mailboxes and newsboxes), or set your 
    NEWSPATH environment variable using the same format as 
    the MAILPATH environment variable.
    
    By specifying certain command line options and/or
    Xresources, xbuffy can show the From and Subject lines in 
    each box.  It can also invoke shell commands on button 
    clicks.  Each box can be configured differently by using 
    a boxfile.  In general, it is a very extensible biff.  
    Read on for details on what it can do.

While I haven't used its NNTP services, I find it complements rather well
procmail and emacs/vm, especially when I make a small change in it's
button actions to de-highlight mail folder summaries that I've looked at
until they change again.

-----------------------------------------------------------------------
Jonathan Doughty          The MITRE Corporation          [email-masked]

---

From: Rick Troxel <[email-masked]>
Date: Tue, 23 Aug 1994 15:30:23 +0059 (EDT)

> To reduce the startup time for rsh, start your .cshrc with

No, don't do *that*!  Since dot files are sourced, this will kill your 
shell.  Probably an if/endif construct is required.
-- 
Rick Troxel     [email-masked]     [email-masked]     301/496-4823
///////////////////////////////////////////////////////////////////////////
     All effort and exertion put forth by man from the fullness of his
     heart is worship, if it  is prompted  by the  highest motives and
     the will to do service to humanity.                 --Abdu'l-Baha

---

From: Rick Troxel <[email-masked]>
Date: Tue, 23 Aug 1994 16:56:20 +0059 (EDT)

On Tue, 23 Aug 1994, Rick Busdiecker wrote:

>     Date: Tue, 23 Aug 1994 15:30:23 +0059 (EDT)
>     From: Rick Troxel <[email-masked]>
    
> Rick Troxel is incorrect in his claim.  Roman's advice is just fine
> and does not cause the shell to exit.

[snip]

> NAME
>      csh - a shell (command interpreter) with a C-like syntax and
>      advanced interactive features

[snip]

Thank you for the correction.  In case I have managed to bewilder
other readers, it is ksh, not the csh of which I spoke, in which a
dofile 'exit' can throw one off the system.

---

From: Jody Klymak <[email-masked]>
Date: Tue, 23 Aug 1994 09:55:50 -0700 (PDT)

On Tue, 23 Aug 1994, Yuji Shinozaki wrote:

> Do a tail on your logfile, which you specify with LOGFILE in your .procmailrc.
> (see man procmailrc).
> 

Well, I have already written a non-interactive shell-script.  I was just
wondering if there was a way from *inside* procmail to do this (i.e
so that I don't have to keep interogating the log file manually)

The following is my script which I run in the background:
------------------------------------
#!/bin/sh
while true 
do
if test -s $HOME/mail/pm_logfile 
then
### save the logfile:
        cat $HOME/mail/pm_logfile >> $HOME/mail/pm_log
        echo ""
        echo "New Mail:"
###  print up the folder names:
        egrep Folder $HOME/mail/pm_logfile 
### remove the logfile:
        \rm -f $HOME/mail/pm_logfile
        touch $HOME/mail/pm_logfile
### ring a bell:
        echo "^G"
fi
### rest for two minutes:
sleep 120
done

--------------------------------------

Jody

---

From: [email-masked] (Stephen R. van den Berg)
Date: Tue, 23 Aug 1994 19:07:25 +0200

>so that I don't have to keep interogating the log file manually)

What I use:

	:0 hc
	|$HOME/etc/tellmail

--------$HOME/etc/tellmail---------
#!/bin/sh
umask 077
if test -f $HOME/etc/whereami
then
  TMPF=/tmp/tellmail.$$
  trap "/bin/rm -f $TMP; exit 1" 1 2 3 15
  (
  echo "#########		Mail `date`"
  egrep -e '^(From[: ]|Subject:)' 
  ) >$TMPF
  . $HOME/etc/whereami
  if test $? != 0
  then
     rm $HOME/etc/whereami
  fi
  rm -f $TMPF
  trap "" 1 2 3 15
fi
exit 0
-----------end of tellmail---------

In your .profile:

	echo "rcp \$TMPF `hostname`:`tty` 2>/dev/null" >$HOME/etc/whereami

When you log out:

	rm $HOME/etc/whereami

Actually, these last two entries are a tid bit more involved for me because
I have to ensure that multiple logins work as expected.

-- 
Sincerely,                                  [email-masked]
           Stephen R. van den Berg (AKA BuGless).

The eleventh commandment: Thou shalt not re-curse!

---

From: "Joshua A. Laff" <[email-masked]>
Date: Tue, 23 Aug 1994 12:50:21 -0500 (CDT)

In our previous episode, Jody Klymak said:
:) Well, I have already written a non-interactive shell-script.  I was just
:) wondering if there was a way from *inside* procmail to do this (i.e
:) so that I don't have to keep interogating the log file manually)

What I have set up relies on my using tcsh as my shell, which allows me to
perform commands just before each display of a prompt (the 'precmd' alias).
I have procmail write a one-line flag to a file each time mail is delivered,
and the command I run, tml, checks this file for flags, and tells me if I've
gotten mail, what folder it's in (depending on the flag), and how much. The
flag writting is easy, for example:

:0c:
$MAILBOX
   :ai
   |echo "normal" >> $STATS

The program tml follows (anyone who uses this will probably need to change the
leading #! line pointing to the perl parser, and may want to change the program
to fit their personal needs)

----------------bin/tml--------------
#!/local/all/perl
# Usage: tml [-v] [-s]
while ($ARGV[0] =~ /^-/) {
	push (@options, shift);
}
if (@options) {
	while ($options[1]) {
		$options[1] .= $options[0];
		shift @options
	}
}
chdir ();
open (STATS,"Mail/.stats");
if (!<STATS>) {
	if ($options[0] =~ /v/) {
		print "No new mail.\n";
	}
	exit;
}
close STATS;
open (STATS,"Mail/.stats");
print "" if !($options[0] =~ /s/);
while (<STATS>) {
	if (/normal/) {
		++$normal;
	}
	elsif (/priority/) {
		++$priority;
	}
	elsif (/war/) {
		++$war;
	}
	elsif (/coded/) {
		++$coded;
	}
	elsif (/error/) {
		++$error;
	}
	elsif (/die/) {
		++$die;
	}
	elsif (/humor/) {
		++$humor;
	}
	elsif (/off-campus/) {
		++$fcampus;
	}
	elsif (/problem/) {
		++$problem;
	}
	elsif (/restore/) {
		++$restore;
	}
}
print "Normal mail: $normal\n" if ($normal);
print "  Urgent: $priority\n" if ($priority);
print "  Coded: $coded\n" if ($coded);
print "Non-work mail: $fcampus\n" if ($fcampus);
print "Mail with problem in delivery: $problem\n" if ($problem);
print "Mail war: $war\n" if ($war);
print "Bounced Mail: $error\n" if ($error);
print "Over quota: $die\n" if ($die);
print "Humor additions: $humor\n" if ($humor);
print "Restore program stuff: $restore\n" if ($restore);
open (STATS,"> Mail/.stats");
------------------end------------------

      Joshua A. Laff    (217)      //  Disclaimer: If I was important enough
    CRL Head Operator     333-    //  that the UofI would let me speak for it,
  University of Illinois   7408  //  the *last* thing I'd be doing would be
email to: [email-masked]      //  sitting in front of a computer all day.
===============================================================================
Theorem: Barney, the cute purple dinosaur, is Satan.
Given: Barney is a cute purple dinosaur.
Extract the Roman numerals (and remember that the Romans had no letter 'U',
   they used 'V' instead):
			CVTE PVRPLE DINOSAVR
			CV    V  L  DI    V
Add them: 100 + 5 + 5 + 50 + 500 + 1 + 5 = 666

---

From: Roman Czyborra <[email-masked]>
Date: Tue, 23 Aug 1994 20:52:38 +0200

> 	|$HOME/etc/tellmail

This triggers a shell process for every message even when you're
offline.  Instead, you could abuse your .xinitrc:

	echo "TRAP='
	rsh $HOST echo New mail in \$LASTFOLDER > /dev/console'" >biffrc

	... (your xsession)

	echo "COMSAT=no" >biffrc

and in your .procmailrc

	SHELLMETAS=|
	INCLUDERC=biffrc

	if (! $?prompt) exit

---

From: Roman Czyborra <[email-masked]>
Date: Tue, 23 Aug 1994 21:49:35 +0200

> Since dot files are sourced, this will kill your shell.

An exit in a sourced file will only exit the source, not the shell.

---

From: Rick Busdiecker <[email-masked]>
Date: Tue, 23 Aug 1994 16:04:46 -0400

Rick

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

NAME

SYNOPSIS
     csh [ -bcefinstvVxX ] [ argument...  ]

DESCRIPTION
     csh, the C shell, is a command  interpreter  with  a  syntax
     reminiscent  of  C.   It  provides  a  number  of convenient

    . . .

  Environment Variables and Predefined Shell Variables
     Unlike the standard shell, the C shell maintains a  distinc-
     tion  between environment variables, which are automatically

    . . .

     prompt            The string an interactive C shell  prompts
                       with.   Noninteractive  shells  leave  the
                       prompt variable unset.  Aliases and  other
                       commands  in the .cshrc file that are only
                       useful interactively, can be placed  after
                       the  following  test:  `if ($?prompt == 0)
                       exit', to reduce startup time  for  nonin-
                       teractive  shells.

---

From: Michelle Dick <[email-masked]>
Date: Tue, 23 Aug 94 22:50:32 -0700

There is a command included with the MH mail package that will do
this:

rcvtty

It is written up in the mhook man page (man mhook).  I'm pretty sure
you don't need to use MH to use the program (though the command may
not be in your standard path if you don't use MH).  Like all the MH
utilities it is highly configurable.  I use both the default format
and my own formating (through the "rcvtty -form" option).  It supports
option to use a bell and to obey the mesg or biff setting.  Just pipe
the message to the program and it does all the rest.

--
Michelle Dick       [email-masked]       East Palo Alto, CA
Reading: Gender Outlaw/K. Bornstein; Woman Warrier/ M.H. Kingston
Constant Reader/D. Parker; Assembling California/J. McPhee;
On the Edge/C. H. Nightingale; Myth of Male Power/W. Farrell