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

Received:  by crdgw1.ge.com (5.57/GE 1.76)
	 id AA03455; Wed, 14 Nov 90 07:57:03 EST
Received: From ICNUCEVM.CNUCE.CNR.IT by CRVAX.SRI.COM with TCP; Wed, 14 NOV 90 01:37:03 PST
Received: from ITOPOLI.BITNET by ICNUCEVM.CNUCE.CNR.IT (IBM VM SMTP R1.2.2MX) with BSMTP id 0278; Wed, 14 Nov 90 10:33:31 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 9 of 10
To: info-vax@kl.sri.com
Message-Id: <04DB932BE7DF20028A@ITOPOLI.BITNET>
X-Envelope-To: info-vax@kl.sri.com
X-Vms-To: INFOVAX

-+-+-+-+-+-+-+-+ START OF PART 9 -+-+-+-+-+-+-+-+
X            strcat (filename_buffer, ";0");   /* last version */
X            while (!delete (filename_buffer));  /* all the versions */
X
X            goto READ_COMM;
X         `125                  `032
X
X         message_send_filename_itmlst`0910`093.buffer_address = filename_buf
Vfer;
X         message_send_filename_itmlst`0910`093.buffer_length =`032
X                                                 strlen (filename_buffer);
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
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         /* delete the file */
X         strcat (filename_buffer, ";0");   /* last version */
X         while (!delete (filename_buffer));  /* all the versions */
X
X         goto READ_COMM;
X         break;
X
X      case 'f':
X      case 'F':
X         /* forward a message */
X         if ((curr_message == BEG_OF_MSG_LIST) `124`124`032
X             (curr_message == END_OF_MSG_LIST))
X         `123
X            printf ("PLM$MAIL-E-NOCURRMSG, No message selected as current\n"
V);
X            goto READ_COMM;
X         `125
X
X         if (comm_buffer `091par_offset`093 == '\0')
X         `123
X            printf ("To: ");
X            if (gets (int_buffer) == NULL)
X            `123
X               /* control Z */
X               goto READ_COMM;
X            `125      `032
X         `125
X         else
X         `123
X            strcpy (int_buffer, comm_buffer + par_offset);
X         `125
X
X         trim (int_buffer);
X         if (int_buffer `0910`093 == '\0')
X         `123
X            /* no destination */
X            goto READ_COMM;
X         `125
X         if (int_buffer `0910`093 == '@')
X         `123
X            /* filename */
X            sscanf (int_buffer + 1, "%s", dis_filename);
X            strcat (dis_filename, DIS_FILE_EXTENSION);
X            if ((dis_fp = fopen (dis_filename, "r")) == NULL)
X            `123
X               printf ("PLM$MAIL-F-OPENERR, Cannot open file %s\n",`032
X                       dis_filename);
X               goto READ_COMM;
X            `125
X         `125
X         else
X         `123
X            dis_filename `0910`093 = '\0';
X         `125
X
X         send_context = 0;
X         if ((status = mail$send_begin`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         printf ("\n");
X
X         /* get all the destination addresses */
X         init_get_next_dst ();
X         while (get_next_dst (to_buffer, int_buffer, dis_fp, dis_filename))
X         `123
X            /* try to translate the name */
X            proc_trnlnm (to_buffer);
X            if (return_string `0910`093 != '\0')
X               strcpy (to_buffer, return_string);
X
X            if (to_buffer `0910`093 == '\0')
X            `123
X               printf ("PLM$MAIL-E-INVDEST, Invalid destination\n");
X               /* abort */
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  `032
X                  lib$signal (status);
X#endif     `032
X                  printf ("\n\n");
X               `125
X               if (dis_filename `0910`093 != '\0')
X                  fclose (dis_fp);
X               goto READ_COMM;
X            `125
X           `032
X            message_send_address_itmlst`0910`093.buffer_address = to_buffer;
X            message_send_address_itmlst`0910`093.buffer_length = strlen (to_
Vbuffer);
X            if ((status = mail$send_add_address`032
X                             (&send_context,`032
X                              &message_send_address_itmlst,`032
X                              &mail_null_list)) != SS$_NORMAL)
X            `123
X#if FALSE  `032
X               lib$signal (status);
X#endif     `032
X               printf ("\n\n");
X               /* abort */
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  `032
X                  lib$signal (status);
X#endif     `032
X                  printf ("\n\n");
X               `125
X               if (dis_filename `0910`093 != '\0')
X                  fclose (dis_fp);
X               goto READ_COMM;
X            `125
X         `125  /* end of destinations */
X
X         /* subject */
X         sprintf (subj_buffer, "Fwd: %s", curr_message->subject);
X         printf ("Subject `091 %s `093: ", subj_buffer);
X         if (gets (int_buffer) == NULL)
X         `123
X            /* control Z */
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         trim (int_buffer);
X         if (int_buffer `0910`093 != '\0')
X            strcpy (subj_buffer, int_buffer);
X
X         message_send_attribute_itmlst`0910`093.buffer_address = subj_buffer
V;
X         message_send_attribute_itmlst`0910`093.buffer_length = strlen (subj
V_buffer);
X         if ((status = mail$send_add_attribute
X                          (&send_context,`032
X                           &message_send_attribute_itmlst,`032
X                           &mail_null_list)) != SS$_NORMAL)
X         `123
X#if FALSE
X            lib$signal (status);
X#endif  `032
X            printf ("\n\n");
X         `125
X
X         /* still to be edited? */
X         do
X         `123
X            printf ("Do you want to edit the message? ");
X            if (gets (int_buffer) == NULL)
X            `123
X               /* control Z */
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               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            trim (int_buffer);
X         `125  while ((int_buffer `0910`093 != 'y') && (int_buffer `0910`093
V != 'Y') &&`032
X                   (int_buffer `0910`093 != 'n') && (int_buffer `0910`093 !=
V 'N'));
X        `032
X         if ((int_buffer `0910`093 == 'y') `124`124 (int_buffer `0910`093 ==
V 'Y'))
X         `123
X            /* generate a filename for the message */
X            build_sendmsg_filename (filename_buffer);
X  `032
X            /* open the file */
X            if ((fp = fopen (filename_buffer, "w")) == NULL)
X            `123
X               printf ("PLM$MAIL-F-OPENERR, Cannot create file %s\n",`032
X                       filename_buffer);
X               /* abort */
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            edit_flag = TRUE;
X         `125
X         else
X         `123
X            edit_flag = FALSE;
X         `125
X
X         /* select the message */
X         msg_id = curr_message->id;
X         status = mail$message_get`032
X                     (&message_context,`032
X                      message_sel_msg_in_itmlst,
X                      mail_null_list);
X         if (status != MAIL$_MSGINFO)
X         `123
X#if FALSE
X            lib$signal (status);
X#endif
X            printf ("\n\n");
X         `125          `032
X         do
X         `123
X            /* get a record of the message */
X            status = mail$message_get`032
X                        (&message_context,`032
X                         message_get_record_in_itmlst,`032
X                         message_get_record_out_itmlst);
X            if ((status != MAIL$_MSGTEXT) &&`032
X                (status != MAIL$_NOMOREREC))
X            `123
X#if FALSE
X               lib$signal (status);
X#endif
X               printf ("\n\n");
X               break;
X            `125
X            msg_buffer `091msg_length`093 = '\0';
X            if (status != MAIL$_NOMOREREC)
X            `123
X               if (edit_flag)
X               `123
X                  fprintf (fp, "> %s\n", msg_buffer);
X               `125
X               else
X               `123
X                  message_send_bodypart_itmlst`0910`093.buffer_address = msg
V_buffer;
X                  message_send_bodypart_itmlst`0910`093.buffer_length = msg_
Vlength;
X                  if ((status = mail$send_add_bodypart`032
X                                   (&send_context,`032
X                                    &message_send_bodypart_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       `032
X               `125
X            `125
X         `125  while (status != MAIL$_NOMOREREC);
X
X         if (edit_flag)
X         `123
X            fclose (fp);
X            /* edit the file */          `032
X            tpuedit (filename_buffer, filename_buffer);
X         `125
X
X         /* confirm? */
X         printf ("\n\n");
X         do
X         `123
X            printf ("Confirm? ");
X            if (gets (int_buffer) == NULL)
X            `123
X               /* control Z */
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               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            trim (int_buffer);
X         `125  while ((int_buffer `0910`093 != 'y') && (int_buffer `0910`093
V != 'Y') &&`032
X                   (int_buffer `0910`093 != 'n') && (int_buffer `0910`093 !=
V 'N'));
X
X         if ((int_buffer `0910`093 == 'n') `124`124 (int_buffer `0910`093 ==
V 'N'))
X         `123
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            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         `125                  `032
X
X         if (edit_flag)
X         `123
X            /* does the file exist? */
X            if ((fp = fopen (filename_buffer, "r")) == NULL)
X            `123
X               printf ("PLM$MAIL-F-NOFILE, File %s not found\n",`032
X                       filename_buffer);
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
+-+-+-+-+-+-+-+-  END  OF PART 9 +-+-+-+-+-+-+-+-

