From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-74-118.ec2.internal X-Spam-Level: * X-Spam-Status: No, score=1.8 required=3.0 tests=BAYES_50,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.6 Path: eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.ada Subject: Re: How to test if file = Ada.Text_IO.Standard_Input ? Date: Sun, 24 Oct 2021 13:51:09 -0700 Organization: None to speak of Message-ID: <87fssq2lky.fsf@nosuchdomain.example.com> References: <93df825f-5c18-4a02-a399-74c7ee7cf784n@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="dc53845975de92cdf23a501c594f45fc"; logging-data="29016"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+wi94TkgGBL9gIHFjCcxy5" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) Cancel-Lock: sha1:INk1Fb34XgFtFXZz++bjMkRAA5k= sha1:yeoHN1h3h1KbT9Gyy4SBx96gsv4= Xref: reader02.eternal-september.org comp.lang.ada:63077 List-Id: "Jeffrey R.Carter" 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 */