emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: read a reply from the terminal


From: Johan Bockgård
Subject: Re: read a reply from the terminal
Date: Mon, 16 Jul 2007 21:46:59 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.1.50 (gnu/linux)

Eli Zaretskii <address@hidden> writes:

> The terminal can be addressed by name (its device driver name,
> something like "/dev/tty1"), right?  If so, you can read from that
> device as if it were a file.  insert-file-contents is a way to read
> from files, and it supports reading a certain number of bytes.

Ok. But it does not support reading a specified number of bytes when
the file is non-regular. (It would be useful if it could.)

  if (!S_ISREG (st.st_mode))
    {
      not_regular = 1;
      [...]
      if (! NILP (replace) || ! NILP (beg) || ! NILP (end))
      xsignal2 (Qfile_error,
                 build_string ("not a regular file"), orig_filename);
    }

The manual says

     It is possible to read a special file (such as a FIFO or an I/O
     device) with `insert-file-contents', as long as REPLACE and VISIT
     are `nil'.

It should be added that BEG and END have to be nil as well, or someone
might want to improve the code.

-- 
Johan Bockgård





reply via email to

[Prev in Thread] Current Thread [Next in Thread]