comp.lang.ada
 help / color / mirror / Atom feed
From: Keith Thompson <Keith.S.Thompson+u@gmail.com>
Subject: Re: How to test if file = Ada.Text_IO.Standard_Input ?
Date: Sun, 24 Oct 2021 13:51:09 -0700	[thread overview]
Message-ID: <87fssq2lky.fsf@nosuchdomain.example.com> (raw)
In-Reply-To: sl0npe$c7c$1@dont-email.me

"Jeffrey R.Carter" <spam.jrcarter.not@spam.acm.org.not> writes:
> On 10/23/21 10:06, reinert wrote:
>> So how can I test if "file1" referes to the terminal using the
>> lastest GNAT Community Edition?
>
> Have you tried
>
> Ada.Text_IO.Name (File1) = Ada.Text_IO.Name (Ada.Text_IO.Standard_Input)
>
> ? (I haven't.)

That might well serve reinert's needs, but strictly speaking it doesn't
tell you whether File1 refers to the terminal.  At best it might tell
you whether File1 and Standard_Input refer to the same external file --
which may not even be a terminal if standard input was redirected.

GNAT apparently uses "*stdin" as the Name of Standard_Input, regardless
of what actual file it refers to.  There could be an actual file with
that name.  It's not likely, but it means that this method could be
broken maliciously.

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Philips
void Void(void) { Void(); } /* The recursive call of the void */

      parent reply	other threads:[~2021-10-24 20:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-23  8:06 How to test if file = Ada.Text_IO.Standard_Input ? reinert
2021-10-23 10:22 ` Jeffrey R.Carter
2021-10-23 12:28   ` reinert
2021-10-23 15:40     ` Gautier write-only address
2021-10-24 20:51   ` Keith Thompson [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox