00001 #include <stdio.h> 00002 #include <getopt.h> 00003 #include <stdlib.h> 00004 #include "aws4c.h" 00005 00006 00007 00008 00009 int main ( int argc, char * argv[] ) 00010 { 00011 puts ( "Curl Requester" ); 00012 00013 00014 00015 aws_init (); 00016 aws_set_debug ( 1 ); 00017 int rc = aws_read_config ( "sample" ); 00018 if ( rc ) 00019 { 00020 puts ( "Could not found a credential in the the config file" ); 00021 puts ( "Make your ~/.awsAuth file is correct" ); 00022 exit ( 1 ); 00023 } 00024 00025 s3_set_host ( "s3.amazonaws.com"); 00026 s3_set_bucket ("aws4c.samples"); 00027 00028 00029 IOBuf * bf = aws_iobuf_new (); 00030 int rv = s3_get ( bf, "aws4c.samplefile" ); 00031 00032 printf ( "RV %d\n", rv ); 00033 00034 printf ( "CODE [%d] \n", bf->code ); 00035 printf ( "RESULT [%s] \n", bf->result ); 00036 printf ( "LEN [%d] \n", bf->len ); 00037 printf ( "LASTMOD [%s] \n", bf->lastMod ); 00038 printf ( "ETAG [%s] \n", bf->eTag ); 00039 00040 while(-1) 00041 { 00042 char Ln[1024]; 00043 int sz = aws_iobuf_getline ( bf, Ln, sizeof(Ln)); 00044 if ( Ln[0] == 0 ) break; 00045 printf ( "S[%3d] %s", sz, Ln ); 00046 } 00047 00048 aws_iobuf_free ( bf ); 00049 00050 }
Generated by Doxygen