|
|

楼主 |
发表于 2026-1-15 19:05:33
|
显示全部楼层
你说的对,这个prompt和ga紧密输出是fluffos里的,我记成mush里面处理了。
- int process_user_command(interactive_t *ip) {
- char *user_command;
- /*
- * WARNING: get_user_command() sets command_giver via
- * save_command_giver(), but only when the return is non-zero!
- */
- if (!(user_command = get_user_command(ip))) {
- return 0;
- }
- if (ip != command_giver->interactive) {
- DEBUG_FATAL("BUG: process_user_command.");
- }
- current_interactive = command_giver; /* this is yuck phooey, sigh */
- if (ip) {
- clear_notify(ip->ob);
- }
- // FIXME: move this to somewhere else
- update_load_av();
- debug(connections, "process_user_command: command_giver = /%s\n", command_giver->obname);
- if (!ip) {
- goto exit;
- }
- if (ip->iflags & USING_MXP) {
- if (user_command[0] == ' ' && user_command[1] == '[' && user_command[3] == 'z') {
- if (!on_receive_mxp_tag(ip, user_command)) {
- goto exit;
- }
- }
- }
- if (escape_command(ip, user_command)) {
- if (ip->iflags & SINGLE_CHAR) {
- /* only 1 char ... switch to line buffer mode */
- ip->iflags |= WAS_SINGLE_CHAR;
- ip->iflags &= ~SINGLE_CHAR;
- ip->text_start = ip->text_end = *ip->text = 0;
- set_linemode(ip, true);
- } else {
- if (ip->iflags & WAS_SINGLE_CHAR) {
- /* we now have a string ... switch back to char mode */
- ip->iflags &= ~WAS_SINGLE_CHAR;
- ip->iflags |= SINGLE_CHAR;
- set_charmode(ip, true);
- if (!IP_VALID(ip, command_giver)) {
- goto exit;
- }
- }
- process_input(ip, user_command + 1);
- }
- goto exit;
- }
- #ifdef OLD_ED
- if (ip->ed_buffer) {
- ed_cmd(user_command);
- goto exit;
- }
- #endif
- #if defined(F_INPUT_TO) || defined(F_GET_CHAR)
- if (call_function_interactive(ip, user_command)) {
- goto exit;
- }
- #endif
- process_input(ip, user_command);
- exit:
- /*
- * Print a prompt if user is still here.
- */
- if (IP_VALID(ip, command_giver)) {
- if (ip->input_to == nullptr) {
- print_prompt(ip);
- }
- if (ip->telnet && (ip->iflags & USING_TELNET) && !(ip->iflags & SUPPRESS_GA)) {
- telnet_send_ga(ip->telnet);
- }
- // FIXME: this doesn't belong here, should be moved to event.cc
- maybe_schedule_user_command(ip);
- }
- current_interactive = nullptr;
- restore_command_giver();
- return 1;
- }
复制代码
|
|