jcs
/subtext
/amendments
/465
sysop: Add menu option to reboot the system through Shutdown Manager
jcs made amendment 465 about 1 year ago
--- sysop.c Thu Apr 6 15:23:24 2023
+++ sysop.c Fri Apr 7 09:38:23 2023
@@ -15,6 +15,7 @@
*/
#include <string.h>
+#include <ShutDown.h>
#include "subtext.h"
#include "ansi.h"
@@ -46,6 +47,7 @@ sysop_menu(struct session *s)
{ 'f', "Ff", "Manage file folders" },
{ 'u', "Uu", "Manage users" },
{ 's', "Ss", "Change BBS settings" },
+ { 'r', "Rr", "Reboot system" },
{ 'q', "QqXx", "Return to main menu" },
{ '?', "?", "List menu options" },
};
@@ -93,6 +95,35 @@ sysop_menu(struct session *s)
case 'u':
sysop_edit_users(s);
break;
+ case 'r': {
+ IOParam pb;
+ long m;
+ short sc;
+
+ session_printf(s,
+ "Are you sure you want to reboot the system? [y/N] ");
+ session_flush(s);
+ sc = session_input_char(s);
+ if (sc != 'Y' && sc != 'y') {
+ session_output(s, "\r\n", 2);
+ session_flush(s);
+ break;
+ }
+ session_printf(s, "%c\r\n", sc == 'Y' ? 'Y' : 'y');
+ session_flush(s);
+
+ _exiting(0); /* call atexit list, from atexit.c */
+
+ /* flush the disk and give it a couple seconds */
+ memset(&pb, 0, sizeof(pb));
+ PBFlushVol(&pb, false);
+ Delay(120, &m);
+
+ ShutDwnStart();
+ /* we should never get here */
+ ExitToShell();
+ break;
+ }
case '?':
show_help = true;
break;