Support linux with devfs

This commit is contained in:
Pavel Machek 2000-06-16 11:40:23 +00:00
parent 40c1c50201
commit ce6e42f45a
2 changed files with 9 additions and 6 deletions

View File

@ -1,3 +1,7 @@
2000-06-16 Pavel Machek <pavel@artax.karlin.mff.cuni.cz>
* cons_saver: support linux with devfs, patch by pavenis@lanet.lv
2000-06-14 Andrew V. Samoilov <sav@bcs.zp.ua>
* panel.h, util.[ch] (struct WPanel, size_trunc, size_trunc_sep): size

View File

@ -161,17 +161,16 @@ char *detect_console (void)
int xlen;
/* Must be console */
/* Handle the case for /dev/tty?? */
if (tty_name[len-5] == 't')
/* Handle the case for /dev/tty?? and /dev/vc/?? */
if (tty_name[len-5] == 't' || tty_name[len-5] == 'v')
xlen = len - 1;
else
xlen = len;
/* General: /dev/ttyn */
/* General: /dev/ttyn and /dev/vc/n */
if (tty_name[xlen - 5] != '/' ||
tty_name[xlen - 4] != 't' ||
tty_name[xlen - 3] != 't' ||
tty_name[xlen - 2] != 'y' ||
! (strncmp(tty_name+xlen-4,"tty",3) == 0 ||
strncmp(tty_name+xlen-4,"vc/",3) == 0) ||
!isdigit(tty_name[xlen - 1]) ||
!isdigit(tty_name[len - 1]))
return "Doesn't look like console";