VOID Calendar::rebuild(BOOL reset_title) { CTextStyle Style(database); /* Extract the current styles. */ // get_frame_style(&m_LabelFontStyle, SKELETON_PANEL, LABEL_FRAME_PANEL); // get_frame_style(&m_NumberFontStyle, DATE_PANEL, DATE_PANEL); /* Delete what we rebuild. */ Style.SetDefault(); delete_skeleton_group(reset_title, &Style); delete_group(DATE_PANEL); /* Do the construction. */ calc_and_build(&Style); /* Relayout the enhanced dates. */ rebuild_dates(find_group(TEXT_PANEL)); rebuild_dates(find_group(GRAPHIC_PANEL)); }
isc_result_t supersede_group (struct group_object *group, int writep) { struct group_object *t, *u; isc_result_t status; /* Register the group in the group name hash table, so we can look it up later. */ if (group_name_hash) { t = (struct group_object *)0; group_hash_lookup (&t, group_name_hash, group -> name, strlen (group -> name), MDL); if (t && t != group) { /* If this isn't a dynamic entry, then we need to flag the replacement as not dynamic either - otherwise, if the dynamic entry is deleted later, the static entry will come back next time the server is stopped and restarted. */ if (!(t -> flags & GROUP_OBJECT_DYNAMIC)) group -> flags |= GROUP_OBJECT_STATIC; /* Delete the old object if it hasn't already been deleted. If it has already been deleted, get rid of the hash table entry. This is a legitimate situation - a deleted static object needs to be kept around so we remember it's deleted. */ if (!(t -> flags & GROUP_OBJECT_DELETED)) delete_group (t, 0); else { group_hash_delete (group_name_hash, group -> name, strlen (group -> name), MDL); group_object_dereference (&t, MDL); } } } else { group_new_hash (&group_name_hash, 0, MDL); t = (struct group_object *)0; } /* Add the group to the group name hash if it's not already there, and also thread it into the list of dynamic groups if appropriate. */ if (!t) { group_hash_add (group_name_hash, group -> name, strlen (group -> name), group, MDL); } /* Store the group declaration in the lease file. */ if (writep && group_write_hook) { if (!(*group_write_hook) (group)) return ISC_R_IOERROR; } return ISC_R_SUCCESS; }
void dc_delete_group(struct task_group *group) { mod_ubus(delete_group(group)); if (group->prev) group->prev->next = group->next; if (group->next) group->next->prev = group->prev; if (task_groups == group) task_groups = group->next; free (group->name); free (group); }
int main(int ac, char **av) { struct database *db; struct group *group = NULL; char *line = NULL; size_t linesz = 0; if (!av[1]) { printf("%s database\n", av[0]); exit(1); } printf("dbtest\n"); db = open_db(av[1], 1); while (printf("> "), fflush(stdout), getline(&line, &linesz, stdin) > 0) { char *p = line + strlen(line) - 1; while (p >= line && isspace(*p)) *p-- = 0; switch (line[0]) { case 's': C(sync_db(db)); break; case 'q': C(close_db(db)); exit(0); case 'g': group = find_group(db, line + 1); if (group) printf("found\n"); break; case 'G': NEEDGROUP; C(delete_group(db, group)); group = NULL; break; case 'a': { int existed = 0; group = add_group(db, line + 1, &existed); if (existed) printf("existed\n"); break; } case 'v': NEEDGROUP; printf("%s\n", entry_val(group, line + 1)); break; case 'c': { p = line + 1; char *entry = strsep(&p, ","); NEEDGROUP; change_entry(db, group, entry, strsep(&p, "")); break; } case 'L': NEEDGROUP; clone_group(db, group, line + 1); break; case 'f': { struct group *g; p = line + 1; char *entry = strsep(&p, ","); char *val = strsep(&p, ""); g = NULL; int nr = 0; while ((g = find_entry(db, g, entry, val)) != NULL) { if (nr == 0) group = g; nr++; dump_group(group, stdout); } if (nr == 0) printf("not found\n"); break; } case 'C': NEEDGROUP; add_comment(db, group, line + 1); break; case 'd': NEEDGROUP; dump_group(group, stdout); break; case 'D': dump_database(db, stdout); break; default: usage(); break; } } return 0; }
void INI::delete_group() { delete_group(current_group); }
/*解析消息线程*/ void *pthread_func() { int group_fd; //组播套接字 group_fd = udp_link(); head_user = (struct user_info *)malloc(sizeof(struct user_info)); head_user->next = NULL; struct user_info *tmp; // 循环变量,用于便利在线用户链表将其发送给第一次登录的或者有刷新请求的客户端 struct servmsg *free_tmp; int ret= -1; while(1){ while(H->next != NULL){ free_tmp = H; H = H->next; //消息头,处理玩就往后移动 free(free_tmp);//将处理完的消息所占内存释放掉 free_tmp = NULL; printf("消息来自:%s IP:PORT:%s:%d\n",H->recvmsg.self_name,inet_ntoa(H->addr.sin_addr),ntohs(H->addr.sin_port)); switch(H->recvmsg.type) { case LOG_IN: printf("%s登录消息\n",H->recvmsg.self_name); send_message_to_all(H,LOGIN_TOALL); add_user(head_user,H); break; case REFRESH: printf("%s刷新消息\n",H->recvmsg.self_name); //usleep(50000); send_all_online(H->addr); break; case CHAT_PRI: printf("%s私聊消息\n",H->recvmsg.self_name); printf("目标:%s\n",H->recvmsg.dst_name); chat_private(); break; case CHAT_ALL: printf("%s群聊消息\n",H->recvmsg.self_name); send_message_to_all(H,CHAT_ALL); break; case FILE_NAME: printf("%s申请下载\n",H->recvmsg.self_name); send_dir_allfile(H->addr); break; case DOWNLOAD: printf("%s 确认下载\n",H->recvmsg.self_name); pthread_create(&tid2,NULL,download_send,(void *)&H->addr); pthread_detach(tid2); break; case UPLOAD: printf("%s上传文件\n",H->recvmsg.self_name); pthread_create(&tid3,NULL,(void *)&upload_func,NULL); pthread_detach(tid3); break; case OFFLINE: printf("%s下线\n",H->recvmsg.self_name); delete_user(H->recvmsg.self_name); break; case CREATE_GROUP: printf("%s create group\n",H->recvmsg.self_name); create_group(H); break; case JOIN_GROUP: printf("%s join group\n",H->recvmsg.self_name); join_group(H); break; case LIST_GROUP: printf("%s list group\n",H->recvmsg.self_name); list_group(H); break; case GROUP_CHAT: printf("%s group chat\n",H->recvmsg.self_name); group_chat(H); break; case GROUP_DELETE: printf("%s delete group\n",H->recvmsg.self_name); delete_group(H); break; default: printf("msg type error !\n"); break; } printf("-----------------------------------\n"); } } }
int main(int argc, char *argv[]) { gfarm_error_t e; char op = OP_GROUPNAME, *groupname; int c; const char *path = "."; char *realpath = NULL; e = gfarm_initialize(&argc, &argv); if (e != GFARM_ERR_NO_ERROR) { fprintf(stderr, "%s: gfarm_initialize: %s\n", program_name, gfarm_error_string(e)); exit(1); } while ((c = getopt(argc, argv, "P:cdlm?")) != -1) { switch (c) { case 'P': path = optarg; break; case OP_CREATE_GROUP: case OP_DELETE_GROUP: case OP_MODIFY_GROUP: case OP_LIST_LONG: op = c; break; case '?': default: usage(); } } argc -= optind; argv += optind; if (gfarm_realpath_by_gfarm2fs(path, &realpath) == GFARM_ERR_NO_ERROR) path = realpath; if ((e = gfm_client_connection_and_process_acquire_by_path(path, &gfm_server)) != GFARM_ERR_NO_ERROR) { fprintf(stderr, "%s: metadata server for \"%s\": %s\n", program_name, path, gfarm_error_string(e)); exit(1); } free(realpath); switch (op) { case OP_GROUPNAME: case OP_LIST_LONG: if (argc == 0) e = list_all(op); else e = list(op, argc, argv); break; case OP_CREATE_GROUP: case OP_MODIFY_GROUP: if (argc < 1) usage(); groupname = *argv++; --argc; e = create_group(op, groupname, argc, argv); break; case OP_DELETE_GROUP: if (argc != 1) usage(); e = delete_group(*argv); break; } if (e != GFARM_ERR_NO_ERROR) { fprintf(stderr, "%s: %s\n", program_name, gfarm_error_string(e)); exit(1); } gfm_client_connection_free(gfm_server); e = gfarm_terminate(); if (e != GFARM_ERR_NO_ERROR) { fprintf(stderr, "%s: gfarm_terminate: %s\n", program_name, gfarm_error_string(e)); exit(1); } exit(0); }