elks-enhanced
public
Read
Owner: themaster
Branch: master
Commits: 6893
Updated: 2026-04-19 00:15
Git CLI clone URL
git clone https://www.xt-emporium.com/git/elks-enhanced.git
Fullscreen desktop URL
Code
Commits
History
Branches
Bug Reports
Discussions
Compare
Settings
elks-enhanced
/
elkscmd
/
sys_utils
/
console.c
File editor
/* * Set console device */ #include <stdio.h> #include <unistd.h> #include <fcntl.h> #include <termios.h> #include <sys/stat.h> #include <sys/ioctl.h> #define errmsg(str) write(STDERR_FILENO, str, sizeof(str) - 1) int main(int argc, char **argv) { int fd; struct stat statbuf; if (argc != 2) { errmsg("usage: console </dev/ttyXX>\n"); return 1; } if ((fd = open(argv[1], O_RDWR)) < 0) { perror(argv[1]); return 1; } if (fstat(fd, &statbuf) < 0) { perror("fstat"); return 1; } if (ioctl(fd, TIOSETCONSOLE, &statbuf.st_rdev) != 0) { perror(argv[1]); return 1; } close(fd); return 0; }
Commit message
This repository is read-only for this account.
Repository snapshot
Current branch
master
Visibility
public
Your access
Read
Remote
Configured
File activity
View file history