<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <HTML> <HEAD> <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9"> <TITLE> {The S-lang C Library Reference}: SLang_init_tty</TITLE> <LINK HREF="cref-109.html" REL=next> <LINK HREF="cref-107.html" REL=previous> <LINK HREF="cref.html#toc108" REL=contents> </HEAD> <BODY> <A HREF="cref-109.html">Next</A> <A HREF="cref-107.html">Previous</A> <A HREF="cref.html#toc108">Contents</A> <HR> <H2><A NAME="SLang_init_tty"></A> <A NAME="s108">108. <B>SLang_init_tty</B></A></H2> <P> <DL> <DT><B> Synopsis </B><DD><P>Initialize the terminal keyboard interface <DT><B> Usage </B><DD><P><CODE>int SLang_init_tty (int intr_ch, int no_flow_ctrl, int opost)</CODE> <DT><B> Description </B><DD><P><CODE>SLang_init_tty</CODE> initializes the terminal for single character input. If the first parameter <CODE>intr_ch</CODE> is in the range 0-255, it will be used as the interrupt character, e.g., under Unix this character will generate a <CODE>SIGINT</CODE> signal. Otherwise, if it is <CODE>-1</CODE>, the interrupt character will be left unchanged. <P>If the second parameter <CODE>no_flow_ctrl</CODE> is non-zero, flow control (<CODE>XON</CODE>/<CODE>XOFF</CODE>) processing will be enabled. <P>If the last parmeter <CODE>opost</CODE> is non-zero, output processing by the terminal will be enabled. If one intends to use this function in conjunction with the <B>S-lang</B> screen management routines (<CODE>SLsmg</CODE>), this paramete shold be set to zero. <P><CODE>SLang_init_tty</CODE> returns zero upon success, or <CODE>-1</CODE> upon error. <DT><B> Notes </B><DD><P>Terminal I/O is a complex subject. The <B>S-lang</B> interface presents a simplification that the author has found useful in practice. For example, the only special character processing that <CODE>SLang_init_tty</CODE> enables is that of the <CODE>SIGINT</CODE> character, and the generation of other signals via the keyboard is disabled. However, generation of the job control signal <CODE>SIGTSTP</CODE> is possible via the <CODE>SLtty_set_suspend_state</CODE> function. <P>Under Unix, the integer variable <CODE>SLang_TT_Read_FD</CODE> is used to specify the input descriptor for the terminal. If <CODE>SLang_TT_Read_FD</CODE> represents a terminal device as determined via the <CODE>isatty</CODE> system call, then it will be used as the terminal file descriptor. Otherwise, the terminal device <CODE>/dev/tty</CODE> will used as the input device. The default value of <CODE>SLang_TT_Read_FD</CODE> is <CODE>-1</CODE> which causes <CODE>/dev/tty</CODE> to be used. So, if you prefer to use <CODE>stdin</CODE> for input, then set <CODE>SLang_TT_Read_FD</CODE> to <CODE>fileno(stdin)</CODE> <EM>before</EM> calling <CODE>SLang_init_tty</CODE>. <P>If the variable <CODE>SLang_TT_Baud_Rate</CODE> is zero when this function is called, the function will attempt to determine the baud rate by querying the terminal driver and set <CODE>SLang_TT_Baud_Rate</CODE> to that value. <DT><B> See Also </B><DD><P><CODE>SLang_reset_tty, SLang_getkey, SLtty_set_suspend_state</CODE> </DL> <P> <P> <P> <HR> <A HREF="cref-109.html">Next</A> <A HREF="cref-107.html">Previous</A> <A HREF="cref.html#toc108">Contents</A> </BODY> </HTML>