| 30 |
#include "section_list_loader.h" |
#include "section_list_loader.h" |
| 31 |
#include "screen.h" |
#include "screen.h" |
| 32 |
#include "str_process.h" |
#include "str_process.h" |
| 33 |
|
#include "user_info_display.h" |
| 34 |
|
#include "user_list_display.h" |
| 35 |
#include "user_priv.h" |
#include "user_priv.h" |
| 36 |
|
#include <ctype.h> |
| 37 |
|
#include <errno.h> |
| 38 |
#include <string.h> |
#include <string.h> |
| 39 |
#include <time.h> |
#include <time.h> |
| 40 |
#include <sys/param.h> |
#include <sys/param.h> |
| 41 |
|
|
| 42 |
static int section_aid_locations[BBS_max_section] = {0}; |
#define TITLE_SEARCH_MAX_LEN 60 |
| 43 |
|
|
| 44 |
|
static int32_t section_aid_locations[BBS_max_section] = {0}; |
| 45 |
static int section_topic_view_mode = 0; |
static int section_topic_view_mode = 0; |
| 46 |
static int section_topic_view_tid = -1; |
static int section_topic_view_tid = -1; |
| 47 |
|
|
| 56 |
EDIT_ARTICLE, |
EDIT_ARTICLE, |
| 57 |
DELETE_ARTICLE, |
DELETE_ARTICLE, |
| 58 |
QUERY_ARTICLE, |
QUERY_ARTICLE, |
| 59 |
|
QUERY_USER, |
| 60 |
SET_FAVOR_ARTICLE, |
SET_FAVOR_ARTICLE, |
| 61 |
UNSET_FAVOR_ARTICLE, |
UNSET_FAVOR_ARTICLE, |
| 62 |
FIRST_TOPIC_ARTICLE, |
FIRST_TOPIC_ARTICLE, |
| 63 |
LAST_TOPIC_ARTICLE, |
LAST_TOPIC_ARTICLE, |
| 64 |
SCAN_NEW_ARTICLE, |
SCAN_NEW_ARTICLE, |
| 65 |
|
SCAN_ARTICLE_BACKWARD_BY_USER, |
| 66 |
|
SCAN_ARTICLE_FORWARD_BY_USER, |
| 67 |
|
SCAN_ARTICLE_BACKWARD_BY_TITLE, |
| 68 |
|
SCAN_ARTICLE_FORWARD_BY_TITLE, |
| 69 |
VIEW_EX_DIR, |
VIEW_EX_DIR, |
| 70 |
SHOW_TOP10, |
SHOW_TOP10, |
| 71 |
|
SEARCH_USER, |
| 72 |
}; |
}; |
| 73 |
|
|
| 74 |
static int section_list_draw_items(int page_id, ARTICLE *p_articles[], int article_count, int display_nickname, int ontop_start_offset) |
static int section_list_draw_items(int page_id, ARTICLE *p_articles[], int article_count, int display_nickname, int ontop_start_offset) |
| 274 |
|
|
| 275 |
switch (ch) |
switch (ch) |
| 276 |
{ |
{ |
| 277 |
case KEY_NULL: // broken pipe |
case KEY_NULL: // broken pipe |
| 278 |
log_error("KEY_NULL\n"); |
log_error("KEY_NULL\n"); |
| 279 |
return EXIT_SECTION; |
return EXIT_SECTION; |
| 280 |
case KEY_TIMEOUT: |
case KEY_TIMEOUT: |
| 317 |
return QUERY_ARTICLE; |
return QUERY_ARTICLE; |
| 318 |
} |
} |
| 319 |
break; |
break; |
| 320 |
|
case Ctrl('A'): |
| 321 |
|
if (item_count > 0) |
| 322 |
|
{ |
| 323 |
|
return QUERY_USER; |
| 324 |
|
} |
| 325 |
|
break; |
| 326 |
case 'F': |
case 'F': |
| 327 |
if (item_count > 0) |
if (item_count > 0) |
| 328 |
{ |
{ |
| 416 |
return SCAN_NEW_ARTICLE; |
return SCAN_NEW_ARTICLE; |
| 417 |
} |
} |
| 418 |
break; |
break; |
| 419 |
|
case 'A': |
| 420 |
|
if (item_count > 0) |
| 421 |
|
{ |
| 422 |
|
return SCAN_ARTICLE_BACKWARD_BY_USER; |
| 423 |
|
} |
| 424 |
|
break; |
| 425 |
|
case 'a': |
| 426 |
|
if (item_count > 0) |
| 427 |
|
{ |
| 428 |
|
return SCAN_ARTICLE_FORWARD_BY_USER; |
| 429 |
|
} |
| 430 |
|
break; |
| 431 |
|
case '?': |
| 432 |
|
if (item_count > 0) |
| 433 |
|
{ |
| 434 |
|
return SCAN_ARTICLE_BACKWARD_BY_TITLE; |
| 435 |
|
} |
| 436 |
|
break; |
| 437 |
|
case '/': |
| 438 |
|
if (item_count > 0) |
| 439 |
|
{ |
| 440 |
|
return SCAN_ARTICLE_FORWARD_BY_TITLE; |
| 441 |
|
} |
| 442 |
|
break; |
| 443 |
|
case 'u': |
| 444 |
|
return SEARCH_USER; |
| 445 |
case 'h': |
case 'h': |
| 446 |
return SHOW_HELP; |
return SHOW_HELP; |
| 447 |
case 'x': |
case 'x': |
| 449 |
case 'H': |
case 'H': |
| 450 |
return SHOW_TOP10; |
return SHOW_TOP10; |
| 451 |
default: |
default: |
| 452 |
|
break; |
| 453 |
} |
} |
| 454 |
|
|
| 455 |
if (old_page_id != *p_page_id) |
if (old_page_id != *p_page_id) |
| 593 |
ARTICLE article_new; |
ARTICLE article_new; |
| 594 |
int page_id_cur; |
int page_id_cur; |
| 595 |
const ARTICLE *p_article_locate; |
const ARTICLE *p_article_locate; |
| 596 |
|
USER_INFO user_info; |
| 597 |
|
char user_intro[BBS_user_intro_max_len + 1]; |
| 598 |
|
char username[BBS_username_max_len + 1]; |
| 599 |
|
char username_list[1][BBS_username_max_len + 1]; |
| 600 |
|
int32_t uid; |
| 601 |
|
int i; |
| 602 |
|
int ok; |
| 603 |
|
char title[BBS_article_title_max_len + 1] = "\0"; |
| 604 |
|
|
| 605 |
p_section = section_list_find_by_name(sname); |
p_section = section_list_find_by_name(sname); |
| 606 |
if (p_section == NULL) |
if (p_section == NULL) |
| 618 |
|
|
| 619 |
section_index = get_section_index(p_section); |
section_index = get_section_index(p_section); |
| 620 |
|
|
| 621 |
if ((ret = section_list_rd_lock(p_section)) < 0) |
if (get_section_info(p_section, NULL, stitle, master_list) < 0) |
| 622 |
{ |
{ |
| 623 |
log_error("section_list_rd_lock(sid = 0) error\n"); |
log_error("get_section_info(sid=%d) error\n", p_section->sid); |
| 624 |
return -2; |
return -4; |
|
} |
|
|
|
|
|
strncpy(stitle, p_section->stitle, sizeof(stitle) - 1); |
|
|
stitle[sizeof(stitle) - 1] = '\0'; |
|
|
strncpy(master_list, p_section->master_list, sizeof(master_list) - 1); |
|
|
master_list[sizeof(master_list) - 1] = '\0'; |
|
|
|
|
|
if ((ret = section_list_rd_unlock(p_section)) < 0) |
|
|
{ |
|
|
log_error("section_list_rd_unlock(sid = 0) error\n"); |
|
|
return -2; |
|
| 625 |
} |
} |
| 626 |
|
|
| 627 |
if (aid == 0) |
if (aid == 0) |
| 703 |
} |
} |
| 704 |
|
|
| 705 |
ret = section_list_select(page_count, article_count, &page_id, &selected_index); |
ret = section_list_select(page_count, article_count, &page_id, &selected_index); |
| 706 |
|
|
| 707 |
switch (ret) |
switch (ret) |
| 708 |
{ |
{ |
| 709 |
case EXIT_SECTION: |
case EXIT_SECTION: |
| 710 |
|
// Update current aid location |
| 711 |
|
if (p_articles[selected_index] != NULL) |
| 712 |
|
{ |
| 713 |
|
section_aid_locations[section_index] = p_articles[selected_index]->aid; |
| 714 |
|
} |
| 715 |
|
else |
| 716 |
|
{ |
| 717 |
|
log_error("p_articles[selected_index=%d] is NULL when exit section [%s]\n", selected_index, sname); |
| 718 |
|
} |
| 719 |
return 0; |
return 0; |
| 720 |
case CHANGE_PAGE: |
case CHANGE_PAGE: |
| 721 |
ret = query_section_articles(p_section, page_id, p_articles, &article_count, &page_count, &ontop_start_offset); |
ret = query_section_articles(p_section, page_id, p_articles, &article_count, &page_count, &ontop_start_offset); |
| 894 |
// Update current topic |
// Update current topic |
| 895 |
section_topic_view_tid = (p_articles[selected_index]->tid == 0 ? p_articles[selected_index]->aid : p_articles[selected_index]->tid); |
section_topic_view_tid = (p_articles[selected_index]->tid == 0 ? p_articles[selected_index]->aid : p_articles[selected_index]->tid); |
| 896 |
|
|
|
// Update current aid location |
|
|
section_aid_locations[section_index] = p_articles[selected_index]->aid; |
|
|
|
|
| 897 |
if (section_list_draw_screen(sname, stitle, master_list, display_nickname) < 0) |
if (section_list_draw_screen(sname, stitle, master_list, display_nickname) < 0) |
| 898 |
{ |
{ |
| 899 |
log_error("section_list_draw_screen() error\n"); |
log_error("section_list_draw_screen() error\n"); |
| 991 |
return -2; |
return -2; |
| 992 |
} |
} |
| 993 |
break; |
break; |
| 994 |
|
case QUERY_USER: |
| 995 |
|
if ((ret = query_user_info_by_uid(p_articles[selected_index]->uid, &user_info, user_intro, sizeof(user_intro))) < 0) |
| 996 |
|
{ |
| 997 |
|
log_error("query_user_info_by_uid(uid=%d) error\n", p_articles[selected_index]->uid); |
| 998 |
|
return -2; |
| 999 |
|
} |
| 1000 |
|
else if (ret == 0) |
| 1001 |
|
{ |
| 1002 |
|
clearscr(); |
| 1003 |
|
prints("该用户已升天"); |
| 1004 |
|
press_any_key(); |
| 1005 |
|
} |
| 1006 |
|
else if (user_info_display(&user_info) < 0) // && ret > 0 |
| 1007 |
|
{ |
| 1008 |
|
log_error("user_info_display(uid=%d) error\n", p_articles[selected_index]->uid); |
| 1009 |
|
} |
| 1010 |
|
|
| 1011 |
|
if (section_list_draw_screen(sname, stitle, master_list, display_nickname) < 0) |
| 1012 |
|
{ |
| 1013 |
|
log_error("section_list_draw_screen() error\n"); |
| 1014 |
|
return -2; |
| 1015 |
|
} |
| 1016 |
|
break; |
| 1017 |
case SET_FAVOR_ARTICLE: |
case SET_FAVOR_ARTICLE: |
| 1018 |
ret = article_favor_set(p_articles[selected_index]->tid == 0 |
ret = article_favor_set(p_articles[selected_index]->tid == 0 |
| 1019 |
? p_articles[selected_index]->aid |
? p_articles[selected_index]->aid |
| 1089 |
} |
} |
| 1090 |
} |
} |
| 1091 |
break; |
break; |
| 1092 |
|
case SCAN_ARTICLE_BACKWARD_BY_USER: |
| 1093 |
|
case SCAN_ARTICLE_FORWARD_BY_USER: |
| 1094 |
|
direction = (ret == SCAN_ARTICLE_FORWARD_BY_USER ? 1 : -1); |
| 1095 |
|
strncpy(username, p_articles[selected_index]->username, sizeof(username) - 1); |
| 1096 |
|
username[sizeof(username) - 1] = '\0'; |
| 1097 |
|
uid = 0; |
| 1098 |
|
|
| 1099 |
|
moveto(SCREEN_ROWS, 1); |
| 1100 |
|
clrtoeol(); |
| 1101 |
|
get_data(SCREEN_ROWS, 1, |
| 1102 |
|
(direction == 1 ? "向下搜寻作者: " : "向上搜寻作者: "), |
| 1103 |
|
username, sizeof(username), BBS_username_max_len); |
| 1104 |
|
|
| 1105 |
|
if (username[0] == '\0') |
| 1106 |
|
{ |
| 1107 |
|
break; |
| 1108 |
|
} |
| 1109 |
|
|
| 1110 |
|
// Verify format |
| 1111 |
|
for (i = 0, ok = 1; ok && username[i] != '\0'; i++) |
| 1112 |
|
{ |
| 1113 |
|
if (!(isalpha(username[i]) || (i > 0 && (isdigit(username[i]) || username[i] == '_')))) |
| 1114 |
|
{ |
| 1115 |
|
ok = 0; |
| 1116 |
|
} |
| 1117 |
|
} |
| 1118 |
|
if (ok && i > BBS_username_max_len) |
| 1119 |
|
{ |
| 1120 |
|
ok = 0; |
| 1121 |
|
} |
| 1122 |
|
if (!ok) |
| 1123 |
|
{ |
| 1124 |
|
break; |
| 1125 |
|
} |
| 1126 |
|
|
| 1127 |
|
ret = query_user_info_by_username(username, 1, &uid, username_list); |
| 1128 |
|
if (ret < 0) |
| 1129 |
|
{ |
| 1130 |
|
log_error("query_user_info_by_username(%s) error\n", username); |
| 1131 |
|
break; |
| 1132 |
|
} |
| 1133 |
|
|
| 1134 |
|
if (uid > 0) |
| 1135 |
|
{ |
| 1136 |
|
ret = scan_article_in_section_by_uid(p_section, p_articles[selected_index], |
| 1137 |
|
direction, uid, &p_article_locate); |
| 1138 |
|
if (ret < 0) |
| 1139 |
|
{ |
| 1140 |
|
log_error("scan_article_in_section_by_uid(sid=%d, aid=%d, direction=%d, uid=%d) error\n", |
| 1141 |
|
p_section->sid, p_articles[selected_index]->aid, direction, uid); |
| 1142 |
|
return -3; |
| 1143 |
|
} |
| 1144 |
|
else if (ret == 0) // not found |
| 1145 |
|
{ |
| 1146 |
|
break; |
| 1147 |
|
} |
| 1148 |
|
} |
| 1149 |
|
else // uid == 0 |
| 1150 |
|
{ |
| 1151 |
|
ret = scan_article_in_section_by_username(p_section, p_articles[selected_index], |
| 1152 |
|
direction, username, &p_article_locate); |
| 1153 |
|
if (ret < 0) |
| 1154 |
|
{ |
| 1155 |
|
log_error("scan_article_in_section_by_username(sid=%d, aid=%d, direction=%d, username=%s) error\n", |
| 1156 |
|
p_section->sid, p_articles[selected_index]->aid, direction, username); |
| 1157 |
|
return -3; |
| 1158 |
|
} |
| 1159 |
|
else if (ret == 0) // not found |
| 1160 |
|
{ |
| 1161 |
|
break; |
| 1162 |
|
} |
| 1163 |
|
} |
| 1164 |
|
|
| 1165 |
|
page_id_cur = page_id; |
| 1166 |
|
ret = locate_article_in_section(p_section, p_article_locate, 0, 0, |
| 1167 |
|
&page_id, &selected_index, &article_count); |
| 1168 |
|
if (ret < 0) |
| 1169 |
|
{ |
| 1170 |
|
log_error("locate_article_in_section(sid=%d, aid=%d, direction=0, step=0) error\n", |
| 1171 |
|
p_section->sid, p_article_locate->aid); |
| 1172 |
|
return -3; |
| 1173 |
|
} |
| 1174 |
|
else if (ret > 0 && page_id != page_id_cur) // found and page changed |
| 1175 |
|
{ |
| 1176 |
|
ret = query_section_articles(p_section, page_id, p_articles, &article_count, &page_count, &ontop_start_offset); |
| 1177 |
|
if (ret < 0) |
| 1178 |
|
{ |
| 1179 |
|
log_error("query_section_articles(sid=%d, page_id=%d) error\n", p_section->sid, page_id); |
| 1180 |
|
return -3; |
| 1181 |
|
} |
| 1182 |
|
} |
| 1183 |
|
break; |
| 1184 |
|
case SCAN_ARTICLE_BACKWARD_BY_TITLE: |
| 1185 |
|
case SCAN_ARTICLE_FORWARD_BY_TITLE: |
| 1186 |
|
direction = (ret == SCAN_ARTICLE_FORWARD_BY_TITLE ? 1 : -1); |
| 1187 |
|
|
| 1188 |
|
moveto(SCREEN_ROWS, 1); |
| 1189 |
|
clrtoeol(); |
| 1190 |
|
get_data(SCREEN_ROWS, 1, |
| 1191 |
|
(direction == 1 ? "向下搜寻标题: " : "向上搜寻标题: "), |
| 1192 |
|
title, sizeof(title), TITLE_SEARCH_MAX_LEN); |
| 1193 |
|
|
| 1194 |
|
if (title[0] == '\0') |
| 1195 |
|
{ |
| 1196 |
|
break; |
| 1197 |
|
} |
| 1198 |
|
|
| 1199 |
|
ret = scan_article_in_section_by_title(p_section, p_articles[selected_index], |
| 1200 |
|
direction, title, &p_article_locate); |
| 1201 |
|
if (ret < 0) |
| 1202 |
|
{ |
| 1203 |
|
log_error("scan_article_in_section_by_title(sid=%d, aid=%d, direction=%d, title=%s) error\n", |
| 1204 |
|
p_section->sid, p_articles[selected_index]->aid, direction, title); |
| 1205 |
|
return -3; |
| 1206 |
|
} |
| 1207 |
|
else if (ret == 0) // not found |
| 1208 |
|
{ |
| 1209 |
|
break; |
| 1210 |
|
} |
| 1211 |
|
|
| 1212 |
|
page_id_cur = page_id; |
| 1213 |
|
ret = locate_article_in_section(p_section, p_article_locate, 0, 0, |
| 1214 |
|
&page_id, &selected_index, &article_count); |
| 1215 |
|
if (ret < 0) |
| 1216 |
|
{ |
| 1217 |
|
log_error("locate_article_in_section(sid=%d, aid=%d, direction=0, step=0) error\n", |
| 1218 |
|
p_section->sid, p_article_locate->aid); |
| 1219 |
|
return -3; |
| 1220 |
|
} |
| 1221 |
|
else if (ret > 0 && page_id != page_id_cur) // found and page changed |
| 1222 |
|
{ |
| 1223 |
|
ret = query_section_articles(p_section, page_id, p_articles, &article_count, &page_count, &ontop_start_offset); |
| 1224 |
|
if (ret < 0) |
| 1225 |
|
{ |
| 1226 |
|
log_error("query_section_articles(sid=%d, page_id=%d) error\n", p_section->sid, page_id); |
| 1227 |
|
return -3; |
| 1228 |
|
} |
| 1229 |
|
} |
| 1230 |
|
break; |
| 1231 |
|
case SEARCH_USER: |
| 1232 |
|
user_list_search(); |
| 1233 |
|
if (section_list_draw_screen(sname, stitle, master_list, display_nickname) < 0) |
| 1234 |
|
{ |
| 1235 |
|
log_error("section_list_draw_screen() error\n"); |
| 1236 |
|
return -2; |
| 1237 |
|
} |
| 1238 |
|
break; |
| 1239 |
case SHOW_HELP: |
case SHOW_HELP: |
| 1240 |
// Display help information |
// Display help information |
| 1241 |
display_file(DATA_READ_HELP, 1); |
display_file(DATA_READ_HELP, 1); |
| 1360 |
|
|
| 1361 |
return 0; |
return 0; |
| 1362 |
} |
} |
| 1363 |
|
|
| 1364 |
|
int section_aid_locations_save(int uid) |
| 1365 |
|
{ |
| 1366 |
|
char filename[FILE_PATH_LEN]; |
| 1367 |
|
FILE *fp; |
| 1368 |
|
int i; |
| 1369 |
|
int ret = 0; |
| 1370 |
|
|
| 1371 |
|
snprintf(filename, sizeof(filename), "%s/%d", VAR_SECTION_AID_LOC_DIR, uid); |
| 1372 |
|
|
| 1373 |
|
if ((fp = fopen(filename, "wb")) == NULL) |
| 1374 |
|
{ |
| 1375 |
|
log_error("fopen(%s, wb) error: %d\n", filename, errno); |
| 1376 |
|
return -1; |
| 1377 |
|
} |
| 1378 |
|
|
| 1379 |
|
for (i = 0; i < p_section_list_pool->section_count; i++) |
| 1380 |
|
{ |
| 1381 |
|
if (fwrite(&(p_section_list_pool->sections[i].sid), sizeof(p_section_list_pool->sections[i].sid), 1, fp) != 1) |
| 1382 |
|
{ |
| 1383 |
|
log_error("fwrite(%s, sid) error\n", filename); |
| 1384 |
|
ret = -2; |
| 1385 |
|
break; |
| 1386 |
|
} |
| 1387 |
|
|
| 1388 |
|
if (fwrite(&(section_aid_locations[i]), sizeof(section_aid_locations[i]), 1, fp) != 1) |
| 1389 |
|
{ |
| 1390 |
|
log_error("fwrite(%s, aid) error\n", filename); |
| 1391 |
|
ret = -2; |
| 1392 |
|
break; |
| 1393 |
|
} |
| 1394 |
|
} |
| 1395 |
|
|
| 1396 |
|
if (fclose(fp) < 0) |
| 1397 |
|
{ |
| 1398 |
|
log_error("fclose(%s) error: %d\n", filename, errno); |
| 1399 |
|
ret = -1; |
| 1400 |
|
} |
| 1401 |
|
|
| 1402 |
|
return ret; |
| 1403 |
|
} |
| 1404 |
|
|
| 1405 |
|
int section_aid_locations_load(int uid) |
| 1406 |
|
{ |
| 1407 |
|
char filename[FILE_PATH_LEN]; |
| 1408 |
|
FILE *fp; |
| 1409 |
|
int i; |
| 1410 |
|
int32_t sid; |
| 1411 |
|
int32_t aid; |
| 1412 |
|
SECTION_LIST *p_section; |
| 1413 |
|
int ret = 0; |
| 1414 |
|
|
| 1415 |
|
snprintf(filename, sizeof(filename), "%s/%d", VAR_SECTION_AID_LOC_DIR, uid); |
| 1416 |
|
|
| 1417 |
|
if ((fp = fopen(filename, "rb")) == NULL) |
| 1418 |
|
{ |
| 1419 |
|
if (errno == ENOENT) // file not exist |
| 1420 |
|
{ |
| 1421 |
|
return 0; |
| 1422 |
|
} |
| 1423 |
|
log_error("fopen(%s, rb) error: %d\n", filename, errno); |
| 1424 |
|
return -1; |
| 1425 |
|
} |
| 1426 |
|
|
| 1427 |
|
while (!feof(fp)) |
| 1428 |
|
{ |
| 1429 |
|
if (fread(&sid, sizeof(sid), 1, fp) != 1) |
| 1430 |
|
{ |
| 1431 |
|
if (ferror(fp) == 0) |
| 1432 |
|
{ |
| 1433 |
|
break; |
| 1434 |
|
} |
| 1435 |
|
log_error("fread(%s, sid) error: %d\n", filename, ferror(fp)); |
| 1436 |
|
ret = -2; |
| 1437 |
|
break; |
| 1438 |
|
} |
| 1439 |
|
|
| 1440 |
|
if (fread(&aid, sizeof(aid), 1, fp) != 1) |
| 1441 |
|
{ |
| 1442 |
|
if (ferror(fp) == 0) |
| 1443 |
|
{ |
| 1444 |
|
break; |
| 1445 |
|
} |
| 1446 |
|
log_error("fread(%s, aid) error: %d\n", filename, ferror(fp)); |
| 1447 |
|
ret = -2; |
| 1448 |
|
break; |
| 1449 |
|
} |
| 1450 |
|
|
| 1451 |
|
p_section = section_list_find_by_sid(sid); |
| 1452 |
|
if (p_section == NULL) |
| 1453 |
|
{ |
| 1454 |
|
continue; // skip section no longer exist |
| 1455 |
|
} |
| 1456 |
|
|
| 1457 |
|
i = get_section_index(p_section); |
| 1458 |
|
if (i < 0) |
| 1459 |
|
{ |
| 1460 |
|
log_error("get_section_index(sid=%d) error\n", sid); |
| 1461 |
|
ret = -3; |
| 1462 |
|
break; |
| 1463 |
|
} |
| 1464 |
|
section_aid_locations[i] = aid; |
| 1465 |
|
} |
| 1466 |
|
|
| 1467 |
|
if (fclose(fp) < 0) |
| 1468 |
|
{ |
| 1469 |
|
log_error("fclose(%s) error: %d\n", filename, errno); |
| 1470 |
|
ret = -1; |
| 1471 |
|
} |
| 1472 |
|
|
| 1473 |
|
return ret; |
| 1474 |
|
} |