Skip to content

AFNI/NIfTI Server

Sections
Personal tools
You are here: Home » AFNI » Documentation

Doxygen Source Code Documentation


Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Search  

myget.c

Go to the documentation of this file.
00001 #include "thd_iochan.h"
00002 
00003 int main( int argc , char * argv[] )
00004 {
00005    char * buf ;
00006    int    nbuf , iarg=1 ;
00007 
00008    if( argc < 2 ){ fprintf(stderr,"Usage: myget [-1] URL > filename\n"); exit(0) ; }
00009 
00010    if( strcmp(argv[iarg],"-1") == 0 ){
00011      set_HTTP_10( 1 ) ; set_HTTP_user_agent( "myget" ) ; iarg++ ;
00012      if( iarg >= argc ) exit(1) ;
00013    }
00014 
00015    set_URL_progress(1) ;
00016    nbuf = read_URL( argv[iarg] , &buf ) ;
00017    if( nbuf <= 0 ){ fprintf(stderr,"Can't open URL %s\n",argv[iarg]) ; exit(1) ; }
00018 
00019    fwrite( buf , 1 , nbuf , stdout ) ;
00020    fflush(stdout) ;
00021    free(buf) ;
00022    fprintf(stderr,"Wrote out URL %s\n",argv[iarg]) ;
00023    exit(0) ;
00024 }
 

Powered by Plone

This site conforms to the following standards: