Skip to content

Commit

Permalink
Extracts starts-with function.
Browse files Browse the repository at this point in the history
  • Loading branch information
ralt committed Sep 28, 2015
1 parent 2fadf65 commit 78bd812
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions daemon/can-login.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,14 @@
(remove-if-not #'is-storage-device
(cl-fad:list-directory *devices-folder*)))))

(defun starts-with (string other-string)
(string= (subseq string 0 (length other-string)) other-string))

(defun is-storage-device (path)
(let ((file (pathname-name path)))
(when (and file (> (length file) 2))
(string= (subseq file 0 2) *storage-device-prefix*))))
(and file
(> (length file) 2)
(starts-with file *storage-device-prefix*))))

(defun is-hermes-device (path)
(and (is-block-device path)
Expand Down

0 comments on commit 78bd812

Please sign in to comment.