Example #1
0
unsigned char *_( unsigned char *msg, struct terminal *term )
{
  if ( msg && msg )
  {
    if ( term[0] && current_charset != get_terminal_codepage( &term[0] ) )
    {
      bind_textdomain_codeset( "elinks", get_cp_mime_name( get_terminal_codepage( &term[0] ) ) );
      current_charset = get_terminal_codepage( &term[0] );
    }
  }
  return &ebx;
}
Example #2
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;
}
Example #3
0
void show_http_error_document( struct session *ses, void *data )
{
  struct terminal *term = ses->tab->term;
  struct cache_entry *cached;
  struct cache_entry *cache = find_in_cache( &((int*)data)[1] );
  unsigned char *str;
  cached = find_in_cache( &((int*)data)[1] );
  if ( cached || get_cache_entry( &((int*)data)[1] ) )
  {
    if ( 0 != 72 )
    {
      if ( term && current_charset != get_terminal_codepage( term ) )
      {
        bind_textdomain_codeset( "elinks", get_cp_mime_name( get_terminal_codepage( term ) ) );
        current_charset = get_terminal_codepage( term );
      }
      gettext( "HTTP error %03d" );
    }
    if ( init_string( ebp_32 ) == 0 )
    {
      if ( asprintfa( (char*)gettext( "HTTP error %03d" ) ) )
        mem_free( (void*)asprintfa( (char*)gettext( "HTTP error %03d" ) ) );
    }
    else
    {
      add_format_to_string( (struct string*)asprintfa( (char*)gettext( "HTTP error %03d" ) ), asprintfa( (char*)gettext( "HTTP error %03d" ) ) );
      if ( 0 != 32 )
      {
        if ( term && current_charset != get_terminal_codepage( term ) )
        {
          bind_textdomain_codeset( "elinks", get_cp_mime_name( get_terminal_codepage( term ) ) );
          current_charset = get_terminal_codepage( term );
        }
        gettext( "  An error occurred on the server while fetching the document you\n  requested. However, the server did not send back any explanation of what\n  happened, so it is unknown what went wrong. Please contact the web\n  server administrator about this, if you believe that this error should\n  not occur since it is not a nice behaviour from the web server at all\n  and indicates that there is some much deeper problem with the web server\n  software.\n" );
      }
      add_format_to_string( ebp_32, gettext( "  An error occurred on the server while fetching the document you\n  requested. However, the server did not send back any explanation of what\n  happened, so it is unknown what went wrong. Please contact the web\n  server administrator about this, if you believe that this error should\n  not occur since it is not a nice behaviour from the web server at all\n  and indicates that there is some much deeper problem with the web server\n  software.\n" ) );
      add_format_to_string( "  &lt;/p&gt;\n  &lt;p&gt;\n  URI: &lt;a href=\"%s\"&gt;%s&lt;/a&gt;\n", *(int*)(((int*)data)[1]) );
      add_format_to_string( ebp_32, " &lt;/p&gt;\n &lt;hr /&gt;\n &lt;/body&gt;\n&lt;/html&gt;\n" );
      if ( asprintfa( (char*)gettext( "HTTP error %03d" ) ) )
        mem_free( (void*)asprintfa( (char*)gettext( "HTTP error %03d" ) ) );
      str[0] = ebp_32;
      if ( ebp_32 )
      {
        int gettext_codepage = get_terminal_codepage( term );
        if ( cached )
          delete_entry_content( &cache[0] );
        if ( cache->content_type )
          mem_free( (void*)cache->content_type );
        cache->content_type = stracpy( "text/html" );
        if ( cache->head )
          mem_free( (void*)cache->head );
        cache->head = straconcat( "\r\nContent-Type: text/html; charset=" );
        add_fragment( &cache[0], (long long)0, &str[0] );
        mem_free( &str[0] );
        draw_formatted( ses, 1 );
      }
    }
  }
  done_uri( &((int*)data)[1] );
  mem_free( &((int*)data)[0] );
  return;
}
Example #4
0
unsigned char *get_progress_msg( struct progress *progress, struct terminal *term, int wide, int full, unsigned char *separator )
{
  int eax;
  int edx;
  struct string msg;
  int newlines;
  newlines/*.1_1of4*/ = *(char*)(( separator + strlen( (char*)separator ) ) - 1);
  if ( init_string( &msg ) == 0 )
  {
    return msg.source;
  }
  if ( 0 != 82 )
  {
    if ( term && current_charset != get_terminal_codepage( term ) )
    {
      bind_textdomain_codeset( "elinks", get_cp_mime_name( get_terminal_codepage( term ) ) );
      current_charset = get_terminal_codepage( term );
    }
    gettext( "Received" );
  }
  add_to_string( &msg, gettext( "Received" ) );
  add_char_to_string( &msg, 32 );
  add_xnum_to_string( &msg, progress->pos );
  if ( (int)(progress->size << 32) >= 0 )
  {
    add_char_to_string( &msg, 32 );
    if ( 0 != 111 )
    {
      if ( term && current_charset != get_terminal_codepage( term ) )
      {
        bind_textdomain_codeset( "elinks", get_cp_mime_name( get_terminal_codepage( term ) ) );
        current_charset = get_terminal_codepage( term );
      }
      gettext( "of" );
    }
    add_to_string( &msg, gettext( "of" ) );
    add_char_to_string( &msg, 32 );
    add_xnum_to_string( &msg, progress->size );
  }
  newlines = newlines/*.1_1of4*/ == 10;
  add_to_string( &msg, &separator[0] );
  if ( wide )
  {
    if ( *(char*)(newlines != 0 ? "average speed" : "Average speed") )
    {
      if ( term && current_charset != get_terminal_codepage( term ) )
      {
        bind_textdomain_codeset( "elinks", get_cp_mime_name( get_terminal_codepage( term ) ) );
        *ebp_48 = newlines != 0 ? "average speed" : "Average speed";
        current_charset = get_terminal_codepage( term );
      }
      return (unsigned char*)eax;
    }
    add_to_string( &ebx, &edx );
    add_char_to_string( &msg, 32 );
    add_xnum_to_string( &msg, progress->average_speed );
    add_to_string( &msg, "/s" );
    add_to_string( &msg, ", " );
    if ( *(char*)(full == 0 ? "current speed" : "cur") )
    {
      if ( term && current_charset != get_terminal_codepage( term ) )
      {
        bind_textdomain_codeset( "elinks", get_cp_mime_name( get_terminal_codepage( term ) ) );
        *ebp_48 = full == 0 ? "current speed" : "cur";
        current_charset = get_terminal_codepage( term );
      }
      return (unsigned char*)eax;
    }
    add_to_string( &ebx, &edx );
    add_char_to_string( &msg, 32 );
    add_xnum_to_string( &msg, progress->current_speed );
    add_to_string( &msg, "/s" );
    add_to_string( &msg, &separator[0] );
    if ( *(char*)(newlines != 0 ? "elapsed time" : "Elapsed time") )
    {
      if ( term && current_charset != get_terminal_codepage( term ) )
      {
        bind_textdomain_codeset( "elinks", get_cp_mime_name( get_terminal_codepage( term ) ) );
        current_charset = get_terminal_codepage( term );
      }
    }
    add_to_string( &ebx, &edi );
    add_char_to_string( &msg, 32 );
    add_timeval_to_string( &msg, &progress[0].elapsed );
  }
  else
  {
    if ( *(char*)(newlines != 0 ? "speed" : "Speed") )
    {
      if ( term && current_charset != get_terminal_codepage( term ) )
      {
        bind_textdomain_codeset( "elinks", get_cp_mime_name( get_terminal_codepage( term ) ) );
        current_charset = get_terminal_codepage( term );
      }
      gettext( newlines != 0 ? "speed" : "Speed" );
    }
    add_to_string( &msg, gettext( newlines != 0 ? "speed" : "Speed" ) );
    add_char_to_string( &msg, 32 );
    add_xnum_to_string( &msg, progress->average_speed );
    add_to_string( &msg, "/s" );
  }
  if ( (int)(progress->size << 32) >= 0 && (int)(progress->loaded << 32) >= 0 )
  {
    if ( ccdep1 <= ccdep2 )
    {
      if ( (int)(progress->loaded & 0xFFFFFFFF) >= 1 )
      {
      }
    }
    add_to_string( &msg, ", " );
    if ( *(char*)(full == 0 ? "estimated time" : "ETA") )
    {
      if ( term && current_charset != get_terminal_codepage( term ) )
      {
        bind_textdomain_codeset( "elinks", get_cp_mime_name( get_terminal_codepage( term ) ) );
        current_charset = get_terminal_codepage( term );
      }
    }
    add_to_string( &ebx, &edi );
    add_char_to_string( &msg, 32 );
    add_timeval_to_string( &msg, &progress->estimated_time );
  }
  return msg.source;
}