netcdf-c/ncdump/tst_rcmerge.c
Dennis Heimbigner 6b69b9c52c Significantly Improve Amazon S3 Cloud Storage Support
## S3 Related Fixes

* Add comprehensive support for specifying AWS profiles to provide access credentials.
* Parse the files "~/.aws/config" and "~/.aws/credentials to provide credentials for the HDF5 ROS3 driver and to locate default region.
* Add a function to obtain the currently active S3 credentials. The search rules are defined in docs/nczarr.md.
* Provide documentation for the new features.
* Modify the struct NCauth (in include/ncauth.h) to replace specific S3 credentials with a profile name.
* Add a unit test to test the operation of profile and credentials management.
* Add support for URLS of the form "s3://<bucket>/<key>"; this requires obtaining a default region.
* Allows the specification of profile and/or region in a URL of the form "#mode=nczarr,...&aws.region=...&aws.profile=..."

## Misc. Fixes

* Move the ezxml code to libdispatch so that it can be used both by DAP4 and nczarr.
* Modify nclist to provide a deep clone operation.
* Modify ncuri to provide a deep clone operation.
* Modify the .rc file format to allow the specification of a path to be tested when looking for an entry in the .rc file.
* Ensure that the NC_rcload function is called.
* Modify nchttp to support setting request headers.
2021-09-27 18:36:33 -06:00

44 lines
958 B
C

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "netcdf.h"
#include "ncrc.h"
int
main(int argc, char** argv)
{
size_t i,nentries = 0;
NCRCglobalstate* ngs = ncrc_getglobalstate();
NCRCinfo* info = NULL;
NCRCentry* entry = NULL;
/* Cause the .rc files to be read and merged */
nc_initialize();
if((ngs = ncrc_getglobalstate())==NULL) abort();
info = &ngs->rcinfo;
if(info->ignore) {
fprintf(stderr,".rc ignored\n");
exit(0);
}
/* Print out the .rc entries */
if((nentries = NC_rcfile_length(info))==0) {
printf("<empty>\n");
exit(0);
}
for(i=0;i<nentries;i++) {
entry = NC_rcfile_ith(info,i);
if(entry == NULL) abort();
if(entry->host != NULL) {
printf("[%s ",entry->host);
if(entry->path != NULL)
printf("/%s] ",entry->path);
printf("]");
}
printf("|%s|->|%s|\n",entry->key,entry->value);
}
return 0;
}