| 485 |
USER_INFO user_info; |
USER_INFO user_info; |
| 486 |
char user_intro[BBS_user_intro_max_len + 1]; |
char user_intro[BBS_user_intro_max_len + 1]; |
| 487 |
int ok; |
int ok; |
| 488 |
|
int ch; |
| 489 |
|
|
| 490 |
username[0] = '\0'; |
username[0] = '\0'; |
| 491 |
|
|
| 493 |
|
|
| 494 |
while (!SYS_server_exit) |
while (!SYS_server_exit) |
| 495 |
{ |
{ |
| 496 |
|
clrline(3, SCREEN_ROWS); |
| 497 |
get_data(2, 1, "查找谁: ", username, sizeof(username), BBS_username_max_len); |
get_data(2, 1, "查找谁: ", username, sizeof(username), BBS_username_max_len); |
| 498 |
|
|
| 499 |
if (username[0] == '\0') |
if (username[0] == '\0') |
| 532 |
} |
} |
| 533 |
else if (ret > 1) |
else if (ret > 1) |
| 534 |
{ |
{ |
| 535 |
|
for (i = 0; i < MIN(ret, users_per_line * max_user_lines); i++) |
| 536 |
|
{ |
| 537 |
|
moveto(4 + i / users_per_line, 3 + i % users_per_line * (BBS_username_max_len + 3)); |
| 538 |
|
prints("%s", username_list[i]); |
| 539 |
|
} |
| 540 |
|
moveto(SCREEN_ROWS, 1); |
| 541 |
|
if (ret > users_per_line * max_user_lines) |
| 542 |
|
{ |
| 543 |
|
prints("还有更多..."); |
| 544 |
|
} |
| 545 |
|
|
| 546 |
moveto(3, 1); |
moveto(3, 1); |
| 547 |
prints("存在多个匹配的用户,[S]精确查找,[L]列出全部? [L]"); |
prints("存在多个匹配的用户,按\033[1;33mEnter\033[m精确查找"); |
| 548 |
iflush(); |
iflush(); |
|
igetch_reset(); |
|
| 549 |
|
|
| 550 |
switch (igetch_t(MAX_DELAY_TIME)) |
ch = igetch_t(MAX_DELAY_TIME); |
| 551 |
|
switch (ch) |
| 552 |
{ |
{ |
| 553 |
case KEY_NULL: |
case KEY_NULL: |
| 554 |
case KEY_TIMEOUT: |
case KEY_TIMEOUT: |
| 555 |
return -1; |
return -1; |
| 556 |
case KEY_ESC: |
case KEY_ESC: |
| 557 |
return 0; |
return 0; |
| 558 |
case 'S': |
case CR: |
|
case 's': |
|
| 559 |
ret = (strcasecmp(username_list[0], username) == 0 ? 1 : 0); |
ret = (strcasecmp(username_list[0], username) == 0 ? 1 : 0); |
| 560 |
break; |
break; |
| 561 |
case 'L': |
default: |
| 562 |
case 'l': |
i = (int)strnlen(username, sizeof(username) - 1); |
| 563 |
case CR: |
if (i + 1 <= BBS_username_max_len && (isalnum((char)ch) || ch == '_')) |
|
for (i = 0; i < MIN(ret, users_per_line * max_user_lines); i++) |
|
|
{ |
|
|
moveto(4 + i / users_per_line, 3 + i % users_per_line * (BBS_username_max_len + 3)); |
|
|
prints("%s", username_list[i]); |
|
|
} |
|
|
moveto(SCREEN_ROWS, 1); |
|
|
if (ret > users_per_line * max_user_lines) |
|
| 564 |
{ |
{ |
| 565 |
prints("还有更多..."); |
username[i] = (char)ch; |
| 566 |
|
username[i + 1] = '\0'; |
| 567 |
} |
} |
| 568 |
continue; |
continue; |
|
default: |
|
|
moveto(3, 1); |
|
|
clrtoeol(); |
|
|
continue; |
|
| 569 |
} |
} |
| 570 |
} |
} |
| 571 |
|
|
| 572 |
|
clrline(3, SCREEN_ROWS); |
| 573 |
if (ret == 0) |
if (ret == 0) |
| 574 |
{ |
{ |
| 575 |
moveto(3, 1); |
moveto(3, 1); |
|
clrtoeol(); |
|
| 576 |
prints("没有找到符合条件的用户"); |
prints("没有找到符合条件的用户"); |
| 577 |
press_any_key(); |
press_any_key(); |
| 578 |
return 0; |
return 0; |