[][src]Crate ttyecho

ttyecho is a crate that lets you write data into a Linux kernel pseudoterminal buffer. This crate will not work on a non-Linux platform.

Example

fn main() {
    // You can put whatever you want, not only commands.
    let command = "echo ttyecho!";
    // Target tty 
    let tty = "/dev/pts/27";
    // We want to append new line as we want to run echo without user interaction.
    let append_new_line = true;
     
    ttyecho(tty, command, append_new_line);
}

Functions

ttyecho

Appends given data into given pseudoterminal buffer by using ioctl syscall with TIOCSTI parameter. It will append a null terminator to the tty path if there isn't one, because most libc functions expect strings to be null terminated.