* Terminal Control (or System calls), unix @ 1999-04-01 0:00 Sven E. Anderson 1999-04-02 0:00 ` Thomas Handler 1999-04-02 0:00 ` dennison 0 siblings, 2 replies; 7+ messages in thread From: Sven E. Anderson @ 1999-04-01 0:00 UTC (permalink / raw) 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? I take it that Ada does not have the equivalent of C's curses package. -sven anderson@cs.und.edu ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Terminal Control (or System calls), unix 1999-04-01 0:00 Terminal Control (or System calls), unix Sven E. Anderson @ 1999-04-02 0:00 ` Thomas Handler 1999-04-02 0:00 ` dennison 1 sibling, 0 replies; 7+ messages in thread From: Thomas Handler @ 1999-04-02 0:00 UTC (permalink / raw) Sven, Sven E. Anderson wrote: > > > I take it that Ada does not have the equivalent of C's curses package. > I guess you're not right on this one. As far as I remember J. Pfeiffer made an Ada binding for ncurses that is distributed as part of all newer ncurses versions. You might take a look at this one since it comes with two or three examples that show you how to use it. Thomas Handler ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Terminal Control (or System calls), unix 1999-04-01 0:00 Terminal Control (or System calls), unix Sven E. Anderson 1999-04-02 0:00 ` Thomas Handler @ 1999-04-02 0:00 ` dennison 1999-04-03 0:00 ` Jerry van Dijk 1 sibling, 1 reply; 7+ messages in thread From: dennison @ 1999-04-02 0:00 UTC (permalink / raw) In article <3703F011.1DBB143C@cs.und.edu>, "Sven E. Anderson" <anderson@cs.und.edu> wrote: > 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? > I take it that Ada does not have the equivalent of C's curses package. If your platform has curses, you should be able to write bindings to the curses functions you want to use and link in libcurses.a. The curses routines are just library calls that can be made from any language that knows how to link to them. It just happens that most people use C to do that, but it doesn't have to be that way. T.E.D. -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Terminal Control (or System calls), unix 1999-04-02 0:00 ` dennison @ 1999-04-03 0:00 ` Jerry van Dijk 1999-04-05 0:00 ` dennison 0 siblings, 1 reply; 7+ messages in thread From: Jerry van Dijk @ 1999-04-03 0:00 UTC (permalink / raw) 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 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Terminal Control (or System calls), unix 1999-04-03 0:00 ` Jerry van Dijk @ 1999-04-05 0:00 ` dennison 1999-04-05 0:00 ` dennison 0 siblings, 1 reply; 7+ messages in thread From: dennison @ 1999-04-05 0:00 UTC (permalink / raw) In article <F9LA0u.4w@jvdsys.stuyts.nl>, jerry@jvdsys.stuyts.nl (Jerry van Dijk) wrote: > 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 :-) Appreciated. :-) > > : 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: > > 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; I suppose. But don't you have to worry that the person executing your program might have a default shell on which stty behaves differently (or does not exist)? T.E.D. -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Terminal Control (or System calls), unix 1999-04-05 0:00 ` dennison @ 1999-04-05 0:00 ` dennison 1999-04-05 0:00 ` Tarjei Tj�stheim Jensen 0 siblings, 1 reply; 7+ messages in thread From: dennison @ 1999-04-05 0:00 UTC (permalink / raw) In article <7eaf43$mk2$1@nnrp1.dejanews.com>, dennison@telepath.com wrote: > In article <F9LA0u.4w@jvdsys.stuyts.nl>, > jerry@jvdsys.stuyts.nl (Jerry van Dijk) wrote: > > dennison@telepath.com wrote: > > > > : 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: > > I suppose. But don't you have to worry that the person executing your program > might have a default shell on which stty behaves differently (or does not > exist)? OK. I just went and checked. For the two unixes I tried (AIX 4.2 and SunOS 5.3) stty is *not* a shell builtin; it is a command. So Ted, you're an idiot. (Wow, flaming me is fun. No wonder so many do it. :-) Also, it appears stty changes apply to a parent shell when I invoke it from a child shell, so I suspect the "system" call method would do the trick. However, since the original poster seemed to really want "curses" functionality, I'd suggest they go ahead and use curses to aviod frustration on further functionalty during the rest of the implementation process. If they only need a few curses functions, writing a small number of "thick" bindings by hand is really no trouble. If they want a lot, there are thin bindings (and thin binding generators) out there. T.E.D. -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Terminal Control (or System calls), unix 1999-04-05 0:00 ` dennison @ 1999-04-05 0:00 ` Tarjei Tj�stheim Jensen 0 siblings, 0 replies; 7+ messages in thread From: Tarjei Tj�stheim Jensen @ 1999-04-05 0:00 UTC (permalink / raw) dennison@telepath.com wrote: > > I suppose. But don't you have to worry that the person executing your program > > might have a default shell on which stty behaves differently (or does not > > exist)? > > OK. I just went and checked. For the two unixes I tried (AIX 4.2 and SunOS > 5.3) stty is *not* a shell builtin; it is a command. So Ted, you're an idiot. > (Wow, flaming me is fun. No wonder so many do it. :-) > > Also, it appears stty changes apply to a parent shell when I invoke it from a > child shell, so I suspect the "system" call method would do the trick. There are portable ways of doing this without invoking a separate program. There are a couple of Posix calls to do this. The easiest way of finding out how to do this is to look up the metods in various Perl FAQs. That is where I found the answer to it last time I looked (or was it the Perl book). Use the Posix interface so that context can be saved and restored easily without depending on the arcane syntax of stty. Greetings, ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~1999-04-05 0:00 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 1999-04-01 0:00 Terminal Control (or System calls), unix Sven E. Anderson 1999-04-02 0:00 ` Thomas Handler 1999-04-02 0:00 ` dennison 1999-04-03 0:00 ` Jerry van Dijk 1999-04-05 0:00 ` dennison 1999-04-05 0:00 ` dennison 1999-04-05 0:00 ` Tarjei Tj�stheim Jensen
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox