1 ;;; std11.el --- STD 11 parser for GNU Emacs
3 ;; Copyright (C) 1995,1996 Free Software Foundation, Inc.
5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
6 ;; Keywords: mail, news, RFC 822, STD 11
7 ;; Version: $Id: std11.el,v 0.1 1996-08-28 12:29:00 morioka Exp $
9 ;; This file is part of tl (Tiny Library).
11 ;; This program is free software; you can redistribute it and/or
12 ;; modify it under the terms of the GNU General Public License as
13 ;; published by the Free Software Foundation; either version 2, or (at
14 ;; your option) any later version.
16 ;; This program is distributed in the hope that it will be useful, but
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 ;; General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with This program; see the file COPYING. If not, write to
23 ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 ;; Boston, MA 02111-1307, USA.
31 (defconst std11-field-name-regexp "[!-9;-~]+")
32 (defconst std11-field-head-regexp
33 (concat "\\(" std11-field-name-regexp "\\):"))
35 (defun std11-field-end ()
36 (if (re-search-forward rfc822::next-field-top-regexp nil t)
37 (goto-char (match-beginning 0))
38 (if (re-search-forward "^$" nil t)
39 (goto-char (1- (match-beginning 0)))
49 (defun std11-header-string (pat &optional boundary)
50 (let ((case-fold-search t))
53 (std11-narrow-to-header boundary)
54 (goto-char (point-min))
56 (while (re-search-forward std11-field-head-regexp nil t)
57 (setq field (buffer-substring (match-beginning 0)
60 (if (string-match pat field)
61 (setq header (concat header field "\n"))
66 (defun std11-header-string-except (pat &optional boundary)
67 (let ((case-fold-search t))
70 (std11-narrow-to-header boundary)
71 (goto-char (point-min))
73 (while (re-search-forward std11-field-head-regexp nil t)
74 (setq field (buffer-substring (match-beginning 0)
77 (if (not (string-match pat field))
78 (setq header (concat header field "\n"))
83 (defun std11-narrow-to-header (&optional boundary)
85 (goto-char (point-min))
86 (if (re-search-forward
87 (concat "^\\(" (regexp-quote (or boundary "")) "\\)?$")
99 ;;; std11.el ends here