Skip to content
Snippets Groups Projects
Commit 82efc2a4 authored by Francois-Rene Rideau's avatar Francois-Rene Rideau
Browse files

Oops, the standard names for #\cr and #\newline are #\Return and #\Linefeed respectively.

Also, don't use *earmuffs*, but a $ prefix for $cr, $lf, $crlf,
for these are not "variables" but "constants",
except that defconstant won't work portably on strings, so no +glitter+.
parent bfca2e78
No related branches found
No related tags found
No related merge requests found
...@@ -254,9 +254,9 @@ starting the separation from the end, e.g. when called with arguments ...@@ -254,9 +254,9 @@ starting the separation from the end, e.g. when called with arguments
(incf words) (incf words)
(setf end start)))))) (setf end start))))))
(defvar *cr* (coerce #(#\cr) 'string)) (defvar $cr (coerce #(#\Return) 'string))
(defvar *lf* (coerce #(#\newline) 'string)) (defvar $lf (coerce #(#\Linefeed) 'string))
(defvar *crlf* (coerce #(#\cr #\newline) 'string)) (defvar $crlf (coerce #(#\Return #\Linefeed) 'string))
(defun stripln (x) (defun stripln (x)
"Strip a string X from any ending CR, LF or CRLF. "Strip a string X from any ending CR, LF or CRLF.
...@@ -267,9 +267,9 @@ Return two values, the stripped string and the strip that was stripped" ...@@ -267,9 +267,9 @@ Return two values, the stripped string and the strip that was stripped"
(endcrlfp (and endlfp (<= 2 len) (eql (char x (- len 2)) #\return))) (endcrlfp (and endlfp (<= 2 len) (eql (char x (- len 2)) #\return)))
(endcrp (equal (last-char x) #\return))) (endcrp (equal (last-char x) #\return)))
(cond (cond
(endlfp (values (subseq x 0 (- len 1)) *lf*)) (endlfp (values (subseq x 0 (- len 1)) $lf))
(endcrp (values (subseq x 0 (- len 1)) *cr*)) (endcrp (values (subseq x 0 (- len 1)) $cr))
(endcrlfp (values (subseq x 0 (- len 2)) *crlf*)) (endcrlfp (values (subseq x 0 (- len 2)) $crlf))
(t (values x nil))))) (t (values x nil)))))
(defun string-prefix-p (prefix string) (defun string-prefix-p (prefix string)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment