runx.c 646 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #include <vga.h>
  2. #include <stdlib.h>
  3. #include <stdio.h>
  4. #include <unistd.h>
  5. #include <sys/kd.h>
  6. #include <fcntl.h>
  7. #include <termcap.h>
  8. main(int argc, char* argv[])
  9. {
  10. int tty0_fd;
  11. int i, p;
  12. char *cl;
  13. char *buffer=0;
  14. char *termtype=getenv("TERM");
  15. vga_setmode(G640x480x16);
  16. if (fork() == 0) {
  17. execlp("startx", "startx", NULL);
  18. _exit(1);
  19. }
  20. wait(NULL);
  21. vga_setmode(TEXT);
  22. tty0_fd = open("/dev/tty0", O_RDWR);
  23. ioctl(tty0_fd, KDSETMODE, KD_GRAPHICS);
  24. ioctl(tty0_fd, KDSETMODE, KD_TEXT);
  25. tgetent(buffer, termtype);
  26. cl=tgetstr("cl",0);
  27. printf("%s\n",cl);
  28. exit(1);
  29. }