anchor.diff:        (get-output-stream-string stream))))
   
   (defun decode-q-to-octets (str)
  -  "decodes q encoded strings to octet arrazs"
  +  "decodes q encoded strings to octet arrays"
     (let* ((len (length str))
   	 (octets (make-array len :fill-pointer 0 :adjustable t)))
       (labels
  
positive.code:       octets)))
  
  (defun decode-one-word (str)
    (multiple-value-bind (start end reg-starts reg-ends)
        (ppcre:scan *decoded-line-regexp* str)
      (if (null start)
  	(error "Not a valid encoded word ~A" str)
  	(let ((charset  (subseq str (elt reg-starts 0) (elt reg-ends 0)))
  
negative.code: 	    (t (error "unknown encoding ~A" encoding)))))))
  
  (defun decode (str &key (start 0) (end (length str)))
    "Decodes an encoded string and returns the result.
  Start and end can be defined if only a part of the sring shell be decoded."
    (loop
       :with stream = (make-string-output-stream)
       :for word :in (ppcre:split +crlfsp+ str :start start :end end)
       :do (princ (decode-one-word word) stream)
       :finally (return (get-output-stream-string stream))))
  
  (defun decode* (str &key (start 0) (end (length str)))
    "Decodes a mixed string, i.e., a string that may contain encoded and
  unencoded words."
    (loop
       :with stream = (make-string-output-stream)
       :for x = 0 :then end
       :for (estart eend)
       :on (ppcre:all-matches #.(concatenate
                                 'string
                                 +decoded-line-regexp+
                                 "(" +crlfsp+ +decoded-line-regexp+ ")*")
  			    str :start start :end end)
       :by #'cddr
       :unless (= x estart) :do (princ (subseq str x estart) stream)
       :do (princ (decode str :start estart :end eend) stream)
       :finally (let ((eend*  (if (null eend) 0 eend)))
  		(unless (= eend* end)
  		  (princ (subseq str eend* end) stream))
  		(return (get-output-stream-string stream)))))
  