[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

world management and patches

    Date: Fri, 29 Jul 88 10:06 EDT
    From: SWM@SAPSUCKER.SCRC.Symbolics.COM (Scott McKay)

	Date: Thu, 28 Jul 88 20:00 EDT
	From: cjl@WHEATIES.AI.MIT.EDU (Chris Lindblad)

	    Date: Thu, 23 Jun 88 10:36 EDT
	    From: SWM@SAPSUCKER.SCRC.Symbolics.COM (Scott McKay)

		Date: Wed, 22 Jun 88 13:23 CDT
		From: Gumby@MCC.COM (David Vinayak Wallace)

		But they don't give you any tool for 1creating0 ECOs, so you can't use it
		to distribute patches to your own systems.

	    m-X Start/Add/Finish Patch is how we create ECOs, except that we
	    include, by hand, a form at the top of the patch file, 2sct:define-eco0.
	    The sole purpose of that form is to make the herald and :Show ECOs print
	    something that indicates that there are ECO patches.

	Unless I missed something, this still is not enough to make mail message ECOs
	that can be decoded with the ZMAIL command "Decode ECO".  How do you make a
	mail message ECO from a distribution tape ECO?

	It would also be nice if the file sys:zmail;eco-commands.lisp were on the next
	eco tape.

    We didn't include the encoding stuff because it was not adequately
    tested.  In fact, I know of several bugs.  Including it in 7.2 would
    have constituted a promise to support it, which promise we are not ready
    to make.

    The ECO tape included the entire source of SYS:IO1;ENCODE-BINARY-FILES,
    even if the patches did not.  The following is the entire source of

    Please, do not expect to have bugs fixed in this.  The 1only0 thing you
    can count on working is encoding and decoding a distribution "tape"
    which has been made using the :Use Disk keyword to :Distribute Systems.

    ;;; -*- Mode: LISP; Syntax: Common-Lisp; Base: 10; Package: ZWEI; Lowercase: Yes -*-
[code deleted]

A lot of graphics customers asked for this so I hacked the following
together.  There is a patch to TYI: so it can decode 16 bit files.  I
have had confirmation that it works, but am always looking to improve
things.  If you have any comments please send them my way.  It might be
easier to use the encode eco command now.


;;; -*- Mode: LISP; Syntax: Common-Lisp; Package: USER; Base: 10; Patch-File: T -*-

;;; This code allows you to send binary files (bin, dump and others)
;;; over symbolics mail.  This was originally intended to allow graphic
;;; houses the ability of sending images between sites using
;;; dialnet.
;;;                Written By Mark Tait.
;;;                 7/25/88

;;; Remember this is not officially supported by Symbolics yet.
;;; 2The procedure for mailing files is as follows.
;0) Load this code.
;1) (send-file-to "filename" "Username@Mail-address")
;   This will send a file to whoever address you give it.  It will also
;   create a file that has an ENCODED file extension.  If you have
;   already encoded the file then give a keyword of :encode nil.
;   That's all there is to it.
;;;; 2Procedure for recieving mail through files.
;1) Read you inbox to get the mail message.
;2) Make the mail message with the file in it the current message.
;3) You will see the name of the file in the line following the line that
;   looks like 
;   -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
;   (see the example mail message below)  If the name of the file isn't
;   what it should be then you can change it by editing the mail message. 
;   To do that click the mouse over the file name and make the
;   corrections. (This will act just like zmacs)  Then to save the
;   changes hit the END key.  If you make mistakes you can hit ABORT to
;   cancel the changes during that edit session.
;4) Once the filename is correct type M-X DECODE ECO.
;5) Answer the questions about Restore Distribution with a NO.
;6) You are done.  You should have a decoded file in your lmfs.
;7) If you get an error like:
;2Error: The recorded end-to-end checksum does not match the computed end-to-end checksum;
0;2       the file VTX:>tait>dialnet>checksum-test.encode.newest was probably damaged during transfer
0;Hit resume.  Things should be ok.
;=================SAMPLE MAIL MESSAGE===========================
;From: Mark-Andrew Tait <TAIT@VERMITHRAX.SCH.Symbolics.COM>
;Subject: VTX:>tait>dialnet>test2.encode.newest
;To: tait@VERMITHRAX.SCH.Symbolics.COM
;Message-ID: <19880722180000.1.TAIT@BILL-THE-CAT.SCH.Symbolics.COM>
;        *** Software ECO Distribution ***
;     by electronic mail, from Symbolics, Inc.
;>> To restore this distribution, please use the Zmail command
;        m-X Decode ECO
;   It will save the decoded distribution in the file named in the 
;   encoded body.  It will also offer to do Restore Distribution from
;   this file. 
;  -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
;  -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
;;;Code to send a file to another host by mail.
;;;Example calls.
;;;(send-file-to "filename" "Username@Mail-address")
;;;(send-file-to "vt:>tait>dialnet>mendelbrot-world-view.dump.newest" "tait@vt")

(defvar zwei:*ECO-greeting* "*** File Transfer ***

>> To restore this distribution, please use the Zmail command

        m-X Decode ECO

   It will save the decoded distribution in the file named in the 
   encoded body.  If you want a different filename you must edit the
   mail message before you decode.  It will also offer to do Restore
   Distribution from this file. 

(defvar zwei:*ECO-delimiter*
	"  -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

(defun send-file-to (filename address-to-send-to 
		     &key subject cc (encode t)
  ;;Make sure we have real pathnames.
  (zl:ARGUMENT-TYPECASE  filename
    (pathname filename)
    (:string (setf filename (fs:parse-pathname filename))))
     ;;make sure given name for encoded-filename is a real pathname.
     (zl:ARGUMENT-TYPECASE encoded-filename
       (pathname encoded-filename)
	 (setf encoded-filename
	       (fs:parse-pathname encoded-filename)))))
    (t (if encode
	   ;;When an encoded-filename is not given and encode is t use
	   ;;a default value of filename.encode
	   (setf encoded-filename
		 (send (fs:parse-pathname filename)
		       :new-type :encode))
	   ;;If you don't want to encode then make sure that the file
	   ;;you want to send is already encoded.  Ask the user if
	   ;;he/she is sure they know what they are doing.
	   (when (not (yes-or-no-p
			"You have given an Encoded-Filename, but also have the keyword Encode equal to nil??
Are you sure you want to do this? "))
	     (return-from send-file-to)))))
  ;;Only need to encode when encode is t.
  (if encode
      (with-open-file (input-file filename
				  :direction :input
				  :characters :default)
	(with-open-file (output-file
			  :direction :output)
	  (cli::encode-data-as-ascii input-file output-file)))
      ;;When encode is nil and there is no encoded-filename then assume
      ;;that they really want to send the file given as filename.  Do do
      ;;this just set encoded-file to filename.
      (setf encoded-filename filename))
  ;;We send the mail off here.
  (zwei:SEND-MESSAGE-STRING address-to-send-to
			    ;;create the text of the mail message.  Keep
			    ;;it in ECO format so the recieving side can
			    ;;use M-X Decode ECO.
			    (string-append zwei:*eco-greeting* zwei:*eco-delimiter*
					   (with-output-to-string (string)
					     (with-open-file (input-file encoded-filename
									 :direction :input :characters :default)
					       (si:stream-copy-until-eof input-file string)))
			    :subject (or subject (send filename :STRING-FOR-PRINTING))
			    :cc cc))

;;; Patch file for UTILITIES version 27.28
;;; Reason: :TYI read on too many bytes on 16 bit files.

  "-*- Mode: LISP; Syntax: Common-lisp; Package: CLI; Base: 10; Lowercase: Yes; -*-")

(defmethod (:tyi ascii-to-8bit-decoding-stream) (&optional eof)
  (labels ((check-for-eof (char)
	     (when (eq char eof)
		 (:decoding-stream stream)
		 "Ran out of input in encoding sequence")))
	   (block-checksum ()
	     ;; Snapshot the block checksum here, since the checksum itself
	     ;; doesn not get included in the block checksum
	     (let ((saved-block-checksum block-checksum)
		   (checksum 0)
		   (sign 1))
	       (loop as ch = (send stream :tyi)
		     do (maintain-checksums ch)
		     until (char= ch #\return)
		     as digit = (- (char-code ch) (char-code #\0))
		     do (if (char= ch #\-)
			    (setq sign -1)
			    (setq checksum (+ (* checksum 10) digit))))
	       (when ( (* checksum sign) saved-block-checksum)
		   (:decoding-stream stream)))
	       ;; Now we can reset the block checksum
	       (setq block-checksum 0)))
	   (tyi ()
	     (loop doing
	       (let ((char (read-one-character eof)))
		 (when (eq char eof)
		   (return-from tyi eof))
		 (if (let ((code (char-code char)))
		       (or (and ( code #o046) ( code #o136))
			   (and ( code #o141) ( code #o172))))
		     (return-from tyi char)
		     (let ((next (read-one-character eof)))
		       (check-for-eof next)
		       (when (char= next #\%)
			 ;; If we got a % after an escape, this must be a block checksum
			 (when (char char #\%)
			   (setq next (read-one-character eof))
			   (check-for-eof next)
			   (when (char next #\%)
			       (:decoding-stream stream)
			       "Error while reading the block checksum")))
			 (when (char= char #\%)
			   (go si:next-loop))
			 (setq next (read-one-character eof))
			 (check-for-eof next))
		       (return-from tyi (decode-character char next eof))))))))
    (if (not 16bit)
	(let ((char (tyi)))
	  (if (or (eq char eof) characters)
	      (char-code char)))
	(let ((low (tyi)))
	  (if (eq low eof)
	      (let ((high (tyi)))
		(when (eq high eof)
		    (:decoding-stream stream)
		    "Ran out of input reading 16 bit quantity"))
		(dpb (char-code high) (byte 8 8) (char-code low))))))))