| 22 |
#include "log.h" |
#include "log.h" |
| 23 |
#include "str_process.h" |
#include "str_process.h" |
| 24 |
#include <time.h> |
#include <time.h> |
| 25 |
|
#include <sys/param.h> |
| 26 |
#define _POSIX_C_SOURCE 200809L |
#define _POSIX_C_SOURCE 200809L |
| 27 |
#include <string.h> |
#include <string.h> |
| 28 |
|
|
| 123 |
{ |
{ |
| 124 |
prints("\033[44;37m \033[1;37m 编 号 发 布 者 日 期 文 章 标 题 \033[m"); |
prints("\033[44;37m \033[1;37m 编 号 发 布 者 日 期 文 章 标 题 \033[m"); |
| 125 |
} |
} |
|
show_bottom(""); |
|
| 126 |
|
|
| 127 |
return 0; |
return 0; |
| 128 |
} |
} |
| 248 |
SECTION_LIST *p_section; |
SECTION_LIST *p_section; |
| 249 |
char stitle[BBS_section_title_max_len + 1]; |
char stitle[BBS_section_title_max_len + 1]; |
| 250 |
char master_list[(BBS_username_max_len + 1) * 3 + 1]; |
char master_list[(BBS_username_max_len + 1) * 3 + 1]; |
| 251 |
|
char page_info_str[LINE_BUFFER_LEN]; |
| 252 |
ARTICLE *p_articles[BBS_article_limit_per_page]; |
ARTICLE *p_articles[BBS_article_limit_per_page]; |
| 253 |
int article_count; |
int article_count; |
| 254 |
|
int page_count; |
| 255 |
int page_id = 0; |
int page_id = 0; |
| 256 |
int selected_index = 0; |
int selected_index = 0; |
| 257 |
int ret; |
int ret; |
| 286 |
return -2; |
return -2; |
| 287 |
} |
} |
| 288 |
|
|
| 289 |
ret = query_section_articles(p_section, page_id, p_articles, &article_count); |
ret = query_section_articles(p_section, page_id, p_articles, &article_count, &page_count); |
| 290 |
if (ret < 0) |
if (ret < 0) |
| 291 |
{ |
{ |
| 292 |
log_error("query_section_articles(sid=%d, page_id=%d) error\n", p_section->sid, page_id); |
log_error("query_section_articles(sid=%d, page_id=%d) error\n", p_section->sid, page_id); |
| 306 |
log_error("section_list_draw_items(sid=%d, page_id=%d) error\n", p_section->sid, page_id); |
log_error("section_list_draw_items(sid=%d, page_id=%d) error\n", p_section->sid, page_id); |
| 307 |
return -4; |
return -4; |
| 308 |
} |
} |
| 309 |
|
|
| 310 |
|
snprintf(page_info_str, sizeof(page_info_str), |
| 311 |
|
"\033[33m[第\033[36m%d\033[33m/\033[36m%d\033[33m页]", |
| 312 |
|
page_id + 1, MAX(page_count, 1)); |
| 313 |
|
|
| 314 |
|
show_bottom(page_info_str); |
| 315 |
iflush(); |
iflush(); |
| 316 |
|
|
| 317 |
ret = section_list_select(p_section->page_count, article_count, &page_id, &selected_index); |
ret = section_list_select(page_count, article_count, &page_id, &selected_index); |
| 318 |
switch (ret) |
switch (ret) |
| 319 |
{ |
{ |
| 320 |
case EXIT_SECTION: |
case EXIT_SECTION: |
| 321 |
return 0; |
return 0; |
| 322 |
case CHANGE_PAGE: |
case CHANGE_PAGE: |
| 323 |
ret = query_section_articles(p_section, page_id, p_articles, &article_count); |
ret = query_section_articles(p_section, page_id, p_articles, &article_count, &page_count); |
| 324 |
if (ret < 0) |
if (ret < 0) |
| 325 |
{ |
{ |
| 326 |
log_error("query_section_articles(sid=%d, page_id=%d) error\n", p_section->sid, page_id); |
log_error("query_section_articles(sid=%d, page_id=%d) error\n", p_section->sid, page_id); |