[inherit('sys$library:starlet','lib$spawn','smgdefs','smg$repaint_line',
'BB.PEN')]
module add_edit;

[global] 
procedure add_edit;

{Create a new message using EDT editor.  This procedure is used by the
 add option to add a message to the Bulletin Board, or the send option
 to send a reply to a message already on the Bulletin Board.}

begin
  get_message_info;  {Creates the header information}

  write_menu('','Invoking editor for entry of message. '+
                'Press any key to continue...');
  getchar;

  {Deletes any old BB.TMP files 2-MAR-88}
  open(ifile,'BB.TMP',history:=old,disposition:=delete,error:=continue); 
  close(ifile,disposition:=delete,error:=continue);  

  {Save the current screen to paste back after editing.}
  smg$save_physical_screen(pasteboard,saved_display);

  edt$edit('BB.TMP',com_file := 'BB$USER_DIRECTORY:EDTINI.EDT');
  smg$restore_physical_screen(pasteboard,saved_display);

  open(ifile,'BB.TMP',history:=old,disposition:=delete,error:=continue); 
  if (status(ifile) = 0) then
    case destination_option of
      'I','P' : put_internet(mail_file:='BB.TMP');
      'L' : put_local;
    end;

  close(ifile,error:=continue);
end;
end.
