Beispiel #1
0
int load_rc( void )
{
  int eax;
  FILE *fp;
  char buf[4096];
  char *cp;
  int rv;
  if ( cp )
  {
    __snprintf_chk( rc_file, 4096, 1, 4096, "%s/%s", cp, ".mathomaticrc" );
    fp = (FILE*)fopen( rc_file, "r" );
    if ( fopen( rc_file, "r" ) )
    {
      rv = 1;
      for ( ; fgets( buf, 4096, fp ) == 0;  )
      {
        set_error_level( &ebx );
        rv = set_options( cp ) == 0 ? rv : 0;
      }
    }
  }
  rv = 1;
  if ( 0 ^ 0 )
  {
    return rv;
  }
  return rv;
}
Beispiel #2
0
void main_io_loop( void )
{
  char *cp;
  while ( 1 )
  {
    default_color( );
    __snprintf_chk( prompt_str, 80, 1, 80, "%d%s", cur_equation + 1, html_flag != 0 ? "-> " : "—> " );
    if ( cp == 0 )
      break;
    process( cp );
  }
}
Beispiel #3
0
int
foo (char *c)
{
  try
    {
      return __snprintf_chk (c, 64, 0, 32, "%s", "abcdefghijklmnopq");
    }
  catch (...)
    {
      return -1;
    }
}
Beispiel #4
0
void do_auth_dialog( struct session *ses, void *data )
{
  int edx;
  struct dialog *dlg;
  struct dialog_data *dlg_data;
  struct terminal *term = ses->tab->term;
  struct auth_entry *a;
  unsigned char sticker[1024], *text;
  int sticker_len;
  if ( get_invalid_auth_entry(  ) && !( ( *(char*)(get_invalid_auth_entry(  ) + 112) & 1 ) & 255 ) && get_uri_string( &a->uri->user[0], URI_HTTP_AUTH ) )
  {
    dlg = &a->realm[0];
    if ( 0 != 65 )
    {
      if ( term[0] && current_charset != get_terminal_codepage( &term[0] ) )
      {
        bind_textdomain_codeset( "elinks", get_cp_mime_name( get_terminal_codepage( &term[0] ) ) );
        *ebp_1076 = text[0];
        current_charset = get_terminal_codepage( &term[0] );
      }
      gettext( "Authentication required for %s at %s" );
      text[0] = text[0];
    }
    sticker_len = __snprintf_chk( sticker, 1024, 1, 1024, (char*)gettext( "Authentication required for %s at %s" ), dlg, text[0] );
    mem_free( &text[0] );
    if ( sticker_len <= 1024 )
    {
      dlg = (struct dialog*)mem_calloc( 1, sticker_len + 277 );
      if ( dlg )
      {
        a->bits_at_112/*.1_1of4*/ |= 1;
        dlg->layouter = &generic_dialog_layouter;
        dlg[0].title = _( "Authentication required", &term[0] );
        text[0] = dlg[3].abort;
        memcpy( dlg[3].abort, sticker, sticker_len );
        dlg->udata = (void*)ses[0].next;
        dlg->udata2 = (void*)a[0].next;
        add_dlg_text( dlg, (unsigned char*)dlg[3].abort, ALIGN_LEFT, 0 );
        add_dlg_field_do( dlg, WIDGET_FIELD, _( "Login", &term[0] ), 0, 0, 0, 40, &a->user[0], 0, INPFIELD_FLOAT );
        add_dlg_field_do( dlg, WIDGET_FIELD_PASS, _( "Password", &term[0] ), 0, 0, 0, 40, &a->password[0], 0, INPFIELD_FLOAT );
        add_dlg_button_do( dlg, _( "~OK", &term[0] ), 1, &ok_dialog, 0, &auth_ok, (void*)dlg );
        add_dlg_button_do( dlg, _( "~Cancel", &term[0] ), 2, &ok_dialog, 0, &auth_cancel, (void*)a[0].next );
        if ( assert_failed == 0 )
        {
          assert_failed = dlg->number_of_widgets != 5;
          if ( dlg->number_of_widgets != 5 )
          {
            errfile = "/home/naftali/source/elinks-0.12~pre5/src/protocol/auth/dialogs.c";
            errline = 118;
            elinks_internal( "assertion 5 == (dlg)-&gt;number_of_widgets failed!" );
          }
        }
        if ( dlg_data[0] && a->user[0] && a->password[0] == 0 )
          select_widget_by_id( &dlg_data[0], 1 );
      }
    }
  }
  if ( 0 ^ 0 )
  {
    __stack_chk_fail(  );
  }
  return;
}
Beispiel #5
0
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, "&lt;pre&gt;\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 ] );
    }
    }
  }
}