This file is indexed.

/usr/share/emacs/site-lisp/wl/elmo/slp.el is in wl 2.14.0-12.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
;;; slp.el --- An SLP interface.

;; Author: Yuuichi Teranishi <teranisi@gohome.org>
;; Keywords: SLP

;; Copyright (C) 2001 Yuuichi Teranishi <teranisi@gohome.org>

;; This file is not part of GNU Emacs

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING.  If not, write to the
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
;;

;;; Commentary:
;;
;; slp.el is an elisp library providing an interface for SLP (RFC2614)
;; using OpenSLP(http://www.openslp.org/) slptool .
;;
;;; History:
;; 28 Aug 2001 Created.

;;; Code:

(defgroup slp nil
  "Interface for `Service Location Protocol'."
  :group 'comm)

(defcustom slp-program "slptool"
  "SLP client program (OpenSLP's slptool)."
  :type 'string
  :group 'slp)

(defcustom slp-program-arguments nil
  "Option argument for SLP client program."
  :type '(repeat string)
  :group 'slp)

(defun slp-exec-wait (type &rest args)
  "Synchronous execution of slp-program.
TYPE is a symbol (one of `srvs', `attrs', `srvtypes', `as-is', `ignore')."
  (with-temp-buffer
    (let ((result (apply 'call-process slp-program nil t nil
			 (append slp-program-arguments (delq nil args)))))
      (unless (zerop result)
	(error "SLP error: %s" (buffer-string)))
      (goto-char (point-min))
      (case type
	(srvs (slp-parse-srvs))
	(attrs (slp-parse-attrs))
	(srvtypes (slp-parse-srvtypes))
	(as-is (buffer-string))))))

;; Response parser.
(defun slp-parse-srvs ()
  (let (srvtype hostport host port lifetime srvs)
    (while (and
	    (not (eobp))
	    (looking-at "service:\\([^:]+\\):/[^/]*/\\([^,]+\\),\\([0-9]+\\)"))
      (setq srvtype (match-string 1)
	    hostport (match-string 2)
	    lifetime (string-to-number (match-string 3)))
      (if (string-match ":\\([0-9]+\\)" hostport)
	  (setq host (substring hostport 0 (match-beginning 0))
		port (string-to-number (match-string 1 hostport)))
	(setq host hostport
	      port nil))
      (push (cons (list srvtype host port) lifetime) srvs)
      (forward-line 1))
    (list 'srvs (nreverse srvs))))

(defsubst slp-forward ()
  (or (eobp) (forward-char)))

(defun slp-parse-attr ()
  (when (looking-at "(\\([^=]+\\)=\\([^)]+\\))")
    (prog1 (cons (match-string 1) (match-string 2))
      (goto-char (match-end 0)))))

(defun slp-parse-attrs ()
  (let (attrs)
    (push (slp-parse-attr) attrs)
    (while (eq (char-after (point)) ?,)
      (slp-forward)
      (push (slp-parse-attr) attrs))
    (list 'attrs (nreverse attrs))))

(defun slp-parse-srvtypes ()
  (let (types)
    (while (not (eobp))
      (when (looking-at "^service:\\([^/\n]+\\)$")
	(push (buffer-substring (match-beginning 1) (match-end 1)) types))
      (forward-line 1))
    (list 'srvtypes (nreverse types))))

;; Response accessor.
(defsubst slp-response-type (response)
  (nth 0 response))

(defsubst slp-response-body (response)
  (nth 1 response))

(defsubst slp-response-srv-url-service-type (srv)
  (nth 0 (car srv)))

(defsubst slp-response-srv-url-host (srv)
  (nth 1 (car srv)))

(defsubst slp-response-srv-url-port (srv)
  (nth 2 (car srv)))

(defsubst slp-response-srv-lifetime (srv)
  (cdr srv))

;; Commands
(defun slp-findsrvs (service-type &optional filter)
  (slp-exec-wait 'srvs "findsrvs" service-type filter))

(defun slp-findattrs (url &rest attrids)
  (apply 'slp-exec-wait 'attrs "findattrs" url attrids))

(defun slp-findsrvtypes (&optional authority)
  (slp-exec-wait 'srvtypes "findsrvtypes" authority))

(defun slp-findscopes ()
  (slp-exec-wait 'as-is "findscopes"))

(defun slp-register (url &optional attrs)
  (slp-exec-wait 'ignore "register" url (mapconcat
					 (lambda (pair)
					   (format "(%s=%s)"
						   (car pair)
						   (cdr pair)))
					 attrs
					 ",")))

(defun slp-deregister (url)
  (slp-exec-wait 'ignore "deregister" url))

(defun slp-getproperty (propertyname)
  (slp-exec-wait 'as-is "getproperty" propertyname))

(provide 'slp)

;;; slp.el ends here