(std11-parse-ascii-token): Use function
[elisp/mu-cite.git] / std11.el
index 220b8d3..5c06146 100644 (file)
--- a/std11.el
+++ b/std11.el
@@ -4,7 +4,7 @@
 
 ;; Author:   MORIOKA Tomohiko <morioka@jaist.ac.jp>
 ;; Keywords: mail, news, RFC 822, STD 11
-;; Version: $Id: std11.el,v 0.29 1996-09-08 18:03:51 morioka Exp $
+;; Version: $Id: std11.el,v 0.33 1996-09-14 08:42:39 morioka Exp $
 
 ;; This file is part of MU (Message Utilities).
 
@@ -199,8 +199,8 @@ If BOUNDARY is not nil, it is used as message header separator.
 
 (defconst std11-non-qtext-char-list '(?\" ?\\ ?\r ?\n))
 
-(defun rfc822/wrap-as-quoted-string (str)
-  "Wrap string STR as RFC 822 quoted-string. [tl-822.el]"
+(defun std11-wrap-as-quoted-string (string)
+  "Wrap STRING as RFC 822 quoted-string. [std11.el]"
   (concat "\""
          (mapconcat (function
                      (lambda (chr)
@@ -208,9 +208,38 @@ If BOUNDARY is not nil, it is used as message header separator.
                            (concat "\\" (char-to-string chr))
                          (char-to-string chr)
                          )
-                       )) str "")
+                       )) string "")
          "\""))
 
+(defun std11-strip-quoted-pair (str)
+  (let ((dest "")
+       (i 0)
+       (len (length str))
+       chr flag)
+    (while (< i len)
+      (setq chr (aref str i))
+      (if (or flag (not (eq chr ?\\)))
+         (progn
+           (setq dest (concat dest (char-to-string chr)))
+           (setq flag nil)
+           )
+       (setq flag t)
+       )
+      (setq i (+ i 1))
+      )
+    dest))
+
+(defun std11-strip-quoted-string (string)
+  "Strip quoted-string STRING. [std11.el]"
+  (std11-strip-quoted-pair
+   (let ((max (1- (length string))))
+     (if (and (eq (aref string 0) ?\")
+             (eq (aref string max) ?\")
+             )
+        (substring string 1 max)
+       string)
+     )))
+
 
 ;;; @ composer
 ;;;