Example #1
0
static void
tab_compl_n(struct dialog_data *dlg_data, unsigned char *item, int len)
{
	struct widget_data *widget_data = selected_widget(dlg_data);

	assert(widget_is_textfield(widget_data));

	int_upper_bound(&len, widget_data->widget->datalen - 1);
	memcpy(widget_data->cdata, item, len);
	widget_data->cdata[len] = 0;
	widget_data->info.field.cpos = len;
	widget_data->info.field.vpos = 0;

	redraw_dialog(dlg_data, 1);
}
Example #2
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;
          }
        }
      }
    }