[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/2] ios: Introduce IO stream device for stdin, stdout, stder
From: |
Jose E. Marchesi |
Subject: |
Re: [PATCH 2/2] ios: Introduce IO stream device for stdin, stdout, stderr. |
Date: |
Sun, 10 May 2020 20:10:43 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Hi Ege!
Super nice stuff! Thanks to this we will have support for writing poke
filters and much more :)
Before reviewing more in deep, I have a comment:
+ if (!strcmp (handler, "stdin"))
+ {
+ sio->file = stdin;
+ sio->flags = IOS_F_READ;
+ }
+ else if (!strcmp (handler, "stdout"))
+ {
+ sio->file = stdout;
+ sio->flags = IOS_F_WRITE;
+ }
+ else if (!strcmp (handler, "stderr"))
+ {
+ sio->file = stderr;
+ sio->flags = IOS_F_WRITE;
+ }
I always had the idea that the IO spaces 0, 1 and 2 would exist by
default, i.e. ios_init would actually open these streams and make them
available as IOS 0 (for stdin) 1 (for stdout) and 2 (for stderr).
We will of course define variables in the standard library, for the
user's commodity:
defvar stdin = 0;
defvar stdout = 1;
defvar stderr = 2;
A good outcome of this approach is that "stdin", "stdout" and "stderr"
won't be special handlers anymore, i.e. you could open a perfectly
regular file called "stdout" for example.
- [PATCH 1/2] ios: Introduce ios_flush and ios_dev_<...>_flush., Egeyar Bagcioglu, 2020/05/10
- [PATCH 2/2] ios: Introduce IO stream device for stdin, stdout, stderr., Egeyar Bagcioglu, 2020/05/10
- Re: [PATCH 2/2] ios: Introduce IO stream device for stdin, stdout, stderr.,
Jose E. Marchesi <=
- Re: [PATCH 2/2] ios: Introduce IO stream device for stdin, stdout, stderr., Jose E. Marchesi, 2020/05/10
- Re: [PATCH 2/2] ios: Introduce IO stream device for stdin, stdout, stderr., Jose E. Marchesi, 2020/05/10
- Re: [PATCH 1/2] ios: Introduce ios_flush and ios_dev_<...>_flush., Jose E. Marchesi, 2020/05/10