Dear Anthony,

Gotta try it.

It it up on the dreaded github?

Regards,

Paul

On Sat, Jan 6, 2024 at 7:54 PM Anthony Carrico <[email protected]> wrote:
>
> On 1/5/24 19:24, Joe Golden wrote:
> > You rock Anthony.  Thanx for keeping the dream alive.
> >
> > The list is not dead!!
> >
> > Happy new year Geeks.
>
> Thanks Joe! Happy New Year.
>
> How to test this program? How do you run a program on a terminal
> emulator that isn't the ctty?
>
> I can't figure out how to do this with a clean xterm. I think you use
> the -Sccn option, but I don't exactly understand that option, so I cheat
> and just hijack another terminal running another shell:
>
> terminal-1-$ ./a.out
> /proc/self/stat ctty dev is 136 7
> /dev/tty dev is 5 0
> 0 is the ctty called /dev/pts/7 device ID 136 7
> 1 is the ctty called /dev/pts/7 device ID 136 7
> 2 is the ctty called /dev/pts/7 device ID 136 7
> 3 is the ctty called /dev/tty device ID 5 0
>
> OK. Leave that open and let's hijack that terminal emulator by opening
> /dev/pts/7.
>
> Open another terminal (I'm xfce4-term for these terminals) and do this:
>
> terminal-2-$ ./a.out 1>/dev/pts/7
>
> Notice I got no output, since I redirected the output to /dev/pts/7.
>
> But look at the original terminal, and you'll see this:
>
> terminal-1-$
> /proc/self/stat ctty dev is 136 1
> /dev/tty dev is 5 0
> 0 is the ctty called /dev/pts/1 device ID 136 1
> 1 is a tty called /dev/pts/7 device ID 136 7
> 2 is the ctty called /dev/pts/1 device ID 136 1
> 3 is the ctty called /dev/tty device ID 5 0
>
> Notice that fd 1 is listed as "a tty" not "the ctty".
>
> This test shows that my program is actually detecting which fds are
> connected to the ctty vs. some random other tty. That was my original
> goal, so it is working.
>
> Question: Anyone know how xterm -S works, or other ways to open terminal
> emulators (without running a shell inside them) to use with your
> commands? I said terminal emulator, so please don't say, "hook up real
> terminal to a serial port".
>
> --
> Anthony Carrico

Reply via email to