src/initkbd.c
/************************************************************************/
/*									*/
/*			  k e y b o a r d t y p e			*/
/*									*/
/*	Determine what kind of keyboard we're dealing with, by		*/
/*	checking the LDEKBDTYPE shell variable.  It it's not set,	*/
/*	either default it (for Sun, IBM), or complain and exit.		*/
/*	Valid LDEKBDTYPE values:					*/
/*		type3	Sun type-3 keyboard				*/
/*		type4	Sun type-4 keyboard				*/
/*		rs6000	IBM RS/6000					*/
/*		x	generic X keyboard map				*/
/*									*/
/*									*/
/*									*/
/*									*/
/*									*/
/*									*/
/************************************************************************/
k e y b o a r d t y p e

Determine what kind of keyboard we're dealing with, by
checking the LDEKBDTYPE shell variable.  It it's not set,
either default it (for Sun, IBM), or complain and exit.
Valid LDEKBDTYPE values:
type3   Sun type-3 keyboard
type4   Sun type-4 keyboard
rs6000  IBM RS/6000
x       generic X keyboard map
k e y b o a r d t y p e Determine what kind of keyboard we ' re dealing with by checking the LDEKBDTYPE shell variable . It it ' s not set either default it ( for Sun IBM ) or complain and exit . Valid LDEKBDTYPE values : type3 Sun type - 3 keyboard type4 Sun type - 4 keyboard rs6000 IBM RS / 6000 x generic X keyboard map
void keyboardtype(int fd)
{
  int type;
  int i;
  char *key;
  for (i = 0; i < 5000; i++) { 
  }                            
  InterfacePage->devconfig &= 0xfff8;
  if ((key = getenv("LDEKBDTYPE")) == 0) {
#ifdef XWINDOW
    type = KB_X;
#elif DOS
    type = KB_DOS;
#endif 
  } 
  else {
    if (strcmp("as3000j", key) == 0)
      type = KB_AS3000J;
    else if (strcmp("type4", key) == 0)
      type = KB_SUN4;
    else if (strcmp("type2", key) == 0)
      type = KB_SUN2;
    else if (strcmp("jle", key) == 0)
      type = KB_JLE;
    else if (strcmp("X", key) == 0)
      type = KB_X;
    else if (strcmp("x", key) == 0)
      type = KB_X;
    else
      type = KB_SUN3; 
  }
  switch (type) {
    case KB_SUN2: 
      SUNLispKeyMap = SUNLispKeyMap_for3;
      InterfacePage->devconfig |= 0;
      break;
    case KB_SUN3: 
      SUNLispKeyMap = SUNLispKeyMap_for3;
      InterfacePage->devconfig |= type - MIN_KEYTYPE;
      break;
    case KB_SUN4: 
      SUNLispKeyMap = SUNLispKeyMap_for4;
      InterfacePage->devconfig |= type - MIN_KEYTYPE;
      break;
    case KB_JLE: 
      SUNLispKeyMap = SUNLispKeyMap_jle;
      InterfacePage->devconfig |= type - MIN_KEYTYPE;
      break;
    case KB_AS3000J: 
      SUNLispKeyMap = SUNLispKeyMap_for4;
      InterfacePage->devconfig |= type - MIN_KEYTYPE; 
      break;
#ifdef XWINDOW
    case KB_X:
      XGenericKeyMap = (u_char *)make_X_keymap();
      SUNLispKeyMap = XGenericKeyMap;
      InterfacePage->devconfig |= KB_SUN3 - MIN_KEYTYPE; 
      break;
#endif 
#ifdef DOS
    case KB_DOS:
      SUNLispKeyMap = DOSLispKeyMap_101;
      InterfacePage->devconfig |= KB_SUN3 - MIN_KEYTYPE; 
      break;
#endif 
    default: {
      char errmsg[200];
      sprintf(errmsg, "Unsupported keyboard type: %d", type);
      printf("%s\n", errmsg);
      printf("Configuring keyboard for type-3\n");
      SUNLispKeyMap = SUNLispKeyMap_for3;
      InterfacePage->devconfig |= KB_SUN3 - MIN_KEYTYPE;
      break;
    }
  }
}
void keyboardtype ( int fd ) { int type ; int i ; char * key ; for ( i = 0 ; i < 5000 ; i ++ ) { } InterfacePage -> devconfig &= 0xfff8 ; if ( ( key = getenv ( " " ) ) == 0 ) { #ifdef XWINDOW type = KB_X ; #elif DOS type = KB_DOS ; #endif } else { if ( strcmp ( " " , key ) == 0 ) type = KB_AS3000J ; else if ( strcmp ( " " , key ) == 0 ) type = KB_SUN4 ; else if ( strcmp ( " " , key ) == 0 ) type = KB_SUN2 ; else if ( strcmp ( " " , key ) == 0 ) type = KB_JLE ; else if ( strcmp ( " " , key ) == 0 ) type = KB_X ; else if ( strcmp ( " " , key ) == 0 ) type = KB_X ; else type = KB_SUN3 ; } switch ( type ) { case KB_SUN2 : SUNLispKeyMap = SUNLispKeyMap_for3 ; InterfacePage -> devconfig |= 0 ; break ; case KB_SUN3 : SUNLispKeyMap = SUNLispKeyMap_for3 ; InterfacePage -> devconfig |= type - MIN_KEYTYPE ; break ; case KB_SUN4 : SUNLispKeyMap = SUNLispKeyMap_for4 ; InterfacePage -> devconfig |= type - MIN_KEYTYPE ; break ; case KB_JLE : SUNLispKeyMap = SUNLispKeyMap_jle ; InterfacePage -> devconfig |= type - MIN_KEYTYPE ; break ; case KB_AS3000J : SUNLispKeyMap = SUNLispKeyMap_for4 ; InterfacePage -> devconfig |= type - MIN_KEYTYPE ; break ; #ifdef XWINDOW case KB_X : XGenericKeyMap = ( u_char * ) make_X_keymap ( ) ; SUNLispKeyMap = XGenericKeyMap ; InterfacePage -> devconfig |= KB_SUN3 - MIN_KEYTYPE ; break ; #endif #ifdef DOS case KB_DOS : SUNLispKeyMap = DOSLispKeyMap_101 ; InterfacePage -> devconfig |= KB_SUN3 - MIN_KEYTYPE ; break ; #endif default : { char errmsg [ 200 ] ; sprintf ( errmsg , " " , type ) ; printf ( " \n " , errmsg ) ; printf ( " \n " ) ; SUNLispKeyMap = SUNLispKeyMap_for3 ; InterfacePage -> devconfig |= KB_SUN3 - MIN_KEYTYPE ; break ; } } }
k e y b o a r d t y p e
k e y b o a r d t y p e
/* IDLE LOOP */ /* because of a SunOS bug */ /* clear the keyboard field in devconfig */ /************************************************************
   Due to the problems of SunOS 4.0 & 4.0.1
   calling ioctl never return the correct keyboard type.
   So,these 2 lines are commented out ...(Take)->AR11100
  *************************************************************/ /* Get keytype from LDEKBDTYPE  */ /* XWINDOW */ /* if end */ /* default */ /* type2, we still use keymap for type3 */ /* MIN_KEYTYPE is 3,so we can't set devconfig correctly */ /* Therefore type2 may treat as type3 */ /* type3 */ /* type4 */ /* JLE */ /*printf("jle\n"); */ /* InterfacePage->devconfig |= 4-MIN_KEYTYPE; */ /* for AS, use type4 map */ /* 7 */ /* 10 */ /* XWINDOW */ /* 10 */ /* DOS */