From:	CSBVAX::MRGATE!RELAY-INFO-VAX@CRVAX.SRI.COM@SMTP 17-OCT-1988 10:04
To:	ARISIA::EVERHART
Subj:	VMS_SHARE 6.01A re-posting 3/3


Received: From KL.SRI.COM by CRVAX.SRI.COM with TCP; Mon, 17 OCT 88 04:28:15 PDT
Received: from CUNYVM.CUNY.EDU by KL.SRI.COM with TCP; Mon, 17 Oct 88 04:17:47 PDT
Received: from UKACRL.BITNET by CUNYVM.CUNY.EDU (IBM VM SMTP R1.1) with BSMTP id 4598; Mon, 17 Oct 88 07:17:28 EDT
Received: from RL.IB by UKACRL.BITNET (Mailer X1.25) with BSMTP id 0380; Mon,
 17 Oct 88 11:27:35 BST
Received: from RL.IB by UK.AC.RL.IB (Mailer X1.25) with BSMTP id 0515; Mon, 17
          Oct 88 11:27:35 BS
Via:      UK.AC.KCL.CC.OAK; 17 OCT 88 11:27:24 BST
Date:     17-OCT-1988 11:28:23 GMT
From:     UDAA055%OAK.CC.KCL.AC.UK@CUNYVM.CUNY.EDU
To:       info-vax@KL.SRI.COM
Subject:  VMS_SHARE 6.01A re-posting 3/3
Sender:   Andy Harper, Kings College London <A.Harper%OAK.CC.KCL.AC.UK@CUNYVM.CUNY.EDU>

+-+-+-+ Beginning of part 3 +-+-+-+
X  COPY_TEXT( b_file );
X  DELETE( b_file );
X  __copy_text( FAO( "$ GOSUB UNPACK_FILE" ) );
XENDLOOP;
XCOPY_TEXT( FAO( "$ EXIT" ) );
X
X!+
X! Compute the size of the packed buffer.
X!-
X
Xi_length := 0;
XPOSITION( BEGINNING_OF( b_packed ) );
XLOOP
X  EXITIF MARK( NONE ) = END_OF( b_packed );
X  i_line_length := LENGTH( CURRENT_LINE ) + 2;
X  IF ( i_line_length - ( ( i_line_length / 2 ) * 2 ) ) <> 0
X  THEN
X    i_line_length := i_line_length + 1;
X  ENDIF;
X  i_length := i_length + i_line_length;
X  MOVE_VERTICAL( 1 );
XENDLOOP;
X
X!+
X! Handle differently if only one part or more than one part will be written.
X!-
X
XIF i_length < i_max_part_bytes
XTHEN
X
X  !+
X  ! Set the number of parts and the name of the output file.
X  !-
X
X  i_parts := 1;
X  SET( OUTPUT_FILE, b_packed, FAO( "!AS1_OF_1", s_output_file ) );
X
XELSE
X
X  !+
X  ! Since more than one part will be written, insert the ATTENTION message.
X  !-
X
X  POSITION( m_attention_text );
X  MOVE_VERTICAL( 1 );
V  __copy_text( FAO( "$!! ATTENTION: To keep each article below !UL block!%S (!U
XL byte!%S), this",
X    i_max_part_blocks, i_max_part_bytes ) );
V  __copy_text( FAO( "$!!!12* program has been transmitted in 999 parts.  You sh
Xould" ) );
V  __copy_text( FAO( "$!!!12* concatenate ALL parts to ONE file and execute (@)
Xthat file." ) );
X  __copy_text( FAO( "$!!" ) );
X
X  !+
V  ! Skip the first part for now since the number of parts will have to be corre
Xcted later.
X  !-
X
X  POSITION( BEGINNING_OF( b_packed ) );
X  __find_part_end;
X  MOVE_HORIZONTAL( -(CURRENT_OFFSET + 1) );
X
X  !+
X  ! Determine if a GOTO/label pair is needed for Part 1/Part 2 boundary.
X  !-
X
X  MOVE_VERTICAL( -1 );
X  s_x := CURRENT_CHARACTER;
X  MOVE_VERTICAL( 1 );
X  IF s_x = "$"
X  THEN
X    i_label_needed := 1;
X  ELSE
X    i_label_needed := 0;
X  ENDIF;
X
X  !+
X  ! Initialize the number of parts and the starting part number.
X  !-
X
X  i_part_num := 2;
X  i_parts := 1;
X
X  !+
X  ! Loop through the rest of the parts moving the text to part buffers.
X  !-
X
X  LOOP
X
X    !+
X    ! Move the next part into the part buffer.
X    !-
X
X    POSITION( b_packed );
X    EXITIF MARK( NONE ) = END_OF( b_packed );
X
X    MOVE_HORIZONTAL( -(CURRENT_OFFSET) );
X    m_part_begin := MARK( NONE );
X    __find_part_end;
X    MOVE_HORIZONTAL( -(CURRENT_OFFSET + 1) );
X    r_part := CREATE_RANGE( m_part_begin, MARK( NONE ), NONE );
X    b_part := CREATE_BUFFER( FAO( "`123Part !UL`125", i_part_num ) );
X    POSITION( b_part );
X    COPY_TEXT( FAO( s_part_begin, i_part_num ) );
X    IF i_label_needed <> 0
X    THEN
X      SPLIT_LINE;
X      COPY_TEXT( FAO( s_part_label, i_part_num ) );
X    ENDIF;
X    POSITION( END_OF( b_part ) );
X    MOVE_TEXT( r_part );
X    POSITION( END_OF( b_part ) );
X
X    !+
X    ! Determine if a GOTO/label pair is needed for Part n/Part n+1 boundary.
X    !-
X
X    MOVE_VERTICAL( -1 );
X    s_x := CURRENT_CHARACTER;
X    MOVE_VERTICAL( 1 );
X    IF ( s_x = "$" ) AND ( END_OF( r_part ) <> END_OF( b_packed ) )
X    THEN
X      __copy_text( FAO( s_part_goto, i_part_num + 1 ) );
X      i_label_needed := 1;
X    ELSE
X      i_label_needed := 0;
X    ENDIF;
X    COPY_TEXT( FAO( s_part_end, i_part_num ) );
X
X    !+
X    ! Increment to the next part.
X    !-
X
X    i_part_num := i_part_num + 1;
X    i_parts := i_parts + 1;
X
X  ENDLOOP;
X
X  !+
V  ! Now that the number of parts is known, update the number of parts in part 1
X and move it to it's part buffer.
X  !-
X
X  POSITION( m_attention_text );
X  r_parts := SEARCH( "999", FORWARD );
X  ERASE( r_parts );
X  POSITION( END_OF( r_parts ) );
X  COPY_TEXT( STR( i_parts ) );
X  b_part := CREATE_BUFFER( "`123Part 1`125" );
X  POSITION( b_part );
X  MOVE_TEXT( b_packed );
X  POSITION( END_OF( b_part ) );
X  MOVE_VERTICAL( -1 );
X  s_x := CURRENT_CHARACTER;
X  MOVE_VERTICAL( 1 );
X  IF s_x = "$"
X  THEN
X    __copy_text( FAO( s_part_goto, 2 ) );
X  ENDIF;
X  COPY_TEXT( FAO( s_part_end, 1 ) );
X  DELETE( b_packed );
X
X  !+
X  ! Determine the maximum number of digits in part numbers.
X  !-
X
X  IF i_parts <= 9
X  THEN
X    i_digits := 1;
X  ELSE
X    IF i_parts <= 99
X    THEN
X      i_digits := 2;
X    ELSE
X      i_digits := 3;
X    ENDIF;
X  ENDIF;
X
X  !+
X  ! Initialize the starting part number.
X  !-
X
X  i_part_num := 1;
X
X  !+
V  ! Loop through all of the parts setting the file name to be associated with t
Xhat part.
X  !-
X
X  LOOP
X
X    EXITIF i_part_num > i_parts;
X    b_part := __find_buffer( FAO( "`123Part !UL`125", i_part_num ) );
X
X    !+
X    ! Set the name of the output file for this part.
X    !-
X
V    SET( OUTPUT_FILE, b_part, FAO( "!AS!#ZL_OF_!UL", s_output_file, i_digits, i
X_part_num, i_parts ) );
X
X    !+
X    ! Increment to the next part.
X    !-
X
X    i_part_num := i_part_num + 1;
X
X  ENDLOOP;
X
XENDIF;
X
X!+
X! Create final output message buffer and fill it.
X!-
X
Xb_message := CREATE_BUFFER( "`123Message`125" );
XPOSITION( b_message );
V__copy_text( FAO( "SHARE-file !AS was written in !UL part!%S as follows:", s_sh
Xare_file, i_parts ) );
XSET( NO_WRITE, b_message, OFF );
XSET( OUTPUT_FILE, b_message, "SYS$COMMAND" );
X
XEXIT;
X$ DELETE/NOLOG/NOCONFIRM VMS_SHARE_DUMMY.DUMMY;*
V$ DIRECTORY/DATE=CREATED/NOHEADER/SIZE=USED/VERSIONS=1/WIDTH=(FILENAME=47,SIZE=
X4) 'SHARE_FILE'*_OF_*
X$ VERIFY = F$VERIFY( VERIFY )
$ GOSUB UNPACK_FILE
$ FILE_IS = "TEST.TXT"
$ CHECKSUM_IS = 1850348592
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
XTest file of all printable characters to check transmission accuracy of
Xnetwork mail.
X
Xabcdefghijklmnopqrstuvwxyz`009! All lower case letter, in order
XABCDEFGHIJKLMNOPQRSTUVWXYZ`009! All upper case letters, in order
X0123456789`009`009`009! All digits in order
X``  ! Backwords quote
X`126  ! Tilde
X!  ! Exclamation mark
X@  ! at sign
X#  ! Hash or pound sign
X$  ! Dollar sign
X%  ! Percent sign
X`094  ! Caret
X&  ! Ampersand
X*  ! asterisk
X(  ! Left round bracket
X)_ ! Right round bracket
X-  ! minus
X+  ! plus
X=  ! equals
X`123  ! left brace
X`125  ! right brace
X[  ! left square bracket
X]  ! right square bracket
X:  ! colon
X"  ! Double quote
X`124  ! vertical bar
X;  ! semicolon
X'  ! single quote
X\  ! backslash
X>  ! greater than
X<  ! less than
X,  ! comma
X.  ! period
X?  ! question mark
X/  ! slash
X
X
XFinally, here are some lines with trailing blanks      `032
Xand another    `032
$ GOSUB UNPACK_FILE
$ EXIT
-+-+-+-+-+ End of part 3 +-+-+-+-+-

