| 66 |
log_err_redirect(STDERR_FILENO); |
log_err_redirect(STDERR_FILENO); |
| 67 |
|
|
| 68 |
// - 1 to make blocks allocated is less than required, to trigger error handling |
// - 1 to make blocks allocated is less than required, to trigger error handling |
| 69 |
block_count = BBS_article_limit_per_section * BBS_max_section / ARTICLE_PER_BLOCK - 1; |
block_count = BBS_article_limit_per_section * BBS_max_section / ARTICLE_PER_BLOCK; |
| 70 |
|
|
| 71 |
if (article_block_init("../conf/menu.conf", block_count) < 0) |
if (article_block_init("../conf/menu.conf", block_count) < 0) |
| 72 |
{ |
{ |
| 450 |
printf("Inconsistent invisible count in section %d, %d > 0\n", i, p_section[i]->visible_article_count); |
printf("Inconsistent invisible count in section %d, %d > 0\n", i, p_section[i]->visible_article_count); |
| 451 |
break; |
break; |
| 452 |
} |
} |
| 453 |
|
|
| 454 |
|
last_aid = p_section[i]->p_article_head->aid; |
| 455 |
|
if (section_list_calculate_page(p_section[i], last_aid) < 0) |
| 456 |
|
{ |
| 457 |
|
printf("section_list_calculate_page(aid = %d) error in section %d offset %d\n", last_aid, i, j); |
| 458 |
|
break; |
| 459 |
|
} |
| 460 |
|
|
| 461 |
|
if (p_section[i]->visible_article_count / BBS_article_limit_per_page + |
| 462 |
|
(p_section[i]->visible_article_count % BBS_article_limit_per_page ? 1 : 0) != |
| 463 |
|
p_section[i]->page_count) |
| 464 |
|
{ |
| 465 |
|
printf("Inconsistent page count in section %d offset %d, %d != %d, " |
| 466 |
|
"visible_article_count = %d, last_page_visible_count = %d\n", |
| 467 |
|
i, j, |
| 468 |
|
p_section[i]->visible_article_count / BBS_article_limit_per_page + |
| 469 |
|
(p_section[i]->visible_article_count % BBS_article_limit_per_page ? 1 : 0), |
| 470 |
|
p_section[i]->page_count, p_section[i]->visible_article_count, |
| 471 |
|
p_section[i]->last_page_visible_article_count); |
| 472 |
|
break; |
| 473 |
|
} |
| 474 |
} |
} |
| 475 |
|
|
| 476 |
printf("Press ENTER to exit..."); |
printf("Press ENTER to exit..."); |