Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

removed dependency on sbcl and added dependency on babel; should be p…

…ortable across most implementations now
  • Loading branch information...
commit 98ef2471ef53d81598c9d60b9d01efce4cb3e786 1 parent 4593889
@ilitirit ilitirit authored
2  cl-dbus.asd
@@ -11,6 +11,6 @@
(:file "test" :depends-on ("packages" "network")))
:depends-on (iterate flexi-streams defclass-star usocket cl-ppcre
- ironclad))
+ ironclad babel))
;;; EOF
10 cookie-sha1-auth.lisp
@@ -30,7 +30,7 @@ epoch and the cookie itself (as string of hex digits)."
(defun try-cookie-sha1-auth (stream)
;; Send the username we want to authenticate as.
- (let ((user (sb-ext:posix-getenv "USER")))
+ (let ((user (file-author (user-homedir-pathname))))
(assert (stringp user) (user) "Couldn't find out username?! USER is not set.")
(format-crlf stream "AUTH DBUS_COOKIE_SHA1 ~A"
(string-to-hex-string user)))
@@ -44,8 +44,8 @@ epoch and the cookie itself (as string of hex digits)."
(when (string/= response "DATA")
(error "Got unexpected result: ~A ~A" response data))
(destructuring-bind (context secret-cookie-id-str hex-challenge-str)
- (cl-ppcre:split "\\s" (sb-ext:octets-to-string (parse-hex-string data)
- :external-format :ascii))
+ (cl-ppcre:split "\\s" (babel:octets-to-string (parse-hex-string data)
+ :encoding :ascii))
(let ((secret-cookie-id (parse-integer secret-cookie-id-str)))
;; Try to find the requested cookie.
(let ((cookie-data-str (block data
@@ -64,8 +64,8 @@ epoch and the cookie itself (as string of hex digits)."
- (digest (octets-to-hex-string (ironclad:digest-sequence 'ironclad:sha1
- (sb-ext:string-to-octets
+ (digest (octets-to-hex-string (ironclad:digest-sequence :sha1
+ (babel:string-to-octets
;; Format our answer
(format-crlf stream "DATA ~A20~A"
6 network.lisp
@@ -25,7 +25,7 @@ address. Defaults to :SESSION."
(stream (connect-via-address-string
(etypecase address
(symbol (ecase address
- (:session (sb-posix:getenv "DBUS_SESSION_BUS_ADDRESS"))))
+ (:session (getenv "DBUS_SESSION_BUS_ADDRESS"))))
(string address))))
(con (make-instance 'dbus-connection
:stream stream)))
@@ -110,7 +110,7 @@ address. Defaults to :SESSION."
(assert (= bytes length))
(incf *byte-counter* bytes)
(assert (zerop (dbus-read-byte stream)))
- (sb-ext:octets-to-string buf :external-format :utf8))))
+ (babel:octets-to-string buf :encoding :utf-8))))
(defun dbus-read-signature (stream)
(let* ((length (dbus-read-byte stream))
@@ -118,7 +118,7 @@ address. Defaults to :SESSION."
(bytes (read-sequence buf stream)))
(assert (= length bytes))
(assert (zerop (dbus-read-byte stream)))
- (sb-ext:octets-to-string buf :external-format :utf8)))
+ (babel:octets-to-string buf :encoding :utf-8)))
;;; Message type
(defconstant +method-call+ 1)
2  transport.lisp
@@ -33,7 +33,7 @@ hex-digits. Returns the unescaped string."
"Got non-digits (~A ~A) after escape char..." digit1 digit2)
(vector-push-extend (logior (ash digit1 4) digit2) output)))
(t (vector-push-extend (char-code char) output)))
- (finally (return (sb-ext:octets-to-string output :external-format :utf8))))))
+ (finally (return (babel:octets-to-string output :encoding :utf-8))))))
(defun parse-key-value-string (kv-string)
"Parse a DBUS address key-value pair (foo=bar) taking care of the
19 utilities.lisp
@@ -21,7 +21,7 @@
(string-downcase (format nil "~{~2,'0X~}" (coerce octets 'list))))
(defun string-to-hex-string (string)
- (octets-to-hex-string (sb-ext:string-to-octets string :external-format :ascii)))
+ (octets-to-hex-string (babel:string-to-octets string :encoding :ascii)))
;;; Hex string handling
@@ -46,4 +46,21 @@
(dc (1+ (* out-pos 2)))))))
(finally (return output)) ))
+;; From UFFI via CFFI
+(defun getenv (var)
+ #+allegro (sys::getenv (string var))
+ #+clisp (sys::getenv (string var))
+ #+(or cmu scl) (cdr (assoc (string var) ext:*environment-list* :test #'equalp
+ :key #'string))
+ #+gcl (si:getenv (string var))
+ #+lispworks (lw:environment-variable (string var))
+ #+lucid (lcl:environment-variable (string var))
+ #+(or mcl ccl) (ccl::getenv var)
+ #+sbcl (sb-ext:posix-getenv var)
+ #-(or allegro clisp cmu scl gcl lispworks lucid mcl ccl sbcl)
+ (error "error getenv not implemented"))
;;; EOF

0 comments on commit 98ef247

Please sign in to comment.
Something went wrong with that request. Please try again.