diff -uarN kon2-0.3.9b.orig/src/main.c kon2-0.3.9b/src/main.c --- kon2-0.3.9b.orig/src/main.c Sun Apr 9 10:06:14 2000 +++ kon2-0.3.9b/src/main.c Wed Jun 21 01:20:21 2000 @@ -30,15 +30,39 @@ #include <stdio.h> #include <stdlib.h> #include <unistd.h> +#include <sys/stat.h> +#include <sys/sysmacros.h> +#if defined(linux) +#include <linux/major.h> +#endif #include <getcap.h> #include <version.h> #include <term.h> +int +check_tty () +{ + struct stat device_stat; + + if (stat(ttyname(STDIN_FILENO), &device_stat) == -1) + return -1; + if (major(device_stat.st_rdev) != TTY_MAJOR) + return -1; + + return 0; +} + void main(int argc, const char *argv[]) { + + if (check_tty ()) { + fprintf(stderr, "You can run this Kon at only console terminal.\n"); + exit(EXIT_FAILURE); + } + #ifdef MINI_KON fprintf(stderr, "Kanji ON Console MINI " VERSION "\n\n"); #else