src/streams.lisp @ 1364eb7e452b

Add utilities from the past few months
author Steve Losh <steve@stevelosh.com>
date Tue, 11 Nov 2025 14:33:47 -0500
parents 443af0e76dd6
children (none)
(in-package :losh.streams)

(defmacro with-eof-handled ((stream eof-error-p eof-value) &body body)
  (alexandria:once-only (stream eof-error-p eof-value)
    `(if (null (peek-char nil ,stream nil))
       (if ,eof-error-p
         (error 'end-of-file)
         ,eof-value)
       (progn ,@body))))