Send input str direct to tty

Submitted by lepton on Fri, 07/10/2020 - 13:16

//simulate terminal input

#include <sys/ioctl.h>
#include <termios.h>
#include <stdio.h>
#include <stdlib.h>

 

void stackchar(char c) {
    if (ioctl(0, TIOCSTI, &c) < 0) {
        perror("ioctl");
        exit(1);
    }
}
int main(int argc, char *argv[]) {
    char *str=argv[1];
    int len=(int)strlen(str);
    for (int i=0; i<len; i++) {
        stackchar(str[i]);
    }
    stackchar('\n');
    return 0;;
}

Comments

GreFouse (not verified)

Thu, 05/19/2022 - 19:37

{List|List} of the {best|leading} football {clubs|teams} {planet|world} {would|be} {incomplete|stripped down} without {Real Madrid|Galacticos}. {FIFA|International organizations} {recognized|named} {specified|this} squad as the leader of football {of the last century|of the last century}.{Recently|Now} {aid|support} works {locally|addressed}. {Team|Club} {strives|attempts to} {transfer funds|help} {personally|people in need}.{"Old Signora"| {"Juventus"} {appeared|originated} in 1897. {Club|Roster} {considered|became} {most|most} {titled|successful}. About {achievements|awards} {you can talk | it will be possible to talk} {long|hours}. {In 2012|In the early 2010s} the {team|club} was {recognised|named} as the {most|most} {famous|famous} {in Italy|among Italians}.{Club|Team} {appeared in the list|featured} {thanks to|because of} the {current|today} situation. {Team|Roster} {confidently|steady} {shows|shows} {excellent|excellent} results. bets10 bedava bahis sartlar? 2. Selection.Roster never didn't drop from the Spanish championship. Independent assessors name Real Madrid the most expensive club in the world. Approximate price at the time of study reached 4.2 billion USD.Annual income decent. Squad earns on resale of players, advertising, sponsors. Impressive part of earnings is sale tickets for matches.3. Tactics of action.

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.