| 159 |
|
|
| 160 |
if (kill(getppid(), SIGHUP) < 0) |
if (kill(getppid(), SIGHUP) < 0) |
| 161 |
{ |
{ |
| 162 |
log_error("Send SIGHUP signal failed (%d)\n", errno); |
log_error("Send SIGHUP signal failed (%d)", errno); |
| 163 |
|
|
| 164 |
prints("发送指令失败\r\n"); |
prints("发送指令失败\r\n"); |
| 165 |
} |
} |
| 182 |
|
|
| 183 |
if (toupper(buf[0]) == 'Y') |
if (toupper(buf[0]) == 'Y') |
| 184 |
{ |
{ |
| 185 |
log_common("Notify main process to exit by [%s]\n", BBS_username); |
log_common("Notify main process to exit by [%s]", BBS_username); |
| 186 |
|
|
| 187 |
if (kill(getppid(), SIGTERM) < 0) |
if (kill(getppid(), SIGTERM) < 0) |
| 188 |
{ |
{ |
| 189 |
log_error("Send SIGTERM signal failed (%d)\n", errno); |
log_error("Send SIGTERM signal failed (%d)", errno); |
| 190 |
} |
} |
| 191 |
} |
} |
| 192 |
|
|
| 227 |
p_article = article_block_find_by_aid(aid); |
p_article = article_block_find_by_aid(aid); |
| 228 |
if (p_article == NULL) |
if (p_article == NULL) |
| 229 |
{ |
{ |
| 230 |
log_error("article_block_find_by_aid(%d) error\n", aid); |
log_error("article_block_find_by_aid(%d) error", aid); |
| 231 |
return NOREDRAW; |
return NOREDRAW; |
| 232 |
} |
} |
| 233 |
|
|
| 234 |
if (article_cache_load(&cache, VAR_ARTICLE_CACHE_DIR, p_article) < 0) |
if (article_cache_load(&cache, VAR_ARTICLE_CACHE_DIR, p_article) < 0) |
| 235 |
{ |
{ |
| 236 |
log_error("article_cache_load(aid=%d, cid=%d) error\n", p_article->aid, p_article->cid); |
log_error("article_cache_load(aid=%d, cid=%d) error", p_article->aid, p_article->cid); |
| 237 |
return NOREDRAW; |
return NOREDRAW; |
| 238 |
} |
} |
| 239 |
|
|
| 240 |
if (user_online_update("VIEW_ARTICLE") < 0) |
if (user_online_update("VIEW_ARTICLE") < 0) |
| 241 |
{ |
{ |
| 242 |
log_error("user_online_update(VIEW_ARTICLE) error\n"); |
log_error("user_online_update(VIEW_ARTICLE) error"); |
| 243 |
} |
} |
| 244 |
|
|
| 245 |
ret = display_data(cache.p_data, cache.line_total, cache.line_offsets, 0, |
ret = display_data(cache.p_data, cache.line_total, cache.line_offsets, 0, |
| 247 |
|
|
| 248 |
if (article_cache_unload(&cache) < 0) |
if (article_cache_unload(&cache) < 0) |
| 249 |
{ |
{ |
| 250 |
log_error("article_cache_unload(aid=%d, cid=%d) error\n", p_article->aid, p_article->cid); |
log_error("article_cache_unload(aid=%d, cid=%d) error", p_article->aid, p_article->cid); |
| 251 |
} |
} |
| 252 |
|
|
| 253 |
// Update article_view_log |
// Update article_view_log |
| 254 |
if (article_view_log_set_viewed(p_article->aid, &BBS_article_view_log) < 0) |
if (article_view_log_set_viewed(p_article->aid, &BBS_article_view_log) < 0) |
| 255 |
{ |
{ |
| 256 |
log_error("article_view_log_set_viewed(aid=%d) error\n", p_article->aid); |
log_error("article_view_log_set_viewed(aid=%d) error", p_article->aid); |
| 257 |
} |
} |
| 258 |
|
|
| 259 |
return REDRAW; |
return REDRAW; |
| 266 |
p_section = section_list_find_by_name(param); |
p_section = section_list_find_by_name(param); |
| 267 |
if (p_section == NULL) |
if (p_section == NULL) |
| 268 |
{ |
{ |
| 269 |
log_error("Section %s not found\n", (const char *)param); |
log_error("Section %s not found", (const char *)param); |
| 270 |
return -1; |
return -1; |
| 271 |
} |
} |
| 272 |
|
|
| 273 |
if (section_list_ex_dir_display(p_section) < 0) |
if (section_list_ex_dir_display(p_section) < 0) |
| 274 |
{ |
{ |
| 275 |
log_error("section_list_ex_dir_display(sid=%d) error\n", p_section->sid); |
log_error("section_list_ex_dir_display(sid=%d) error", p_section->sid); |
| 276 |
} |
} |
| 277 |
|
|
| 278 |
return REDRAW; |
return REDRAW; |
| 308 |
|
|
| 309 |
if (user_online_update("TOP10_MENU") < 0) |
if (user_online_update("TOP10_MENU") < 0) |
| 310 |
{ |
{ |
| 311 |
log_error("user_online_update(TOP10_MENU) error\n"); |
log_error("user_online_update(TOP10_MENU) error"); |
| 312 |
} |
} |
| 313 |
|
|
| 314 |
switch (ch) |
switch (ch) |
| 315 |
{ |
{ |
| 316 |
case KEY_NULL: // broken pipe |
case KEY_NULL: // broken pipe |
| 317 |
log_error("KEY_NULL\n"); |
log_debug("KEY_NULL"); |
| 318 |
loop = 0; |
loop = 0; |
| 319 |
break; |
break; |
| 320 |
case KEY_TIMEOUT: |
case KEY_TIMEOUT: |
| 321 |
if (time(NULL) - BBS_last_access_tm >= BBS_max_user_idle_time) |
if (time(NULL) - BBS_last_access_tm >= BBS_max_user_idle_time) |
| 322 |
{ |
{ |
| 323 |
log_error("User input timeout\n"); |
log_debug("User input timeout"); |
| 324 |
loop = 0; |
loop = 0; |
| 325 |
break; |
break; |
| 326 |
} |
} |
| 363 |
|
|
| 364 |
if (sname == NULL || aid == NULL) |
if (sname == NULL || aid == NULL) |
| 365 |
{ |
{ |
| 366 |
log_error("top10_locate(%s) error: invalid parameter\n", param); |
log_error("top10_locate(%s) error: invalid parameter", param); |
| 367 |
return NOREDRAW; |
return NOREDRAW; |
| 368 |
} |
} |
| 369 |
|
|
| 376 |
{ |
{ |
| 377 |
if (article_favor_display(&BBS_article_favor) < 0) |
if (article_favor_display(&BBS_article_favor) < 0) |
| 378 |
{ |
{ |
| 379 |
log_error("article_favor_display() error\n"); |
log_error("article_favor_display() error"); |
| 380 |
} |
} |
| 381 |
|
|
| 382 |
return REDRAW; |
return REDRAW; |
| 386 |
{ |
{ |
| 387 |
if (user_list_display(0) < 0) |
if (user_list_display(0) < 0) |
| 388 |
{ |
{ |
| 389 |
log_error("user_list_display(all_user) error\n"); |
log_error("user_list_display(all_user) error"); |
| 390 |
} |
} |
| 391 |
|
|
| 392 |
return REDRAW; |
return REDRAW; |
| 396 |
{ |
{ |
| 397 |
if (user_list_display(1) < 0) |
if (user_list_display(1) < 0) |
| 398 |
{ |
{ |
| 399 |
log_error("user_list_display(online_user) error\n"); |
log_error("user_list_display(online_user) error"); |
| 400 |
} |
} |
| 401 |
|
|
| 402 |
return REDRAW; |
return REDRAW; |
| 406 |
{ |
{ |
| 407 |
if (user_intro_edit(BBS_priv.uid) < 0) |
if (user_intro_edit(BBS_priv.uid) < 0) |
| 408 |
{ |
{ |
| 409 |
log_error("user_intro_edit(%d) error\n", BBS_priv.uid); |
log_error("user_intro_edit(%d) error", BBS_priv.uid); |
| 410 |
} |
} |
| 411 |
|
|
| 412 |
return REDRAW; |
return REDRAW; |
| 416 |
{ |
{ |
| 417 |
if (user_sign_edit(BBS_priv.uid) < 0) |
if (user_sign_edit(BBS_priv.uid) < 0) |
| 418 |
{ |
{ |
| 419 |
log_error("user_sign_edit(%d) error\n", BBS_priv.uid); |
log_error("user_sign_edit(%d) error", BBS_priv.uid); |
| 420 |
} |
} |
| 421 |
|
|
| 422 |
return REDRAW; |
return REDRAW; |