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

📄 sender_output_th.c

📁 这个程序实现了FLUTE协议
💻 C
字号:
/* $Author: peltotas $ $Date: 2006/03/16 13:02:07 $ $Revision: 1.14 $ *//* *   MAD-FLUTELIB: Implementation of FLUTE protocol. *   Copyright (c) 2003-2006 TUT - Tampere University of Technology *   main authors/contacts: jani.peltotalo@tut.fi and sami.peltotalo@tut.fi * *   This program is free software; you can redistribute it and/or modify *   it under the terms of the GNU General Public License as published by *   the Free Software Foundation; either version 2 of the License, or *   (at your option) any later version. * *   This program is distributed in the hope that it will be useful, *   but WITHOUT ANY WARRANTY; without even the implied warranty of *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the *   GNU General Public License for more details. * *   You should have received a copy of the GNU General Public License *   along with this program; if not, write to the Free Software *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */#include "flute_inc.h"/**** Private function ****/void print_sender_info(sender_output_th_args_t *args);/*   * This function. *  * Params:      void *a:.  * * Return:      void * */void* sender_output_thread(void *a) {    sender_output_th_args_t *args;  args = (sender_output_th_args_t *)a;  while(get_session_state(args->s_id) == SActive) {    print_sender_info(args);#ifdef WIN32	Sleep(1000);#else	sleep(1);#endif  }#ifdef WIN32  _endthread();#else  pthread_exit(0);#endif	return NULL;}/* * This function. * * Params:      sender_output_th_args_t *args:. * * Return:      void * */void print_sender_info(sender_output_th_args_t *args) {  alc_session_t *s;    file_t *next_file;  file_t *file;    s = get_alc_session(args->s_id);#ifdef WIN32  system("cls");#else  printf("\e[H\e[J");#endif  if(s->cc_id == 0 && s->nb_channel == 1) {     printf("%-7s%-7s%-13s%-52s\n\n", "TOI", "Tx[%]", "Size[B]", "File");  }  else {    printf("%-7s%-13s%-59s\n\n", "TOI", "Size[B]", "File");  }    next_file = args->fdt->file_list;    while(next_file != NULL) {    file = next_file;    #ifdef WIN32    printf("%-7I64u", file->toi);#else     printf("%-7llu", file->toi);#endif    if(s->cc_id == 0 && s->nb_channel == 1) {          if(get_session_tx_toi(args->s_id) == file->toi) {      #ifdef WIN32	printf("%-7.2f", (double)((double)100 *				  ((double)(LONGLONG)get_object_sent_bytes(s->s_id)/(double)(LONGLONG)file->file_len)));#else	printf("%-7.2f", (double)((double)100 *				  ((double)(long long)get_object_sent_bytes(s->s_id)/(double)(long long)file->file_len)));#endif      }      else {	printf("%-7.s", "");      }    }      #ifdef WIN32    printf("%-13I64u",  file->file_len);#else    printf("%-13llu",  file->file_len);#endif        if(s->cc_id == 0 && s->nb_channel == 1) {      printf("%-52s\n",  file->location);    }    else {      printf("%-59s\n",  file->location);    }        fflush(stdout);        next_file = file->next;  }}

⌨️ 快捷键说明

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