/* keystuffer quick and dirty for blue v1.1
* (C) 2024 Pegasus Epsilon <pegasus@pimpninjas.org>
*/
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <sys/ioctl.h>
int main (int argc, char **argv) {
if (3 != argc) {
printf("Usage: %s /dev/ttyN [command]\n", argv[0]);
return -2;
}
int fd = open(argv[1], O_RDWR);
if (0 > fd) {
perror(argv[1]);
return -1;
}
while (*argv[2])
if (-1 == ioctl(fd, TIOCSTI, argv[2]++)) perror("ioctl()");
if (-1 == ioctl(fd, TIOCSTI, "\n")) perror("ioctl()");
return 0;
}