chiark / gitweb /
net.lisp: Support string-like host designations in `net-host'.
[zone] / serv.lisp
index f8827b113b898a9ad1f91db8ed06c10492d4bb34..245ffe9c72c29fa21f0a77ce22dba033408adc25 100644 (file)
--- a/serv.lisp
+++ b/serv.lisp
 ;;; 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)."