Exemplo n.º 1
0
void bookmarks_read( void )
{
  int eax;
  int backend_num = *(int*)(get_opt_( config_options, (unsigned char*)config_options ));
  struct bookmarks_backend *backend = bookmarks_backends[ *(int*)(get_opt_( config_options, (unsigned char*)config_options )) ];
  unsigned char *file_name;
  FILE *f;
  if ( bookmarks_backends[ *(int*)(get_opt_( config_options, (unsigned char*)config_options )) ] && backend->read && backend && eax( 0 ) && ( elinks_home == 0 || straconcat( elinks_home ) ) )
  {
    fopen64( (char*)straconcat( elinks_home ), "rb" );
    if ( elinks_home )
    {
      mem_free( (void*)straconcat( elinks_home ) );
      *ebp_28 = ebp_28;
    }
    if ( f->_flags )
    {
      backend->read( &f[0] );
      fclose( &f[0] );
      bookmarks_unset_dirty(  );
      loaded_backend_num = backend_num;
    }
  }
  return;
}
Exemplo n.º 2
0
void bookmarks_write( struct list_head_elinks *bookmarks_list )
{
  int backend_num = *(int*)(get_opt_( config_options, (unsigned char*)config_options ));
  struct bookmarks_backend *backend = bookmarks_backends[ *(int*)(get_opt_( config_options, (unsigned char*)config_options )) ];
  struct secure_save_info *ssi;
  unsigned char *file_name;
  if ( ( bookmarks_are_dirty(  ) || loaded_backend_num != backend_num ) && backend[0] && backend->write && elinks_home && backend )
  {
    eax( 1 );
    if ( file_name && straconcat( elinks_home ) )
    {
      mem_free( &file_name );
      if ( secure_open( straconcat( elinks_home ) ) )
      {
        backend->write( &ssi[0], &bookmarks_list[0] );
        if ( eax )
        {
          backend_num = backend_num;
        }
        else
        {
        }
      }
    }
  }
  return;
}
Exemplo n.º 3
0
void abort_download_and_beep( struct file_download *file_download, struct terminal *term )
{
  if ( term[0] && file_download->notify + *(int*)(get_opt_( config_options, (unsigned char*)config_options )) > 1 )
    beep_terminal( &term[0] );
  abort_download( &file_download[0] );
  return;
}
Exemplo n.º 4
0
void init_mimetypes( struct module *module )
{
  static struct change_hook_info mimetypes_change_hooks[2] = { { "mime.mimetypes", &change_hook_mimetypes }
, { 0, 0 }
 };
  register_change_hooks( mimetypes_change_hooks );
  if ( *(int*)(get_opt_( cmdline_options, (unsigned char*)cmdline_options )) )
  {
    mimetypes_options[1].option_elinks.value.tree = 0;
  }
  return;
}
Exemplo n.º 5
0
void download_data_store( struct download *download, struct file_download *file_download )
{
  struct terminal *term = file_download->term;
  assert_terminal_ptr_not_dangling( file_download->term );
  if ( assert_failed )
  {
    assert_failed = 0;
    file_download->term = 0;
    abort_download( &file_download[0] );
    term = &term[0];
    return;
  }
  else
  {
    if ( term[0].next == 0 )
    {
      abort_download( &file_download[0] );
      term = &term[0];
      return;
    }
    else
    {
      if ( download->state.basic >= 0 )
      {
        if ( file_download->dlg_data )
        {
          redraw_dialog( file_download->dlg_data, 1 );
          return;
        }
        else
        {
          return;
        }
      }
      else
      {
        if ( file_download->dlg_data != -100000 )
        {
          unsigned char *url = get_uri_string( file_download->uri, URI_PUBLIC );
          struct connection_state state = download->state;
          state.syserr = download->state.syserr;
          abort_download_and_beep( &file_download[0], &term[0] );
          if ( url )
          {
            info_box( &term[0], MSGBOX_FREE_TEXT, "Download error", ALIGN_CENTER );
            mem_free( (void*)url );
            return;
          }
          else
          {
            return;
          }
        }
        else
        {
          if ( file_download->external_handler )
          {
            close( file_download->handle );
            file_download->handle = -1;
            exec_on_terminal( &term[0], file_download->external_handler, file_download->file, ( (int)file_download->bits_at_104/*.1_1of4*/ >> 2 ) & 1 );
            file_download->bits_at_104/*.1_1of4*/ &= 254;
            abort_download_and_beep( &file_download[0], &term[0] );
            return;
          }
          else
          {
            if ( file_download->notify )
            {
              unsigned char *url;
              url[0] = get_uri_string( file_download->uri, URI_PUBLIC );
              done_download_display( &file_download[0] );
              if ( url[0] )
              {
                info_box( &term[0], MSGBOX_FREE_TEXT, "Download", ALIGN_CENTER );
                mem_free( &url[0] );
              }
            }
            if ( file_download->remotetime && *(int*)(get_opt_( config_options, (unsigned char*)config_options )) )
            {
              struct utimbuf foo;
              foo.modtime = file_download->remotetime;
              foo.actime = file_download->remotetime;
              utime( (char*)file_download->file, &foo.actime );
            }
            abort_download_and_beep( &file_download[0], &term[0] );
            return;
          }
        }
      }
    }