From: jerry@jvdsys.stuyts.nl (Jerry van Dijk)
Subject: Re: Terminal Control (or System calls), unix
Date: 1999/04/03
Date: 1999-04-03T00:00:00+00:00 [thread overview]
Message-ID: <F9LA0u.4w@jvdsys.stuyts.nl> (raw)
In-Reply-To: 7e2rp3$kvf$1@nnrp1.dejanews.com
dennison@telepath.com wrote:
: In article <3703F011.1DBB143C@cs.und.edu>,
: "Sven E. Anderson" <anderson@cs.und.edu> wrote:
(note I careful I am about the attributions :-)
: > I am attempting to write a simple screen editor with Ada95 and would
: > like to suppress the tty echo (unix/linux). A very simple solution
: > would be a system call to "stty -echo cbreak". How might I make such
: > a call in Ada?
: If its a system call, you should be able to make it from Ada. However I think
: stty is typically a shell builtin, isn't it?
That does not matter, on Linux, you could use something like:
with System;
procedure No_Echo is
type Echo_Type is (On, Off);
procedure Set_Echo (Echo : in Echo_Type) is
procedure Execute (S : in String) is
procedure System (S : in System.Address);
pragma Import (C, System, "system");
C_String : constant String := S & ASCII.NUL;
begin
System (C_String'Address);
end Execute;
pragma Inline (Execute);
begin
if Echo = On then
Execute ("stty -echo cbreak");
else
Execute ("stty echo");
end if;
end Set_Echo;
begin
null;
end No_Echo;
--
-- Jerry van Dijk | Leiden, Holland
-- Team Ada | jdijk@acm.org
-- see http://stad.dsl.nl/~jvandyk
next prev parent reply other threads:[~1999-04-03 0:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-04-01 0:00 Terminal Control (or System calls), unix Sven E. Anderson
1999-04-02 0:00 ` dennison
1999-04-03 0:00 ` Jerry van Dijk [this message]
1999-04-05 0:00 ` dennison
1999-04-05 0:00 ` dennison
1999-04-05 0:00 ` Tarjei Tj�stheim Jensen
1999-04-02 0:00 ` Thomas Handler
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox