bool UIAPI uistart( void ) /*************************/ { UIMemOpen(); if( initbios() ) { DBCSCharacterMap(); /* need for LUI and DUI apps to avoid divide by zero */ /* when no mouse is found */ UIData->mouse_yscale = 1; UIData->mouse_xscale = 1; uiattrs(); openbackground(); forceevinit(); initeventlists(); return( true ); } return( false ); }
bool uiconfig( char *fn, char **envvars ) /***************************************/ { char buffer[ _MAX_PATH + ATTR_LAST * 4 ]; void *config; int i; char *colour; int slen; int blen; char *s; ATTR attr; _unused( envvars ); UIData->no_snow = TRUE; uiattrs(); if( UIData->colour == M_MONO ) { colour = "ATTR_MONO"; slen = 9; } else if( UIData->colour == M_BW ) { colour = "ATTR_BW"; slen = 7; } else { colour = "ATTR_COL"; slen = 8; } #if !defined( __NETWARE__ ) for( ; envvars != NULL && *envvars != NULL; ++envvars ) { _searchenv( fn, *envvars, buffer ); if( buffer[0] != '\0' ) { break; } } fn = buffer; #endif if( fn != NULL && fn[0] != '\0' ) { config = fopen( fn, "r" ); if( config != NULL ) { while( fgets( buffer, _MAX_PATH+ATTR_LAST*4, config ) != NULL ) { blen = strlen( buffer ); if( blen > slen && memicmp( colour, buffer, slen ) == 0 ) { s = &buffer[ slen ]; for( i = 0 ; i < ATTR_LAST && *s == ' '; ++i ) { attr = 0; while( *s == ' ' ) ++s; while( *s != '\0' && *s != '\n' && *s != ' ' ) { attr = 10*attr + (*s-'0'); ++s; } if( attr != 0 ){ UIData->attrs[i] = attr; } } } else if( blen > 9 && memicmp( "SNOWCHECK", buffer, 9 ) == 0 ) { UIData->no_snow = ( buffer[ 10 ] == '0' ); } else if( blen > 11 && memicmp( "MOUSE_SPEED", buffer, 11 ) == 0 ) { uimousespeed( strtol( &buffer[ 12 ], NULL, 10 ) ); } else if( blen > 8 && memicmp( "GRAPHICS", buffer, 8 ) == 0 ) { UIData->no_graphics = ( buffer[ 9 ] == '0' ); } } fclose( config ); return( TRUE ); } } return( FALSE ); }