-bool read_connection_config(connection_t *c) {
- list_node_t *node, *next;
- size_t name_len = strlen(c->name);
- char *fname;
- bool x;
-
- read_config_options(c->config_tree, c->name);
-
- xasprintf(&fname, "%s/hosts/%s", confbase, c->name);
- x = read_config_file(c->config_tree, fname);
- free(fname);
-
- return x;
-}
-
-FILE *ask_and_open(const char *filename, const char *what) {
- FILE *r;
- char *directory;
- char line[PATH_MAX];
- const char *fn;
-
- /* Check stdin and stdout */
- if(!isatty(0) || !isatty(1)) {
- /* Argh, they are running us from a script or something. Write
- the files to the current directory and let them burn in hell
- for ever. */
- fn = filename;
- } else {
- /* Ask for a file and/or directory name. */
- fprintf(stdout, "Please enter a file to save %s to [%s]: ",
- what, filename);
- fflush(stdout);
+ // And we try to read the ones that end with ".conf"
+ if(l > 5 && !strcmp(".conf", & ep->d_name[ l - 5 ])) {
+ snprintf(fname, sizeof(fname), "%s" SLASH "%s", dname, ep->d_name);
+ x = read_config_file(config_tree, fname, true);
+ }
+ }