Logo 
Search:

Networking Articles

Submit Article
Home » Articles » Networking » TCP/IPRSS Feeds

TCP/IP program to set up tty

Posted By: Milind Mishra     Category: Networking     Views: 2355

TCP/IP program to set up tty.

Code for TCP/IP program to set up tty in Networking

#include <termios.h>
#include <stdio.h>
#include <string.h>

#include "local.h"/*------------------------------------------------------------------------ * ttysetup - set up tty *------------------------------------------------------------------------ */int
ttysetup(void)
{
    externstruct termios    tntty;

    if (tcgetattr(0, &oldtty) < 0)    /* save original tty state    */
        errexit("can't get tty modes: %s\n", strerror(errno));

    sg_erase = oldtty.c_cc[VERASE];
    sg_kill = oldtty.c_cc[VKILL];
    t_intrc = oldtty.c_cc[VINTR];
    t_quitc = oldtty.c_cc[VQUIT];
    t_flushc = oldtty.c_cc[VDISCARD];

    tntty = oldtty;        /* make a copy to change    *//* disable some special characters */
    tntty.c_cc[VINTR] = _POSIX_VDISABLE;
    tntty.c_cc[VQUIT] = _POSIX_VDISABLE;
    tntty.c_cc[VSUSP] = _POSIX_VDISABLE;
    tntty.c_cc[VDSUSP] = _POSIX_VDISABLE;

    if (tcsetattr(0, TCSADRAIN, &tntty) < 0)
        errexit("can't set tty modes: %s\n", strerror(errno));
}
  
Share: 


Didn't find what you were looking for? Find more on TCP/IP program to set up tty Or get search suggestion and latest updates.

Milind Mishra
Milind Mishra author of TCP/IP program to set up tty is from India.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!