Doxygen Source Code Documentation
myget.c File Reference
#include "thd_iochan.h"
Go to the source code of this file.
Functions | |
int | main (int argc, char *argv[]) |
Function Documentation
|
\** File : SUMA.c
Input paramters :
Definition at line 3 of file myget.c. References argc, free, read_URL(), set_HTTP_10(), set_HTTP_user_agent(), and set_URL_progress().
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 } |