Open Ulrond opened 4 months ago
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#define MAX_FILES 10 // Maximum number of files to handle
int main(int argc, char *argv[]) {
int opt;
char *filenames[MAX_FILES];
int fileCount = 0;
const char *optString = "f:";
while ((opt = getopt(argc, argv, optString)) != -1) {
switch (opt) {
case 'f':
if (fileCount < MAX_FILES) {
filenames[fileCount++] = optarg;
} else {
fprintf(stderr, "Error: Maximum number of files reached.\n");
exit(EXIT_FAILURE);
}
break;
default:
fprintf(stderr, "Usage: %s [-f filename]...\n", argv[0]); // Notice the "..."
exit(EXIT_FAILURE);
}
}
printf("Processing %d files:\n", fileCount);
for (int i = 0; i < fileCount; i++) {
printf(" - %s\n", filenames[i]);
// Do something with each file (e.g., call your process_node function)
}
return 0;
}
./your_program -f file1.yaml -f file2.json -f http://example.com/config.yaml
we should be able to support this via changing the input file to ut-control-kvp-open to something like this !include <file>
, which appends the included file into the instance. or !include <http://url>
Consideration
it would be good if we can support
And all the profiles get merged together, in a single entry. I realise this means that instead of supporting file based
kvp
, in the backend we would need to support adding a new function tokvp
. Since we haveopen
- which opens the first file, we can introduceread
which basically appends to the currentut_kvp_instance_t
with extra data..or we change the basic configuration for
open
, to alwaysappend
to the already open data..