Re: bug in read-lines: skips empty lines

Yann LeCun <[email protected]> Mon, 13 Feb 2006 12:18:49 -0500
Newsgroups gmane.lisp.lush.devel
Organization Courant Institute, NYU
Message-ID <[email protected]>
Indeed. Thanks. Fixed in CVS.

  -- Yann

On Monday 13 February 2006 12:10 pm, Ralf Juengling wrote:
> read-lines should return an empty string for an empty line.
> Here is a fix that works on a unix platform:
>
> --- orig/lsh/libc/shell.lsh
> +++ mod/lsh/libc/shell.lsh
> @@ -75,8 +75,9 @@
>   (de read-lines(f)
>     (reading f
>       (let ((ans ()))
> -      (while (<> (skip-char "\n\r\f") "\e")
> -        (setq ans (cons (read-string) ans)))
> +      (while (<> (skip-char "") "\e")
> +        (setq ans (cons (read-string) ans))
> +       (read-string 1)) ;; need a function 'read-newline' here
>         (reverse ans))))
>
> Ralf



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642