AmendHub

Download:

jcs

/

subtext

/

amendments

/

169

session: If ? is entered twice in row at the root menu, show full menu


jcs made amendment 169 over 2 years ago
--- session.c Wed Jun 22 21:57:25 2022 +++ session.c Thu Jun 23 10:14:08 2022 @@ -89,7 +89,7 @@ session_run(struct uthread *uthread, void *arg) struct session_tally tally; char date[9]; struct tm *date_tm; - unsigned short c; + unsigned short c, last_c = 0; bool done = false; short auth; @@ -250,11 +250,16 @@ get_another_char: sysop_menu(s); break; case '?': - /* short menu */ - if (!session_output_view(s, DB_TEXT_SHORTMENU_ID)) { + if (last_c == '?') { + /* asking twice in a row will print the full menu */ if (!session_output_view(s, DB_TEXT_MENU_ID)) - session_printf(s, "\r\n[ Short and long menu " - "missing! ]\r\n\r\n"); + session_printf(s, "\r\n[ Menu missing! ]\r\n\r\n"); + } else { + if (!session_output_view(s, DB_TEXT_SHORTMENU_ID)) { + if (!session_output_view(s, DB_TEXT_MENU_ID)) + session_printf(s, "\r\n[ Short and long menu " + "missing! ]\r\n\r\n"); + } } session_flush(s); break; @@ -263,6 +268,8 @@ get_another_char: session_flush(s); break; } + + last_c = c; } session_close(s);