From 51772a48b1febbda8864eda6b59c6f341163fd4a Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Mon, 18 Dec 2023 21:14:07 +0100 Subject: Reformatted server_shutdown() --- FICS/shutdown.c | 48 ++++++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 22 deletions(-) (limited to 'FICS') diff --git a/FICS/shutdown.c b/FICS/shutdown.c index 61cf79c..2b2c58d 100644 --- a/FICS/shutdown.c +++ b/FICS/shutdown.c @@ -228,30 +228,34 @@ PUBLIC int com_shutdown(int p, param_list param) return COM_OK; } -PUBLIC int server_shutdown(int secs, char *why) +PUBLIC int +server_shutdown(int secs, char *why) { - int p1; + if (shutdownTime && shutdownTime <= secs) { + /* + * Server is already shutting down + */ + return 0; + } - if (shutdownTime && (shutdownTime <= secs)) { - /* Server is already shutting down, I'll let it go */ - return 0; - } - strcpy(downer, "Automatic"); - shutdownTime = secs; - shutdownStartTime = time(0); - for (p1 = 0; p1 < p_num; p1++) { - if (parray[p1].status != PLAYER_PROMPT) - continue; - pprintf(p1, "\n\n **** Automatic Server shutdown. ****\n"); - pprintf(p1, "%s\n", why); - pprintf_prompt(p1, - " **** Server going down in %d minutes and %d seconds. ****\n\n", - shutdownTime / 60, - shutdownTime - ((shutdownTime / 60) * 60)); - } - fprintf(stderr, "FICS: **** Automatic Server shutdown. ****\n"); - fprintf(stderr, "FICS: %s\n", why); - return 0; + strcpy(downer, "Automatic"); + shutdownTime = secs; + shutdownStartTime = time(NULL); + + for (int p1 = 0; p1 < p_num; p1++) { + if (parray[p1].status != PLAYER_PROMPT) + continue; + pprintf(p1, "\n\n **** Automatic Server shutdown. ****\n"); + pprintf(p1, "%s\n", why); + pprintf_prompt(p1, " **** Server going down in %d minutes " + "and %d seconds. ****\n\n", + (shutdownTime / 60), + shutdownTime - ((shutdownTime / 60) * 60)); + } + + fprintf(stderr, "FICS: **** Automatic Server shutdown. ****\n"); + fprintf(stderr, "FICS: %s\n", why); + return 0; } PUBLIC int -- cgit v1.2.3