AmendHub

Download:

jcs

/

subtext

/

amendments

/

264

session: Unify "invalid option" help, mention pressing ?


jcs made amendment 264 over 2 years ago
--- session.c Sat Oct 1 21:33:04 2022 +++ session.c Tue Oct 4 22:52:44 2022 @@ -41,8 +41,9 @@ struct session *sessions[MAX_SESSIONS] = { 0 }; short nsessions = 0; struct session_tally session_today_tally = { 0 }; - static char session_log_tbuf[256]; +static const char invalid_option_help[] = + "Invalid option (press {{B}}?{{/B}} for help)\r\n"; void session_run(struct uthread *uthread, void *arg); short session_login(struct session *s); @@ -284,7 +285,7 @@ get_another_char: break; case '!': if (!s->user || !s->user->is_sysop) { - session_printf(s, "Invalid option\r\n"); + session_printf(s, invalid_option_help); session_flush(s); break; } @@ -304,7 +305,7 @@ get_another_char: session_flush(s); break; default: - session_printf(s, "Invalid option\r\n"); + session_printf(s, invalid_option_help); session_flush(s); break; } @@ -1475,7 +1476,8 @@ get_menu_option: if (last_invalid) goto get_menu_option; - session_printf(s, "%c\r\nInvalid option (press ? for help)\r\n", c); + session_printf(s, "%c\r\n", c); + session_printf(s, invalid_option_help); session_flush(s); last_invalid = true; }