void get_mem_info( void ) /***********************/ { #ifdef __OS2__ ULONG mem; DosMemAvail( &mem ); techoutput( "\nAmount of free memory %ld bytes\n", (ULONG) mem ); #else union REGS regs; unsigned long mem; regs.h.ah = 0x88; int86( 0x15, ®s, ®s ); techoutput( "\nAmount of extended memory is: %dK\n", regs.x.ax ); int86( 0x12, ®s, ®s ); techoutput( "Amount of base memory is: %dK\n", regs.x.ax ); regs.h.ah = 0x48; regs.x.bx = 0xffff; int86( 0x21, ®s, ®s ); if( regs.w.cflag != 0 ) { mem = regs.x.bx; mem *= 16; techoutput( "Amount of free base memory is: %l bytes\n", mem ); } #endif }
void get_wsql_patch( void ) /*************************/ { /***************************************************************************/ /* This function first dumps out all relevant WATCOM environment vars */ /* It then uses bpatch to find patch levels of compiler executables. */ /***************************************************************************/ char * path; unsigned i; techoutput( "------------------Watcom SQL Environment Variables ----------------\n" ); for( i = 0; WSQL_EnvVars[i] != NULL; ++i ) { print_env_var( WSQL_EnvVars[i] ); } path = getenv( "SQLANY" ); if( path == NULL ) { path = getenv( "WSQL" ); } if( path != NULL ) { strcpy( WATCOMPATH, path ); fflush( stdout ); for( i = 0; WSQL_Tools[i] != NULL; ++i ) { patch_tool( WSQL_Tools[i], WSQL_Dirs ); } } else { techoutput( "... ERROR...SQLANY environment variable not set.\n" ); } }
void patch_tool( char *tool, char **dirs ) { char toolbuff[159]; int i; unsigned rc; struct stat info; for( i = 0; dirs[i] != NULL; ++i ) { strcpy( toolbuff, WATCOMPATH ); strcat( toolbuff, dirs[i] ); strcat( toolbuff, "\\" ); strcat( toolbuff, tool ); strcat( toolbuff, ".exe" ); rc = stat( toolbuff, &info ); if( rc == 0 ){ #if 0 spawnl( P_WAIT, BPATCHPATH, BPATCHPATH, "-q", toolbuff, NULL ); #else GetLevel( toolbuff ); if( CurrLevel[ 0 ] == '\0' ) { techoutput( "File '%s' has not been patched\n", toolbuff ); } else { techoutput( "File '%s' has been patched to level '%s'\n", toolbuff, CurrLevel ); } #endif } } }
void do_company_header( void ) /****************************/ { time_t time_of_day; time_of_day = time( NULL ); techoutput( BANNER "\n" ); techoutput( "Current Time: %s", ctime( &time_of_day) ); techoutput( "Visit http://www.openwatcom.org/\n" ); techoutput( "\n" ); }
void check_dos_comm( void ) /*************************/ { /* Check for the share and append utilities */ union REGS regs; techoutput( "\n------------------------------------------------------\n"); regs.w.ax = 0xB700; int86( 0x2F, ®s, ®s ); if( regs.h.al == 0xFF ) techoutput( "APPEND INSTALLED\n" ); else techoutput( "APPEND NOT INSTALLED\n" ); }
void print_env_var( const char * env_var ) /****************************************/ { char *path; path = getenv( env_var ); if( path != NULL ) { if( (strlen( env_var ) + strlen( path )) > 76 ) LineCount++; techoutput( "%s=<%s>\n", env_var, path ); } }
void dump_files( char drive_name ) /********************************/ { char filename[17]; FILE *fp; char buffer[256]; filename[0] = drive_name; strcpy( &filename[1], ":\\CONFIG.SYS" ); techoutput( "\n------------%s-------------\n", filename ); fp = fopen( filename, "r" ); if( fp != NULL ) { while( fgets( buffer, 256, fp ) != NULL ) { if( strlen( buffer ) > 80 ) LineCount++; techoutput( "%s", buffer ); } fclose( fp ); } else { techoutput( "Cannot find %s\n", filename ); } strcpy( &filename[1], ":\\AUTOEXEC.BAT" ); techoutput( "\n------------%s-------------\n", filename ); fp = fopen( filename, "r" ); if( fp != NULL ) { while( fgets( buffer, 256, fp ) != NULL ) { if( strlen( buffer ) > 80 ) LineCount++; techoutput( "%s", buffer ); } fclose( fp ); } else { techoutput( "Cannot find %s\n", filename ); } }
void machine_type( int print ) /****************************/ { int manuf, plevel, buswidth, ndptype, ndp; techoutput( "\n------------------------------------------------------\n"); manuf = 0; buswidth = 0; plevel = PType(); if( plevel < 2 ) buswidth = PBus(); if( plevel < 1 ) manuf = PPrefix(); ndptype = NDPType(); if( (plevel == 4) && (ndptype == 3) ) ndptype = 4; if( (plevel == 5) && (ndptype == 3) ) ndptype = 5; if( (plevel == 6) && (ndptype == 3) ) ndptype = 6; if( (plevel == 7) && (ndptype == 3) ) ndptype = 7; techoutput( "An %s processor is installed in this system.\n", ProcessorType[manuf][plevel][buswidth] ); #ifdef __OS2__ DosDevConfig( &ndp, 3, 0 ); if( ndp != 0 ) ndp = 1; #else ndp = NDPEquip(); #endif techoutput( "%s math coprocessor (NDP) is present\n", CoProcessorType[ ndptype ] ); techoutput( "\tand Equipment Flags say math coprocessor %s present.\n", IsNotIs[ ndp ] ); #ifdef __OS2__ techoutput( "Skipping math coprocessor interrupt check since this is not DOS.\n" ); print = print; /* stop the warning message */ #else if( ndptype != 0 ) { LineCount++; techoutput( "The next test may cause the system to hang if math\n" "\tcoprocessor (NDP) interrupts are not handled properly.\n" ); techoutput( "%s (NDP) interrupts are %s.\n", CoProcessorType[ ndptype ], monint( print ) ? "properly enabled" : "not enabled (math exceptions will not be detected!)" ); } else { techoutput( "Skipping math coprocessor interrupt check.\n" ); } #endif }
int monint( int print ) { int i; for( i = 0; i < NUM_INTS; i++ ) { prev_int[i] = _dos_getvect( i ); } if( print ) techoutput( "\nInstalling interrupt handlers\n" ); for( i = NUM_INTS - 1 ; i >= 0; i-- ) { _dos_setvect( i, new_int[i] ); } if( print ) { Sample_On = 1; while( int_tick[ 8 ] < 24 ); Sample_On = 0; techoutput( "Normal system operation:\n" ); int_summary(); memset( (void *)int_tick, 0, sizeof( int_tick ) ); techoutput( "Starting exception test...\n" ); } Sample_On = 1; _TEST_NDP(); while( int_tick[ 8 ] < 24 ); Sample_On = 0; _INIT_NDP(); NDP_Status = NDP_Env.status_word; if( print ) { techoutput( "System operation with NDP divide by zero exception:\n" ); int_summary(); techoutput( "Restoring interrupt handlers\n" ); } for( i = NUM_INTS - 1 ; i >= 0; i-- ) { _dos_setvect( i, prev_int[i] ); } #define TEST_FPU(x,y) techoutput( "\t%s " y "\n", \ ((NDP_Status & x) ? " " : "No") ) if( print ) { techoutput( "80x87 status:\n" ); TEST_FPU( SW_INVALID, "invalid operation" ); TEST_FPU( SW_DENORMAL, "denormalized operand" ); TEST_FPU( SW_ZERODIVIDE, "divide by zero" ); TEST_FPU( SW_OVERFLOW, "overflow" ); TEST_FPU( SW_UNDERFLOW, "underflow" ); TEST_FPU( SW_INEXACT, "inexact result" ); } return( (int_tick[ 2 ] != 0) && ((NDP_Status & SW_ZERODIVIDE) != 0) ); }
void get_config_files( void ) /***************************/ { int drive_name; #ifdef __OS2__ SEL gbl_seg; SEL lcl_seg; PGINFOSEG gbl; DosGetInfoSeg( &gbl_seg, &lcl_seg ); gbl = MK_FP( gbl_seg, 0 ); techoutput( "OS/2 Version %d.%d%c\n", gbl->uchMajorVersion, gbl->uchMinorVersion, gbl->chRevisionLetter); drive_name = gbl->bootdrive + 'A' - 1; #else union REGS regs; char *comspec; regs.h.ah = 0x30; intdos( ®s, ®s ); techoutput( "DOS Version %d.%d\n", regs.h.al, regs.h.ah ); /* Get Drive that user booted off of */ if( regs.h.al >= 0x04 ) { regs.w.ax = 0x3305; intdos( ®s, ®s ); drive_name = regs.h.dl + 'A' - 1; } else { comspec = getenv( "COMSPEC" ); if( comspec != NULL ) { drive_name = toupper( *comspec ); } else { return; } } #endif dump_files( drive_name ); }
static void int_summary( void ) { int i; for( i = 0; i < NUM_INTS; i++ ) { if( int_tick[ i ] != 0 ) { LineCount--; techoutput( "\tint %02.2x ticks = %8d", i, int_tick[ i ] ); if( i == 0x00 ) techoutput( " divide error interrupt" ); if( i == 0x01 ) techoutput( " single-step interrupt" ); if( i == 0x02 ) techoutput( " hardware NMI interrupt" ); if( i == 0x03 ) techoutput( " break-point interrupt" ); if( i == 0x04 ) techoutput( " overflow interrupt" ); if( i == 0x05 ) techoutput( " print-screen interrupt" ); if( i == 0x06 ) techoutput( " undefined opcode interrupt" ); if( i == 0x07 ) techoutput( " no math unit interrupt" ); if( i == 0x08 ) techoutput( " IRQ 0 timer interrupt" ); if( i == 0x09 ) techoutput( " IRQ 1 keyboard interrupt" ); if( i == 0x0a ) techoutput( " IRQ 2 EGA vert retrace interrupt" ); if( i == 0x0b ) techoutput( " IRQ 3 COM2 interrupt" ); if( i == 0x0c ) techoutput( " IRQ 4 COM1 interrupt" ); if( i == 0x0d ) techoutput( " IRQ 5 fixed disk interrupt" ); if( i == 0x0e ) techoutput( " IRQ 6 diskette interrupt" ); if( i == 0x0f ) techoutput( " IRQ 7 printer interrupt" ); if( i == 0x10 ) techoutput( " video interrupt" ); if( i == 0x11 ) techoutput( " equip. determination" ); if( i == 0x12 ) techoutput( " memory size" ); if( i == 0x13 ) techoutput( " disk interrupt" ); if( i == 0x14 ) techoutput( " serial i/o s/w interrupt" ); if( i == 0x15 ) techoutput( " misc s/w interrupt" ); if( i == 0x16 ) techoutput( " keyboard s/w interrupt" ); if( i == 0x17 ) techoutput( " printer interrupt" ); if( i == 0x18 ) techoutput( " xfer to ROM BASIC" ); if( i == 0x19 ) techoutput( " disk boot" ); if( i == 0x1a ) techoutput( " clock s/w interrupt" ); if( i == 0x1b ) techoutput( " ctrl/break interrupt" ); if( i == 0x1c ) techoutput( " clock tick interrupt" ); if( i == 0x20 ) techoutput( " prog. termination" ); if( i == 0x21 ) techoutput( " DOS s/w interrupt" ); if( i == 0x29 ) techoutput( " fast putchar interrupt" ); if( i == 0x2a ) techoutput( " network interrupt" ); if( i == 0x33 ) techoutput( " mouse interrupt" ); if( i == 0x70 ) techoutput( " IRQ 8 real time clock interrupt" ); if( i == 0x71 ) techoutput( " IRQ 9 redirect cascade interrupt" ); if( i == 0x72 ) techoutput( " IRQ10 reserved interrupt" ); if( i == 0x73 ) techoutput( " IRQ11 reserved interrupt" ); if( i == 0x74 ) techoutput( " IRQ12 mouse interrupt" ); if( i == 0x75 ) techoutput( " IRQ13 math coprocessor exception interrupt" ); if( i == 0x76 ) techoutput( " IRQ14 fixed disk interrupt" ); if( i == 0x77 ) techoutput( " IRQ15 reserved interrupt" ); LineCount--; techoutput( "\n" ); } } }