kiwi-el8/tools/isconsole.c
Marcus Schäfer 8c60ef66c5
Move all build and install tasks to setup.py
In an effort to distribute kiwi on pypi it should not be
required to call make targets for a complete installation.
Therefore the compilation of the C tools as well as the
installation of the man pages and the bash completion
has been added to setup.py. The spec file to build an rpm
package has been changed to use setup.py exclusively
2016-05-30 19:07:49 +02:00

26 lines
502 B
C

#include <stdio.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <linux/kd.h>
#include <unistd.h>
#include <errno.h>
int main (void) {
int mode = 0;
int status;
int tty = open( "/dev/console", O_RDONLY );
if (tty < 0) {
// failed to open device
return 1;
}
status = ioctl( tty, KDGETMODE, &mode );
close (tty);
if (status != 0) {
// ioctl returned error
return 1;
}
return 0;
}