int disp_config_tcpip(u8* param) { const static struct strDealParam dealparam[] ={ {(u8*)"IP地址", (unsigned char *)gSysParam.m_ip, 0, sizeof(gSysParam.m_ip) - 1, DATA_TYPE_STR, DEAL_MODE_PARAM}, {(u8*)"端口", (unsigned char *)&gSysParam.m_port, 2, 2, DATA_TYPE_INT, DEAL_MODE_PARAM} }; input_item((struct strDealParam*)dealparam, sizeof(dealparam) / sizeof(dealparam[0])); save_sysparam(); sharebuf_remove_globalfun(); return 0; }
/* Function: get_dimension ------------------------ Traverses a given file and finds the total number of users and items for this source. The acquired number is stored in this given source structure. This method is used in the case that the hint line is not presented. Parameter: file - source file src - source structure */ void get_dimension(FILE *file, Source *src) { int user_num = 0; char chars[MAX_CHARS]; char *token = NULL; char **seg = (char**)malloc(3 * sizeof(*seg)); struct Item_Tree *item_tree = initialize(); Item *items = NULL; while (fgets(chars, MAX_CHARS, file) != NULL) { // Gets all segments seg[0] = strtok_s(chars, _SEP, &token); if (seg[0] != NULL) { seg[1] = strtok_s(NULL, _SEP, &token); if (seg[1] != NULL) { seg[2] = strtok_s(NULL, _SEP, &token); if (seg[2] != NULL) { // Handles item segment input_item(item_tree, seg[0]); // Handles user IDs long temp = (long) find_number(seg[1]); if (temp > user_num) { user_num = temp; } } } } } free(seg); // Retrieves all item names and free its item tree get_items(item_tree, &items); src->items = items; // Sets user numbers src->N = user_num; }