|
Revision 2, 0.8 kB
(checked in by nextime, 2 years ago)
|
Initial import, branching from morphix svn
|
| Line | |
|---|
| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 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> |
|---|
| 21 |
|
|---|
| 22 |
#include "console.h" |
|---|
| 23 |
|
|---|
| 24 |
int start_console = 0; |
|---|
| 25 |
int fd; |
|---|
| 26 |
|
|---|
| 27 |
int current_console(void) |
|---|
| 28 |
{ |
|---|
| 29 |
int result=0; |
|---|
| 30 |
char twelve=12; |
|---|
| 31 |
|
|---|
| 32 |
result = ioctl(fd, TIOCLINUX, &twelve); |
|---|
| 33 |
|
|---|
| 34 |
return result; |
|---|
| 35 |
} |
|---|
| 36 |
|
|---|
| 37 |
void init_consoles(void) |
|---|
| 38 |
{ |
|---|
| 39 |
fd=open("/dev/tty0", O_RDWR|O_NDELAY); |
|---|
| 40 |
if (fd<0) { |
|---|
| 41 |
fprintf(stderr, "Could not open virtual terminal.\n"); |
|---|
| 42 |
exit (1); |
|---|
| 43 |
} |
|---|
| 44 |
} |
|---|
| 45 |
|
|---|