aboutsummaryrefslogtreecommitdiff
path: root/misc/opendevconsole.c
blob: 3f92223b0339b4da351ad8fc7db6c006e930891b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#include <fcntl.h>
#include <unistd.h>

void opendevconsole() /*EXTRACT_INCL*/ {
  int fd;
  if ((fd=open("/dev/console",O_RDWR|O_NOCTTY))>=0) {
    dup2(fd,0);
    dup2(fd,1);
    dup2(fd,2);
    if (fd>2) close(fd);
  }
}