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