t_config *init_rc(char *progname) { t_config *config; if (!(config = malloc(sizeof(t_config)))) return (NULL); config->aliases = NULL; config->envvars = NULL; config->vars = NULL; config->file = load_rc(open_rc(progname)); parse_rc(config); return (config); }
int main( int argc, char **argv ) { int eax; double fp7; int i; char *cp = &ebx; double numerator, denominator; double new_size; int coption, boption, wide_flag; init_gvars( ); default_out = stdout; gfp = stdout; wide_flag = 0; coption = 0; if ( i >= 0 ) { if ( i + -98 + -98 <= 22 ) { ; } usage( ); exit( 2 ); } else { if ( n_tokens <= 99 ) { __fprintf_chk( stderr, 1, "%s: Expression array size too small.\n", prog_name ); exit( 2 ); } if ( init_mem( ) == 0 ) { __fprintf_chk( stderr, 1, "%s: Not enough memory.\n", prog_name ); exit( 2 ); } if ( readline_enabled ) { if ( numerator && prog_name ) { __snprintf_chk( history_filename_storage, 4096, 1, 4096, "%s/.%s_history", cp, prog_name ); history_filename = history_filename_storage; } rl_initialize( ); using_history( ); stifle_history( 500 ); rl_inhibit_completion = 1; if ( html_flag == 0 ) { color_flag = tigetnum( "colors" ) > 7; } read_history( history_filename ); } get_screen_size( ); if ( html_flag ) __printf_chk( 1, "<pre>\n" ); if ( test_mode == 0 ) { if ( quiet_mode == 0 ) { if ( security_level > 1 ) __printf_chk( 1, "Secure " ); __printf_chk( 1, "Mathomatic version %s (www.mathomatic.org)\n", "15.1.1" ); __printf_chk( 1, "Copyright (C) 1987-2010 George Gesslein II.\n" ); __printf_chk( 1, "%d equation spaces available, %ld kilobytes per equation space.\n", 100, (/*HI*/int)( ( n_tokens << 5 ) * 0x10624dd3 ) >> 6 ); if ( test_mode == 0 ) goto B32; } B32:; if ( load_rc( ) == 0 ) __fprintf_chk( stderr, 1, "%s: Error loading set options from \"%s\".\n", prog_name, rc_file ); } if ( wide_flag ) { screen_columns = 0; screen_rows = 0; } if ( coption & 1 ) color_flag = color_flag == 0; if ( 0 ) { color_flag = 1; bold_colors = 1; } if ( test_mode ) color_flag = 0; if ( quiet_mode == 0 && color_flag ) { __printf_chk( 1, "%s%s color mode enabled", html_flag != 0 ? "ANSI" : "HTML", bold_colors == 0 ? " bold" : "" ); if ( 0 ) __printf_chk( 1, ".\n" ); else __printf_chk( 1, "; disable with the -c option or \"set no color\".\n" ); } i = _setjmp( &jmp_save[0].__jmpbuf[0] ); if ( _setjmp( &jmp_save[0].__jmpbuf[0] ) ) { clean_up( ); if ( i == 14 ) error( "Expression too large." ); __printf_chk( 1, "Operation aborted.\n" ); } else { if ( set_signals( ) == 0 ) __fprintf_chk( stderr, 1, "signal(2) setting failed.\n" ); if ( !f_to_fraction( 0.500000000000, &denominator, ebp_36 ) || denominator != 1.000000000000 || ebp_36 != 2.000000000000 || 0 || !f_to_fraction( 0.333333333333, &denominator, ebp_36 ) || denominator != 1.000000000000 || 0 || ebp_36 != 3.000000000000 || ebp_36 != 3.000000000000 ) { __fprintf_chk( stderr, 1, "%s: Cannot convert any floating point values to fractions.\n", prog_name ); __fprintf_chk( stderr, 1, "Roots will not work properly.\n" ); } i = optind; if ( argc <= optind || argv[ i ] == 0 ) { main_io_loop( ); exit_program( 0 ); return 0; } { /* phantom */ size_t __s1_len; /* phantom */ size_t __s2_len; unsigned char *__s1; /* phantom */ int __result; do { if ( '-' == argv[ i ][0] && argv[ i ][1] == 0 ) main_io_loop( ); else { if ( read_file( argv[ i ] ) == 0 ) { __fprintf_chk( stderr, 1, "Read of file \"%s\" failed.\n", argv[ i ] ); exit_program( 1 ); } } i++; } while ( i + 1 < argc && argv[ i + 1 + 1 ] ); } } } }
void client_loop (void) { long VfTime = 0; long VendSleep = 0; struct timeval VlastClk; struct timeval VnewClk; int wait = 0; #if 0 int drawed = 0; int display = 1; #endif client = 1; load_rc (); init_menu (); Ready (); #ifdef XSUPPORT nopause = 1; #endif gamemode = MENU; gettimeofday (&VlastClk, NULL); gettimeofday (&VnewClk, NULL); VendSleep = VlastClk.tv_usec; VfTime = 1000000 / 25; dispframes = 25 * 4; realdisplayed = 25; GetPos (); dispframes = 0; realdisplayed = 0; while (1) { if (nodisplayco) nodisplayco--; SetTimeout (0, 0); nodata++; while (SocketReadable (sock)) process_message (); gettimeofday (&VnewClk, NULL); if (VnewClk.tv_usec < VendSleep) VendSleep -= 1000000; wait = (VfTime - VnewClk.tv_usec + VendSleep); allframes++; if (fadedout) rframe = 1; process_keys (); if ((wait > 0 || tbreak)) { /*display=0; */ csendbuffer (); realdisplayed++; client_loop2 (rframe && (!nodisplayco)); rframe = 0; } else { csendbuffer (); client_loop2 (0); } if (allframes == 25 || tbreak) { /*printf ("Displayed frames:%i really:%i\n", dispframes / 4, realdisplayed); */ if (tbreak) realdisplayed = 25; GetPos (); allframes = 0; dispframes = 0; realdisplayed = 0; } SendControls (); #ifndef HAVEUSLEEP do { /*my emulation of usleep isn't reiable on HP-UX machines when sockets are comming :( */ #endif gettimeofday (&VnewClk, NULL); if (VnewClk.tv_usec < VendSleep) VendSleep -= 1000000; wait = (VfTime - VnewClk.tv_usec + VendSleep); if (tbreak) wait = VfTime; if (wait > 0) usleep (wait); #ifndef HAVEUSLEEP } while (wait > 10 && !tbreak); #endif VendSleep = VnewClk.tv_usec + wait; gettimeofday (&VlastClk, NULL); if (tbreak) VendSleep = VlastClk.tv_usec; tbreak = 0; } }
/* Set up the game by clearing the screen, etc. */ static void setup(void) { srand(time(NULL)); xt_par0(XT_CLEAR_SCREEN); load_rc(); }
void Blackbox::reload_rc(void) { load_rc(); reconfigure(); }