int main(void) { int ret, status; pid_t child, ctl; nl_catd messcat; output_init(); /* Generate the message catalog file from the text sourcefile */ if (system(NULL)) { if (create_catalog() != 0) UNRESOLVED(errno, "Can't create " MESSCAT_IN); ret = system("gencat " MESSCAT_OUT " " MESSCAT_IN); if (ret != 0) output ("Could not find the source file for message catalog.\n" "You may need to execute gencat yourself.\n"); } messcat = catopen("./" MESSCAT_OUT, 0); if (messcat == (nl_catd) - 1) UNRESOLVED(errno, "Could not open ./" MESSCAT_OUT); read_catalog(messcat, "parent"); child = fork(); if (child == -1) UNRESOLVED(errno, "Failed to fork"); if (child == 0) { read_catalog(messcat, "child"); exit(PTS_PASS); } ctl = waitpid(child, &status, 0); if (ctl != child) UNRESOLVED(errno, "Waitpid returned the wrong PID"); if ((!WIFEXITED(status)) || (WEXITSTATUS(status) != PTS_PASS)) FAILED("Child exited abnormally"); ret = catclose(messcat); if (ret != 0) UNRESOLVED(errno, "Failed to close the message catalog"); system("rm -f " MESSCAT_IN " " MESSCAT_OUT); #if VERBOSE > 0 output("Test passed\n"); #endif PASSED; }
/** *刷新树目录 */ void init_tree_view_catalog(){ fprintf(stderr,"劲哥啊,这里是初始化左边目录树\n"); fileCatalog = read_catalog_file(); if(catalog!=NULL) free(catalog); catalog = (CATALOG *)malloc(sizeof(CATALOG)); memset(catalog,0x00,sizeof(catalog)); fprintf(stderr,"在min.c:%s\n",fileCatalog); catalog = convert_file_struct_to_ui_struct_catalog(fileCatalog);//由file结构转换为ui目录结构 set_file_catalog(fileCatalog); if(treeCatalog!=NULL){ gtk_container_remove(GTK_CONTAINER(leftCatalogVBox),treeCatalog); } treeCatalog = create_catalog(catalog,fileCatalog); gtk_box_pack_start(GTK_BOX(leftCatalogVBox),treeCatalog,TRUE,TRUE,0); //设置目录 gtk_widget_show_all(leftCatalogVBox); }