diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2023-12-18 21:14:07 +0100 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2023-12-18 21:14:07 +0100 |
commit | 51772a48b1febbda8864eda6b59c6f341163fd4a (patch) | |
tree | 80f7e97ce816a46304d156864432fdb371fddb49 /FICS/shutdown.c | |
parent | 9649a5b8169e1f3f3df169e9307f919f03b77836 (diff) |
Reformatted server_shutdown()
Diffstat (limited to 'FICS/shutdown.c')
-rw-r--r-- | FICS/shutdown.c | 48 |
1 files changed, 26 insertions, 22 deletions
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 |