chiark
/
gitweb
/
~mdw
/
zone
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
afa2e2f
)
serv.lisp: Spread exports throughout the file.
author
Mark Wooding
<mdw@distorted.org.uk>
Tue, 6 Sep 2011 11:42:42 +0000
(12:42 +0100)
committer
Mark Wooding
<mdw@distorted.org.uk>
Tue, 6 Sep 2011 11:42:42 +0000
(12:42 +0100)
serv.lisp
patch
|
blob
|
blame
|
history
diff --git
a/serv.lisp
b/serv.lisp
index f8827b113b898a9ad1f91db8ed06c10492d4bb34..245ffe9c72c29fa21f0a77ce22dba033408adc25 100644
(file)
--- a/
serv.lisp
+++ b/
serv.lisp
@@
-22,12
+22,11
@@
;;; Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
(defpackage #:services
;;; Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
(defpackage #:services
- (:use #:common-lisp #:mdw.base #:mdw.str #:collect #:net #:anaphora)
- (:export #:serv #:servp #:serv-name #:serv-aliases #:serv-port #:serv-proto
- #:serv-by-name #:serv-by-port #:serv-add #:serv-list))
+ (:use #:common-lisp #:mdw.base #:mdw.str #:collect #:net #:anaphora))
(in-package #:services)
(in-package #:services)
+(export '(serv servp serv-name serv-aliases serv-port serv-proto))
(defstruct (serv (:predicate servp))
"Represents a service entry in /etc/services."
(name :nil :type keyword)
(defstruct (serv (:predicate servp))
"Represents a service entry in /etc/services."
(name :nil :type keyword)
@@
-39,6
+38,7
@@
(let ((byname (make-hash-table))
(byport (make-hash-table)))
;; Translation functions.
(byport (make-hash-table)))
;; Translation functions.
+ (export 'serv-by-name)
(defun serv-by-name (name &optional proto)
"Look up the service with the given NAME (or alias) and PROTO. If PROTO
is nil, use a default protocol from a built-in list."
(defun serv-by-name (name &optional proto)
"Look up the service with the given NAME (or alias) and PROTO. If PROTO
is nil, use a default protocol from a built-in list."
@@
-52,6
+52,7
@@
(defun serv-by-name (name &optional proto)
(awhen (find-proto proto)
(return it))))))))
(awhen (find-proto proto)
(return it))))))))
+ (export 'serv-by-port)
(defun serv-by-port (port &optional (proto :tcp))
"Look up the service with the given PORT number and PROTO."
(find proto (gethash port byport) :key #'serv-proto))
(defun serv-by-port (port &optional (proto :tcp))
"Look up the service with the given PORT number and PROTO."
(find proto (gethash port byport) :key #'serv-proto))
@@
-64,6
+65,7
@@
(defun serv-add (serv)
(push serv (gethash alias byname))))
;; Read the whole damned lot.
(push serv (gethash alias byname))))
;; Read the whole damned lot.
+ (export 'serv-list)
(defun serv-list (&key (predicate (constantly t)))
"Return as a list the services which match PREDICATE (default all of
them)."
(defun serv-list (&key (predicate (constantly t)))
"Return as a list the services which match PREDICATE (default all of
them)."