zopencommunity / nanoport

A simple text editor for console environments
Apache License 2.0
0 stars 3 forks source link

Standard input via '-' not working #8

Closed ijmitch closed 8 months ago

ijmitch commented 8 months ago

https://www.nano-editor.org/dist/latest/nano.1.html says:

As a special case: if instead of a filename a dash (-) is given, nano will read data from standard input.

But I get:

:>echo "foo" | nano -
Standard input is not a terminal
mfsysprog commented 8 months ago

I can reproduce the issue, investigating

mfsysprog commented 8 months ago

File nano.c will try to open /dev/stdin, which is non existent on omvs. If we change this to /dev/fd0 it works. Patch below will fix this issue. Working on integrating it into formal patch.

diff --git a/src/nano.c b/src/nano.c
index 091d3ca..728b8be 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -857,7 +857,7 @@ bool scoop_stdin(void)
                                                        "type ^D or ^D^D to finish.\n"));

        /* Open standard input. */
-       stream = fopen("/dev/stdin", "rb");
+       stream = fopen("/dev/fd0", "rb");
        if (stream == NULL) {
                int errnumber = errno;
mfsysprog commented 8 months ago

fixed in https://github.com/ZOSOpenTools/nanoport/releases/tag/STABLE_nanoport_2184