int main(int argc, char **argv) { int i; t_option_struct option_struct; i = 0; option_struct.pathname = malloc(sizeof(char*)); option_struct.pathname[0] = NULL; if (get_option(argc, argv, &option_struct) == 1) { my_printf("\nmy_ls: invalid option\n"); return (1); } if (option_struct.pathname[0] != NULL) while (option_struct.pathname[i] != NULL) { my_printf("\n%s:\n", option_struct.pathname[i]); get_files_list(option_struct.pathname[i], &option_struct); if (option_struct.R == 1) recursivity(option_struct.pathname[i], &option_struct); i++; } else { get_files_list(".", &option_struct); if (option_struct.R == 1) recursivity(".", &option_struct); } return (0); }
int main(int argc, char** argv){ setlocale(LC_ALL, "en_US.utf8"); initial_check(); get_files_list(); ESCDELAY = 1; menu_index = 0; previous_index = -1; initscr(); noecho(); keypad(stdscr, TRUE); getmaxyx(stdscr,rows,cols); diff_col_width = cols/2-1; start_color(); use_default_colors(); init_pair(1, COLOR_RED, -1); init_pair(2, COLOR_GREEN, -1); init_pair(3, COLOR_CYAN, -1); refresh(); print_files_menu(); show_git_diff(); ch = getch(); while(ch != 27 && ch != 'q'){ switch(ch){ case KEY_UP: move_menu(-1); break; case KEY_DOWN: move_menu(1); break; case 'h': show_help(); break; case '?': show_help(); break; case ' ': check_row(); break; case 'a': check_all(); break; case 'c': open_system_index_add_window(); break; } ch = getch(); } endwin(); git_threads_shutdown(); return(EXIT_SUCCESS); }
/** Works like the main function of the program, it calls almost all other functions */ void run() { char **files = get_files_list(); read_matrix_from_file(files[1], 1); if (error_flag == 1) return; read_matrix_from_file(files[2], 2); if (error_flag == 1) return; post_read(); if (error_flag == 1) return; calculate_without_threads(); calculate_element_by_element(); calculate_row_by_row(); write_matrix_to_file(files[3]); print_statistics(); }
int recursivity(char *pathname,t_option_struct *option_struct) { DIR *dirp; struct dirent *entry; char *new_pathname; if ((dirp = opendir(pathname)) == NULL) return (1); while ((entry = readdir(dirp)) != NULL) { if (entry->d_name[0] != '.' && entry->d_type == 4) { new_pathname = add_str_m(pathname, entry->d_name); my_printf("\n%s:\n", new_pathname); get_files_list(new_pathname, option_struct); recursivity(new_pathname, option_struct); free(new_pathname); } } closedir(dirp); return(0); }