[comp.os.minix] virtual consoles/login.c bug fix for 2 digit ttys

pmacdona@sol.uvic.ca (Peter MacDonald) (04/07/91)

As my attention to this newsgroup has been spotty over the
last few months (work:fulltime, masters:parttime, pleasure:notime)
I don't know if this problem has been posted yet.
 
While trying to show off minix to a friend,  I found to my 
chagrin that talk refused to work between my vt100 and PC.
It seems that virtual consoles moves the rs232 device number
up to 64 and 65 for com1 and com2.  Unfortunately, login.c 
tries to report the login number as '0' + ttynum.  ie. a single
digit.  The result is tty64 gets called ttyp.  The following
patch to login.c will rectify the situation (as would I suppose
renaming these devices to tty8 and tty9???).  


*** login.c~	Sat Apr  6 16:37:28 1991
--- login.c	Sat Apr  6 16:44:58 1991
***************
*** 220,226 ****
  	strcpy(ttyname, CONS);	/* system console */
    else {
  	strcpy(ttyname, TTY);
! 	ttyname[DIGIT] = '0' + ttynr;
    }
  
    /* Get login name and passwd. */
--- 220,232 ----
  	strcpy(ttyname, CONS);	/* system console */
    else {
  	strcpy(ttyname, TTY);
!         if (ttynr<10) 
! 	  ttyname[DIGIT] = '0' + ttynr;
!         else {
! 	  ttyname[DIGIT] = '0' + ttynr/10;
! 	  ttyname[DIGIT+1] = '0' + ttynr%10;
! 	  ttyname[DIGIT+2] = '\0';
!         }
    }
  
    /* Get login name and passwd. */