/* Read and parse one included syntax file. */ static void parse_one_include(char *file) { FILE *rcstream; /* Don't open directories, character files, or block files. */ if (!is_good_file(file)) return; /* Open the included syntax file. */ rcstream = fopen(file, "rb"); if (rcstream == NULL) { rcfile_error(_("Error reading %s: %s"), file, strerror(errno)); return; } /* Use the name and line number position of the included syntax file * while parsing it, so we can know where any errors in it are. */ nanorc = file; lineno = 0; #ifdef DEBUG fprintf(stderr, "Parsing file \"%s\"\n", file); #endif parse_rcfile(rcstream, TRUE); }
int copy(const char *in_object) { char object[PATH_SIZE]; strcpy(object, in_object); struct stat buf; // log_add(DEBUGGING, "In copy %s\n", object); if (stat(object, &buf) != 0) { log_add(FATAL, "stat failed\n"); return errno; } if(S_ISDIR(buf.st_mode)) { DIR *dir; struct dirent *entry; if ((dir = opendir(object)) == 0) { log_add(FATAL, "Can't open directory\n"); return errno; } set_dir(get_filename(object), buf.st_mode); while ((entry = readdir(dir)) != NULL) { // log_add(DEBUGGING, "In while\n"); // log_add(DEBUGGING, "object is %s\n", object); //log_add(DEBUGGING, "file %s\n", entry->d_name); if (is_good_file(entry->d_name)) { strcat(object, "/"); strcat(object, entry->d_name); copy(object); object[strlen(object)-strlen(entry->d_name)-1] = '\0'; } } closedir(dir); prev_dir(); } else { // log_add(DEBUGGING, "It's file: %s\n", object); copy_file(object, curr_out_dir()); } return 0; }