home *** CD-ROM | disk | FTP | other *** search
- #include <fcntl.h>
- #include <sys/termios.h>
- #include <sys/wait.h>
- #define FONT "-adobe-courier-medium-r-normal--12-120-75-75-m-70-iso8859-1"
- #include "xdmconsole.h"
- #define PTYPROC "/usr/bin/X11/xdmconsole"
-
- char *ttydev;
- char *ptydev;
-
- extern int tty, pty;
-
-
- int getttys()
- {
- if ((get_pty(&pty)) != 0) return(-1);
- if ((tty=open(ttydev, O_RDWR, 0)) < 0)
- {
- return(-1);
- }
- return(0);
- }
-
-
-
- int make_console()
- {
- int childpid;
-
- if ((childpid=fork())==0)
- {
- close(0);
- dup(pty);
-
- execl(PTYPROC, "console", 0);
- }
- if (ioctl(tty, TIOCCONS, 0) < 0)
- {
- return(-1);
- }
- return(childpid);
- }
-
- int kill_console(childpid)
- int childpid;
- {
-
- /*
- if (childpid > 20)
- if (kill(childpid, 9) != -1)
- if (wait((union wait *) 0) == -1)
- perror("console");
- for some reason, this seems to kill xdm totally sometimes (about 1 in 50)
- */
-
- }
-