From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 14-NOV-1990 08:28:33.24
To:	MRGATE::"ARISIA::EVERHART"
CC:	
Subj:	PLM$MAIL, part 10 of 10

Received:  by crdgw1.ge.com (5.57/GE 1.76)
	 id AA03474; Wed, 14 Nov 90 07:57:20 EST
Received: From ICNUCEVM.CNUCE.CNR.IT by CRVAX.SRI.COM with TCP; Wed, 14 NOV 90 01:37:26 PST
Received: from ITOPOLI.BITNET by ICNUCEVM.CNUCE.CNR.IT (IBM VM SMTP R1.2.2MX) with BSMTP id 0279; Wed, 14 Nov 90 10:33:39 MET
Date: Wed, 14 Nov 90 10:32 GMT+1
From: "P.L. Montessoro * CENS-CNR * +39-11-556.7013" <PIERLUCA%ITOPOLI.BITNET@ICNUCEVM.CNUCE.CNR.IT>
Subject: PLM$MAIL, part 10 of 10
To: info-vax@kl.sri.com
Message-Id: <04DB8A38091F20028A@ITOPOLI.BITNET>
X-Envelope-To: info-vax@kl.sri.com
X-Vms-To: INFOVAX

-+-+-+-+-+-+-+-+ START OF PART 10 -+-+-+-+-+-+-+-+
X                  printf ("\n\n");
X               `125
X               if ((status = mail$send_end`032
X                                (&send_context,`032
X                                 &mail_null_list,`032
X                                 &mail_null_list)) != SS$_NORMAL)
X               `123
X#if FALSE
X                  lib$signal (status);
X#endif
X                  printf ("\n\n");
X               `125
X               goto READ_COMM;
X            `125
X            fclose (fp);
X
X            message_send_filename_itmlst`0910`093.buffer_address = filename_
Vbuffer;
X            message_send_filename_itmlst`0910`093.buffer_length =`032
X                                                    strlen (filename_buffer)
V;
X
X            if ((status = mail$send_add_bodypart`032
X                             (&send_context,`032
X                              &message_send_filename_itmlst,`032
X                              &mail_null_list)) != SS$_NORMAL)
X            `123
X#if FALSE
X               lib$signal (status);
X#endif
X               printf ("\n\n");
X            `125
X         `125
X
X         if ((status = mail$send_message`032
X                          (&send_context,`032
X                           &mail_null_list,`032
X                           &mail_null_list)) != SS$_NORMAL)
X         `123
X#if FALSE
X            lib$signal (status);
X#endif
X            printf ("\n\n");
X            if ((status = mail$send_abort`032
X                             (&send_context,`032
X                              &mail_null_list,`032
X                              &mail_null_list)) != SS$_NORMAL)
X            `123
X#if FALSE
X               lib$signal (status);
X#endif
X               printf ("\n\n");
X            `125
X         `125
X
X         if ((status = mail$send_end`032
X                          (&send_context,`032
X                           &mail_null_list,`032
X                           &mail_null_list)) != SS$_NORMAL)
X         `123
X#if FALSE
X            lib$signal (status);
X#endif
X            printf ("\n\n");
X         `125
X
X         if (edit_flag)
X         `123
X            /* delete the file */
X            strcat (filename_buffer, ";0");   /* last version */
X            while (!delete (filename_buffer));  /* all the versions */
X         `125
X
X         goto READ_COMM;
X         break;
X
X      case 'h':
X      case 'H':
X         printf ("\n\n");
X         printf ("   h                           help\n");
X         printf ("   a                           to show automatic message s
Velection\n");
X         printf ("   g <groupname>               to select a group\n");
X         printf ("   l <groupname>               to list the messages in a g
Vroup\n");
X         printf ("   m <message id>              to select a message\n");
X         printf ("   t <message id>              to type a message\n");
X         printf ("   <message id>                to type a message\n");
X         printf ("   e <message id>/'*' <group>  to extract one/all (not del
Veted) message(s)\n");
X         printf ("   n                           to type next message\n");
X         printf ("   p                           to type previous message\n"
V);
X         printf ("   d <message id>/'*'/'r'/'e'  to delete one/all/read/extr
Vacted message(s)\n");
X         printf ("   u <message id>/'*'/'r'/'e'  to undelete one/all/read/ex
Vtracted message(s)\n");
X         printf ("   s <filename>                to send a message\n");
X         printf ("   f                           to forward the current mess
Vage\n");
X         printf ("   r                           to reply to the current mes
Vsage\n");
X         printf ("   x/EOF                       to exit\n");
X         printf ("\n");
X         goto READ_COMM;
X         break;
X
X      case 'x':
X      case 'X':
X         mail_end ();
X         exit (SS$_NORMAL);
X         break;
X
X      default:
X         printf ("PLM$MAIL-E-INVCOMM, Invalid command\n");
X         goto READ_COMM;
X
X   `125
X
X
X   return;
X`125
X
X
X`012
X/***************************************************************************
V***/
X
X
Xmain (int argc, char *argv`091`093)
X
X`123
X   char        directory_name `091512`093;
X   char        file_name `091512`093;
X   FILE        *file_ptr;
X   FOLDER_DSC  *f_dsc_tmp;
X   AUTOSELECT  *tmp_autosel;
X   MSG_DSC     *msg_dsc_ptr;
X   int         i;
X
X   if (argc > 2)
X   `123
X      printf ("PLM$MAIL-F-TOOMANYPAR, Too many parameters\n");
X      exit (SS$_NORMAL);
X   `125
X
X   read_site();
X
X   if (argc == 2)
X   `123
X      /* override the folder name */
X      strcpy (folder_name, argv`0911`093);
X   `125
X
X   mail_begin();
X   get_folders();
X
X   printf ("\n            PLM Mail Interface - October 18th, 1990\n\n");
X
X   /* give information about current mailfile */
X   f_dsc_tmp = folder_list;
X
X#if FALSE
X   printf ("Mailfile %s contains following folders:\n", mail_file_name);
X   while (f_dsc_tmp != NULL)
X   `123                `032
X      if (f_dsc_tmp->message_number == 1)
X         printf ("   %s, %ld message\n",`032
X                 f_dsc_tmp->folder_name,`032
X                 f_dsc_tmp->message_number);
X      else
X         printf ("   %s, %ld messages\n",`032
X                 f_dsc_tmp->folder_name,`032
X                 f_dsc_tmp->message_number);
X      f_dsc_tmp = f_dsc_tmp->next;
X   `125
X   printf ("\n");
X#endif
X
X   /* look for the folder to be used */
X
X   f_dsc_tmp = folder_list;
X   while ((f_dsc_tmp != NULL) && strcmp (f_dsc_tmp->folder_name, folder_name
V))
X   `123
X      /* next folder */
X      f_dsc_tmp = f_dsc_tmp->next;
X   `125
X
X   if (f_dsc_tmp == NULL)
X   `123
X      printf ("PLM$MAIL-W-FOLDNOTFND, Folder %s not found\n", folder_name);
X   `125
X   else
X   `123
X      /* select messages in the folder */
X  `032
X      printf ("Automatic message selection in progress...\n");
X      select_messages (folder_name);
X
X      /* show automatic selection results */
X  `032
X      printf ("\nSelected messages in folder %s:\n", folder_name);
X      i = 0;
X      tmp_autosel = autoselect_list;
X      while (tmp_autosel != NULL)
X      `123
X         if (tmp_autosel->selected_number)
X         `123
X            i += tmp_autosel->selected_number;
X            printf ("   %3ld in group %s\n",`032
X                    tmp_autosel->selected_number, tmp_autosel->group_name);
X         `125
X         tmp_autosel = tmp_autosel->next;
X      `125
X      printf ("Total number: %ld\n", i);
X   `125
X
X   printf ("\n");
X
X   commands ();
X`125
X
$ CALL UNPACK PLM$MAIL.C;1 2087725963
$ create/nolog 'f'
XMAIL
XNEWMAIL
Xdisk$cad:`091pierluca.mailroot.mail`093
Xdisk$cad:`091pierluca.mailroot.bigmail`093
Xf "SYSTEM" disk$cad:`091pierluca.mailroot.mail`093 system
Xf "SILVANO" disk$cad:`091pierluca.mailroot.book`093 Silvano
Xf "fabio" disk$cad:`091pierluca.mailroot.book`093 Fabio
Xf "tara" disk$cad:`091pierluca.mailroot.creator`093 Tara
Xf "ulrich" disk$cad:`091pierluca.mailroot.creator`093 Ernst
Xs "Creator" disk$cad:`091pierluca.mailroot.creator`093 Creator
Xm "Sender: Info Vax <INFO-VAX@HEARN.BITNET>" disk$cad:`091pierluca.mailroot.
Vinfo-vax`093 info-vax
$ CALL UNPACK PLM$MAIL.CFG;1 1331328818
$ create/nolog 'f'
X
X
XPLM$MAIL.DOC - November 13rd, 1990
X
X
XPLM$MAIL  is  a  C  program  that  can  use the now documented mail callable
Xinterface. It runs on VMS 5.2 and higher, maybe even on 5.0, but I could not
Xtry. The main features are:`032
X
X1)  it  automatically  groups messages following rules written in the user's
Xconfiguration file (for example, messages coming from mailing lists  can  be
Xseparated from the others);
X
X2)  it  provides  default directory and file  names (respectively taken from
Xthe configuration file and generated from  the subject  field)  for  message
Xextraction. This is very useful when old  messages must be moved to a backup
Xdevice to free disk space.
X
XNo  command  is provided to move files between folder, with the exception of
XNEWMAIL -> MAIL, automatically done when  new  messages  are  read  and  not
Xexplicitly  deleted.  This  because  I  prefer  to use directories and files
Xinstead of folders and messages. Anyhow, this feature can be easily added.`0
V32
X
X
X
XInstallation:`032
X
X   $ cc plm$mail
X   $ link/notrace plm$mail,libc/opt   (if shared library)
X   $ plm$mail :== $mydisk:`091exedir`093plm$mail
X
X   (see below for installation with privileges)  `032
X
XUsage:
X
X   $ plm$mail   (to use the default folder - see below)
X   $ plm$mail <folder>  (to use the specified folder)
X
X   NOTE: folder names are case-sensitive. Therefore:
X
X   $ plm$mail "MAIL"   (to use folder MAIL)
X
X
XCommands:
X
X   h                 : very brief help
X
X   a                 : to show the results of the automatic message selectio
Vn
X   g <groupname>     : to select a group as current`032
X   l                 : to list the messages in the current group
X   l <groupname>     : to list the messages in a group
X
X   m                 : to select a message as current
X   t                 : to type the current message
X   t <message id>    : to type a message
X   <message id>      : to type a message
X   n                 : to type the next message in current group. If at the`
V032
X                       end of a group, the next non-empty group is selected
X   p                 : to type previous message in current group. If at the`
V032
X                       end of a group, the previous non-empty group is selec
Vted
X   e                   to extract the current message
X   e <message id>    : to extract the specified message
X   e *               : to extract all the (not deleted) messages in`032
X                       current group
X   e <message id>/* <group>`032
X                     : to extract one/all message(s) using the default`032
X                       extraction directory of the specified group
X   d <message id>/*/r/e
X                     : to delete one/all/read/extracted message(s)
X   u <message id>/*/r/e
X                     : to undelete one/all/read/extracted message(s)
X
X   s                 : to send a message (TPU default editor is activated)
X   s <filename>      : to send a file
X   f `091address`093       : to forward the current message`032
X   r                 : to reply to the current message (TPU default editor`0
V32
X                       is activated)
X
X   x/Control Z       : to exit
X
X   Current message pointer may be modified by commands 'm', 't', 'n', 'p',`0
V32
X   'e', 'r', 'f', current group by 'g', 'l', 'n', 'p'.
X
X
XConfiguration file: SYS$LOGIN:PLM$MAIL.CFG
X
XMAIL    <-  default mailfile
XNEWMAIL   <-  default folder
Xmydisk:`091maildir`093   <-  default directory for extraction
Xmydisk:`091bigmaildir`093   <-  default directory for bigmail messages extra
Vction (1)
Xf/s/m  "<key substring>" <default extraction directory> <group name> (2)
X...
Xf/s/m  "<key substring>" <default extraction directory> <group name> (3)
X
X
XNotes:
X
X(1)  bigmail is a set of procedures we use instead of vms_share. It is based
Xon MFTU to  compress  and  encode  the  files,  and  on  some  TPU  and  DCL
Xprocedures.  The  advantage  over vms_share is that it handles binary files,
Xbut it requires to  be  installed  on  the  receiver's  machine.  Anyhow,  a
Xbootstrap  vms_share  package  is  provided.  Even  though  you  do  not use
XBIGMAIL, the program will look for this record in  the  configuration  file.
XPut there a dummy name.
X
X(2)   "f" means 'search for <key substring> in "From:" field'
X      "s" means 'search for <key substring> in "Subject:" field'
X      "m" means 'search for <key substring> in the text of the message field
V'
X
XFor example, to select messages from info-vax, I use:
X
Xm "Sender: Info Vax <INFO-VAX@HEARN.BITNET>" mydisk:`091info-vax-dir`093 inf
Vo-vax
X
XRules  are  applied in the same order as they are found in the configuration
Xfile. Of course, searching for a string in the text of the message is slower
Xthan  doing  that only in the from/subject fields. To speed-up the automatic
Xselection, limit the number of 'm' rules, and put them after the 'f' and 's'
Xones.
X
X(3)  For  now,  only  one  rule  is allowed for each group. Do not duplicate
Xgroup names, program does not check if not unique.`032
X
X
XThe  program  works  fine  for  me, but it is just the result of few days of
Xplaying with the mail callable interface. For example, no check is performed
Xabout  the  correctness and consistence of the configuration file. Moreover,
Ximprovements are possible both in features and in speed, the problem is that
Xnot  all  the  callable  mail functions work exactly as described in the DEC
Xmanual. The program also  lacks  in  documentation,  sorry.  Maybe,  in  the
Xfuture...
X
XFinally,  for some alternate mail protocols, like IN, problems on privileges
Xmay arise. The mail shared library is installed with  privileges,  but  some
Xprograms  of PMDF seem to inherit privileges directly from the main program.
XOn our system PMDF programs are installed with privileges,  although  it  is
Xpossible  that  the  something  else is not correct. Anyhow, PLM$MAIL is now
Xinstalled with SYSPRV, and everything works fine.
X
XComments,  suggestions  and  improvements  are  appreciated.  Please mail to
Xpierluca@itopoli.bitnet.
X
X                                                   Pier Luca Montessoro
X
X
X  *************************************************************************
X
X   CENS-CNR (Italian National Research Council)      Tel.   +39-11-556.7013
X   Politecnico di Torino                             Fax.   +39-11-556.7099
X   10129 Torino - ITALY                              Telex. 220646 POLITO I
X
X   Bitnet: pierluca@itopoli.bitnet            Span/Physnet: 39494::PIERLUCA
X
X  *************************************************************************
X
$ CALL UNPACK PLM$MAIL.DOC;1 525547668
$ v=f$verify(v)
$ EXIT

