示例#1
0
文件: progress.c 项目: aixoss/wget
void *
progress_create (const char *f_download, wgint initial, wgint total)
{
  /* Check if the log status has changed under our feet. */
  if (output_redirected)
    {
      if (!current_impl_locked)
        set_progress_implementation (FALLBACK_PROGRESS_IMPLEMENTATION);
      output_redirected = 0;
    }

  return current_impl->create (f_download, initial, total);
}
示例#2
0
/*!
@brief download a file.

@return uerr_t - the error value after downloading a file.
@see wget
*/
uerr_t classDownloader::getFile(bool bUseProgress)
{
	uerr_t err_value=RETROK;
	int index;

  	char *filename = NULL, *redirected_URL = NULL;
  	int dt;

  	if (opt.verbose == -1){
                opt.verbose = !opt.quiet;
	}

  	if (opt.verbose && opt.quiet){
  		cout<<"Can't be verbose and quiet at the same time."<<endl;
    		exit (1);
    	}

  	if (opt.timestamping && opt.noclobber){
    		cout<<"Can't timestamp and not clobber old files at the same time."<<endl;
    		exit (1);
    	}

  	if (opt.verbose){
    		set_progress_implementation (opt.progress_type);
	}

	if(bUseProgress){
		SetGetFileCallBack(GetFileCallBack);
	}else{
		SetGetFileCallBack(NULL);
	}
	
	pushFileName();
	
	err_value=retrieve_url(m_strUrl.c_str(), &filename, &redirected_URL, NULL, &dt);
  
  	return err_value;
}