⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 transfer.c

📁 一个linux下的ftp程序。它是使用文件传输协议的一系列程序的集合。
💻 C
📖 第 1 页 / 共 3 页
字号:
        }      if (st)        {          tdata->stalled = 1;          g_snprintf (dlstr, sizeof (dlstr),	  	  _("Recv %s of %s, transfer stalled, unknown time remaining"),		  gotstr, ofstr);        }    }  g_static_mutex_unlock (&tdata->statmutex);  gtk_ctree_node_set_text (GTK_CTREE (dlwdw), tdata->user_data, 1, totstr);    gftp_lookup_global_option ("show_trans_in_title", &show_trans_in_title);  if (gftp_file_transfers->data == tdata && show_trans_in_title)    {      g_snprintf (winstr, sizeof(winstr),  "%s: %s", gftp_version, totstr);      gdk_window_set_title (gtk_widget_get_parent_window (GTK_WIDGET(dlwdw)),                            winstr);    }  if (*dlstr != '\0')    gtk_ctree_node_set_text (GTK_CTREE (dlwdw), tempfle->user_data, 1, dlstr);}static voidupdate_window_transfer_bytes (gftp_window_data * wdata){  char *tempstr, *temp1str;  if (wdata->request->gotbytes == -1)    {      update_window_info ();      wdata->request->gotbytes = 0;    }  else    {      tempstr = insert_commas (wdata->request->gotbytes, NULL, 0);      temp1str = g_strdup_printf (_("Retrieving file names...%s bytes"),                                   tempstr);      gtk_label_set (GTK_LABEL (wdata->hoststxt), temp1str);      g_free (tempstr);      g_free (temp1str);    }}gintupdate_downloads (gpointer data){  intptr_t do_one_transfer_at_a_time, start_transfers;  GList * templist, * next;  gftp_transfer * tdata;  if (gftp_file_transfer_logs != NULL)    display_cached_logs ();  if (window1.request->gotbytes != 0)    update_window_transfer_bytes (&window1);  if (window2.request->gotbytes != 0)    update_window_transfer_bytes (&window2);  if (gftpui_common_child_process_done)    check_done_process ();  for (templist = gftp_file_transfers; templist != NULL;)    {      tdata = templist->data;      if (tdata->ready)        {          g_static_mutex_lock (&tdata->structmutex);	  if (tdata->next_file)	    on_next_transfer (tdata);     	  else if (tdata->show) 	    show_transfer (tdata);	  else if (tdata->done)	    {	      next = templist->next;              g_static_mutex_unlock (&tdata->structmutex);	      transfer_done (templist);	      templist = next;	      continue;	    }	  if (tdata->curfle != NULL)	    {              gftp_lookup_global_option ("one_transfer",                                          &do_one_transfer_at_a_time);              gftp_lookup_global_option ("start_transfers", &start_transfers);	      if (!tdata->started && start_transfers &&                 (num_transfers_in_progress == 0 || !do_one_transfer_at_a_time))                create_transfer (tdata);	      if (tdata->started)                update_file_status (tdata);	    }          g_static_mutex_unlock (&tdata->structmutex);        }      templist = templist->next;    }  gtk_timeout_add (500, update_downloads, NULL);  return (0);}voidstart_transfer (gpointer data){  gftpui_common_curtrans_data * transdata;  GtkCTreeNode * node;  if (GTK_CLIST (dlwdw)->selection == NULL)    {      ftp_log (gftp_logging_error, NULL,	       _("There are no file transfers selected\n"));      return;    }  node = GTK_CLIST (dlwdw)->selection->data;  transdata = gtk_ctree_node_get_row_data (GTK_CTREE (dlwdw), node);  g_static_mutex_lock (&transdata->transfer->structmutex);  if (!transdata->transfer->started)    create_transfer (transdata->transfer);  g_static_mutex_unlock (&transdata->transfer->structmutex);}voidstop_transfer (gpointer data){  gftpui_common_curtrans_data * transdata;  GtkCTreeNode * node;  if (GTK_CLIST (dlwdw)->selection == NULL)    {      ftp_log (gftp_logging_error, NULL,	      _("There are no file transfers selected\n"));      return;    }  node = GTK_CLIST (dlwdw)->selection->data;  transdata = gtk_ctree_node_get_row_data (GTK_CTREE (dlwdw), node);  g_static_mutex_lock (&transdata->transfer->structmutex);  if (transdata->transfer->started)    {      transdata->transfer->cancel = 1;      transdata->transfer->fromreq->cancel = 1;      transdata->transfer->toreq->cancel = 1;      transdata->transfer->skip_file = 0;    }  else    transdata->transfer->done = 1;  g_static_mutex_unlock (&transdata->transfer->structmutex);  ftp_log (gftp_logging_misc, NULL, _("Stopping the transfer on host %s\n"),	   transdata->transfer->fromreq->hostname);}voidskip_transfer (gpointer data){  gftpui_common_curtrans_data * transdata;  GtkCTreeNode * node;  gftp_file * curfle;  char *file;  if (GTK_CLIST (dlwdw)->selection == NULL)    {      ftp_log (gftp_logging_error, NULL,	      _("There are no file transfers selected\n"));      return;    }  node = GTK_CLIST (dlwdw)->selection->data;  transdata = gtk_ctree_node_get_row_data (GTK_CTREE (dlwdw), node);  g_static_mutex_lock (&transdata->transfer->structmutex);  if (transdata->transfer->curfle != NULL)    {      curfle = transdata->transfer->curfle->data;      if (transdata->transfer->started)        {          transdata->transfer->cancel = 1;          transdata->transfer->fromreq->cancel = 1;          transdata->transfer->toreq->cancel = 1;          transdata->transfer->skip_file = 1;        }      curfle->transfer_action = GFTP_TRANS_ACTION_SKIP;      file = curfle->file;    }  else    file = NULL;  g_static_mutex_unlock (&transdata->transfer->structmutex);  ftp_log (gftp_logging_misc, NULL, _("Skipping file %s on host %s\n"),            file, transdata->transfer->fromreq->hostname);}voidremove_file_transfer (gpointer data){  gftpui_common_curtrans_data * transdata;  GtkCTreeNode * node;  gftp_file * curfle;  if (GTK_CLIST (dlwdw)->selection == NULL)    {      ftp_log (gftp_logging_error, NULL,              _("There are no file transfers selected\n"));      return;    }  node = GTK_CLIST (dlwdw)->selection->data;  transdata = gtk_ctree_node_get_row_data (GTK_CTREE (dlwdw), node);  if (transdata->curfle == NULL || transdata->curfle->data == NULL)    return;  curfle = transdata->curfle->data;  if (curfle->transfer_action & GFTP_TRANS_ACTION_SKIP)    return;  g_static_mutex_lock (&transdata->transfer->structmutex);  curfle->transfer_action = GFTP_TRANS_ACTION_SKIP;  if (transdata->transfer->started &&      transdata->curfle == transdata->transfer->curfle)    {      transdata->transfer->cancel = 1;      transdata->transfer->fromreq->cancel = 1;      transdata->transfer->toreq->cancel = 1;      transdata->transfer->skip_file = 1;    }  else if (transdata->curfle != transdata->transfer->curfle &&           !curfle->transfer_done)    {      gtk_ctree_node_set_text (GTK_CTREE (dlwdw), curfle->user_data, 1,                               _("Skipped"));      transdata->transfer->total_bytes -= curfle->size;    }  g_static_mutex_unlock (&transdata->transfer->structmutex);  ftp_log (gftp_logging_misc, NULL, _("Skipping file %s on host %s\n"),           curfle->file, transdata->transfer->fromreq->hostname);}voidmove_transfer_up (gpointer data){  GList * firstentry, * secentry, * lastentry;  gftpui_common_curtrans_data * transdata;  GtkCTreeNode * node;  if (GTK_CLIST (dlwdw)->selection == NULL)    {      ftp_log (gftp_logging_error, NULL,	      _("There are no file transfers selected\n"));      return;    }  node = GTK_CLIST (dlwdw)->selection->data;  transdata = gtk_ctree_node_get_row_data (GTK_CTREE (dlwdw), node);  if (transdata->curfle == NULL)    return;  g_static_mutex_lock (&transdata->transfer->structmutex);  if (transdata->curfle->prev != NULL && (!transdata->transfer->started ||      (transdata->transfer->curfle != transdata->curfle &&        transdata->transfer->curfle != transdata->curfle->prev)))    {      if (transdata->curfle->prev->prev == NULL)        {          firstentry = transdata->curfle->prev;          lastentry = transdata->curfle->next;          transdata->transfer->files = transdata->curfle;          transdata->curfle->next = firstentry;          transdata->transfer->files->prev = NULL;          firstentry->prev = transdata->curfle;          firstentry->next = lastentry;          if (lastentry != NULL)            lastentry->prev = firstentry;        }      else        {          firstentry = transdata->curfle->prev->prev;          secentry = transdata->curfle->prev;          lastentry = transdata->curfle->next;          firstentry->next = transdata->curfle;          transdata->curfle->prev = firstentry;          transdata->curfle->next = secentry;          secentry->prev = transdata->curfle;          secentry->next = lastentry;          if (lastentry != NULL)            lastentry->prev = secentry;        }      gtk_ctree_move (GTK_CTREE (dlwdw),                       ((gftp_file *) transdata->curfle->data)->user_data,                      transdata->transfer->user_data,                       transdata->curfle->next != NULL ?                          ((gftp_file *) transdata->curfle->next->data)->user_data: NULL);    }  g_static_mutex_unlock (&transdata->transfer->structmutex);}voidmove_transfer_down (gpointer data){  GList * firstentry, * secentry, * lastentry;  gftpui_common_curtrans_data * transdata;  GtkCTreeNode * node;  if (GTK_CLIST (dlwdw)->selection == NULL)    {      ftp_log (gftp_logging_error, NULL,	      _("There are no file transfers selected\n"));      return;    }  node = GTK_CLIST (dlwdw)->selection->data;  transdata = gtk_ctree_node_get_row_data (GTK_CTREE (dlwdw), node);  if (transdata->curfle == NULL)    return;  g_static_mutex_lock (&transdata->transfer->structmutex);  if (transdata->curfle->next != NULL && (!transdata->transfer->started ||      (transdata->transfer->curfle != transdata->curfle &&        transdata->transfer->curfle != transdata->curfle->next)))    {      if (transdata->curfle->prev == NULL)        {          firstentry = transdata->curfle->next;          lastentry = transdata->curfle->next->next;          transdata->transfer->files = firstentry;          transdata->transfer->files->prev = NULL;          transdata->transfer->files->next = transdata->curfle;          transdata->curfle->prev = transdata->transfer->files;          transdata->curfle->next = lastentry;          if (lastentry != NULL)            lastentry->prev = transdata->curfle;        }      else        {          firstentry = transdata->curfle->prev;          secentry = transdata->curfle->next;          lastentry = transdata->curfle->next->next;          firstentry->next = secentry;          secentry->prev = firstentry;          secentry->next = transdata->curfle;          transdata->curfle->prev = secentry;          transdata->curfle->next = lastentry;          if (lastentry != NULL)            lastentry->prev = transdata->curfle;        }      gtk_ctree_move (GTK_CTREE (dlwdw),                       ((gftp_file *) transdata->curfle->data)->user_data,                      transdata->transfer->user_data,                       transdata->curfle->next != NULL ?                          ((gftp_file *) transdata->curfle->next->data)->user_data: NULL);    }  g_static_mutex_unlock (&transdata->transfer->structmutex);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -