Merge branch 'master' of git+ssh://repo.or.cz/srv/git/fbsplash
[fbsplash.git] / misc / fbtruetype / console.c
blob03ee989ed194ba026f0084a8ba0a09069bd12b1d
1 /*
2 * fbmngplay - framebuffer console MNG player.
3 * (c) 2001-2002 by Stefan Reinauer, <stepan@suse.de>
4 *
5 * This program is based on mngplay, part of libmng, written and (C) by
6 * Ralph Giles <giles@ashlu.bc.ca>
8 * This program my be redistributed under the terms of the
9 * GNU General Public Licence, version 2, or at your preference,
10 * any later version.
13 #include <stdio.h>
14 #include <stdlib.h>
15 #include <unistd.h>
16 #include <fcntl.h>
17 #include <errno.h>
18 #include <linux/kd.h>
19 #include <linux/vt.h>
20 #include <sys/ioctl.h>
22 #include "console.h"
24 int start_console = 0;
25 int fd;
27 int current_console(void)
29 int result=0;
30 char twelve=12;
32 result = ioctl(fd, TIOCLINUX, &twelve);
34 return result;
37 void init_consoles(void)
39 fd=open("/dev/vc/0", O_RDWR|O_NDELAY);
40 if (fd<0) {
41 fd=open("/dev/tty0", O_RDWR|O_NDELAY);
42 if (fd<0) {
43 fprintf(stderr, "Could not open virtual terminal.\n");
44 exit (1);