void navega(PNO H) { int ini = 3, fim = 24, pos = 3; int c = ' '; int close = 0; char path[256]; PNO p_ini, p_pos, p_fim; p_pos = NULL; strcpy(path, "C:\\*.*"); init_dir(&H, path, &p_ini, &p_pos, &p_fim, ini, &pos, fim); while (!close) { if (c != ' ') { c = getch(); if (c == 0) c = getch(); } else c = 0; switch (c) { case esc: funcao_sair(ini, &close); break; case up: funcao_up(&p_ini, &p_pos, &p_fim, ini, &pos, fim); break; case down: funcao_down(&p_ini, &p_pos, &p_fim, ini, &pos, fim); break; case pgup: funcao_pgup(&p_ini, &p_pos, &p_fim, ini, &pos, fim); break; case pgdown: funcao_pgdown(&p_ini, &p_pos, &p_fim, ini, &pos, fim); break; case enter: funcao_enter(&H, path, &p_ini, &p_pos, &p_fim, ini, &pos, fim); break; case t_um: funcao_conf(&p_ini, path, ini, &pos, fim); break; case t_c: funcao_conf(&p_ini, path, ini, &pos, fim); break; case t_dois: funcao_info(ini); break; case t_i: funcao_info(ini); break; case t_tres: funcao_sair(ini, &close); break; case t_s: funcao_sair(ini, &close); break; } } desaloca(&H); }
int main (int argc, char *argv[]) { // debugoff(); debugon(); FN; init_dir(); init_shell(NULL); init_cmd(); return shell(); }
int main(int argc, char **argv) { char * path; char dirname[256]; unsigned int u, p, i; struct ext2_inode new_inode; struct ext2_dir_entry_2 new_dir; struct ext2_inode * parent_inode; if(argc != 3) { fprintf(stderr, "Usage: ext2_mkdir <image file name> <file path>\n"); exit(1); } if (ext2_init(argv[1]) == -1) return -1; path = malloc(strlen(argv[2])); split_filepath(argv[2],dirname,path); if (strlen(dirname) == 0) return ENOENT; u = allocate_inode(); new_inode.i_mode |= EXT2_S_IFDIR; new_inode.i_links_count = 1; for (i = 0; i < 15; i++) new_inode.i_block[i] = 0; *(inode_by_index(u)) = new_inode; new_dir.inode = u; new_dir.name_len = strlen(dirname); new_dir.file_type = EXT2_FT_DIR; p = find_inode(path); parent_inode = inode_by_index(p); free(path); if (find_dir_entry(parent_inode, dirname)) return EEXIST; printf("does this happen?\n"); if (parent_inode) { push_dir_entry(parent_inode, new_dir, dirname); init_dir(u,p); return 0; } else { return ENOENT; } }
void move(t_maze *maze) { int check; check = 0; init_dir(maze); maze->map[maze->y][maze->x] = 'o'; while (check == 0) { check = 1; check_if_impasse(maze); if (check_if_inter(maze) == 0) normal_move(maze, &check); } }
int main (int argc, char *argv[]) { debugenv(); setprogname(argv[0]); init_shell(NULL); init_net(); init_sage(); init_dir(); init_test(); CMD(test, "# test function"); return shell(); }
void init_directories(char *argv[]) { // g_printf("argv[0] = %s\n", argv[0]); datadir = init_dir(argv, "data", GTKPOD_DATA_DIR); docdir = init_dir(argv, "doc", GTKPOD_DOC_DIR); icondir = init_dir(argv, "icons", GTKPOD_IMAGE_DIR); uidir = init_dir(argv, "data/ui", GTKPOD_UI_DIR); gladedir = init_dir(argv, "data/glade", GTKPOD_GLADE_DIR); plugindir = init_dir(argv, "plugins", GTKPOD_PLUGIN_DIR); scriptdir = init_dir(argv, "scripts", GTKPOD_SCRIPT_DIR); gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(), icondir); gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(), GTKPOD_IMAGE_DIR); // debug_print_directories(); }
void funcao_enter(PNO * H, char *path, PNO * p_ini, PNO * p_pos, PNO * p_fim, int ini, int *pos, int fim) { if (is_dir((*p_pos)->box.atributo)) { if (!(strcmp((*p_pos)->box.nome, ".."))) { path_apaga(path); path_apaga(path); strcat(path, "\\*.*"); } else if ((strcmp((*p_pos)->box.nome, "."))) { path_apaga(path); strcat(path, "\\"); strcat(path, (*p_pos)->box.nome); strcat(path, "\\*.*"); } init_dir(H, path, p_ini, p_pos, p_fim, ini, pos, fim); } }