Logo 
Search:

Networking Articles

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

TCP/IP program to initialize tty modes for script file collection

Posted By: Milind Mishra     Category: Networking     Views: 1778

TCP/IP program to initialize tty modes for script file collection.

Code for TCP/IP program to initialize tty modes for script file collection in Networking

#include <termios.h>
#include <string.h>
#include <stdio.h>
#include "telnet.h"
#include "local.h"externint        scrindex;
externstruct termios    tntty;

/*ARGSUSED*/int
scrinit(FILE *sfp, FILE *tfp, int c)
{
    struct termios    newtty;

    if (!doecho) {
        fprintf(tfp, "\nscripting requires remote ECHO.\n");
        return -1;
    }
    if (scrfp) {
        fprintf(tfp,"\nalready scripting to \"%s\".\n", scrname);
        return -1;
    }
    scrindex = 0;

    if (tcgetattr(0, &tntty))    /* save current tty settings    */
        errexit("can't get tty modes: %s\n", strerror(errno));

    newtty = oldtty;
    newtty.c_cc[VINTR] = _POSIX_VDISABLE;    /* disable interrupt    */
    newtty.c_cc[VQUIT] = _POSIX_VDISABLE;    /* disable interrupt    */
    newtty.c_cc[VSUSP] = _POSIX_VDISABLE;    /* disable suspend    */
    newtty.c_cc[VDSUSP] = _POSIX_VDISABLE;    /* disable suspend    */if (tcsetattr(0, TCSADRAIN, &newtty))
        errexit("can't set tty modes: %s\n", strerror(errno));

    fprintf(tfp, "\nscript file: ");
    (void) fflush(tfp);
    return 0;
}
  
Share: 



Milind Mishra
Milind Mishra author of TCP/IP program to initialize tty modes for script file collection 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!