]> git.pond.sub.org Git - empserver/blobdiff - src/lib/commands/shut.c
Fix trailing whitespace
[empserver] / src / lib / commands / shut.c
index 3e4a65dae8e3e4a23b653af4a4dd8909609e35a9..6e0fba8bacc7c9cace6c5e2d4967e58a7b326650 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2007, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2008, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                           Ken Stevens, Steve McClure
  *
  *  This program is free software; you can redistribute it and/or modify
  *  ---
  *
  *  shut.c: Shut down the server with a warning.
- * 
+ *
  *  Known contributors to this file:
  *     Ken Stevens, 1995
- *     Markus Armbruster, 2007
+ *     Markus Armbruster, 2007-2008
  */
 
 #include <config.h>
@@ -50,24 +50,33 @@ shut(void)
     shutdown_minutes =
        onearg(player->argp[1],
               "Time until shutdown in minutes (-1 to abort shutdown sequence)? ");
-    if (!updates_disabled())
-       if (!(p = getstarg(player->argp[2], "Disable update [y]? ", buf))
-           || *p != 'n')
+    if (player->aborted)
+       return RET_SYN;
+    if (!updates_disabled()) {
+       p = getstarg(player->argp[2], "Disable update [y]? ", buf);
+       if (!p)
+           return RET_SYN;
+       if (*p != 'n')
            disa();
+    }
 
     shutdown_was_pending = shutdown_initiate(shutdown_minutes);
     if (shutdown_was_pending < 0)
        return RET_FAIL;
 
-    if (shutdown_was_pending) {
-       if (shutdown_minutes >= 0) {
-           pr("The shutdown time has been changed to %d minutes!",
+    if (shutdown_minutes >= 0) {
+       if (shutdown_was_pending)
+           pr("The shutdown time has been changed to %d minutes!\n",
               shutdown_minutes);
-       } else {
-           pr("The server shutdown has been cancelled!");
+       else
+           pr("Shutdown sequence begun.\n");
+    } else {
+       if (shutdown_was_pending)
+           pr("The server shutdown has been cancelled!\n");
+       else {
+           pr("No shutdown to abort\n");
+           return RET_FAIL;
        }
-    } else if (shutdown_minutes) {
-       pr("Shutdown sequence begun.\n");
     }
     return RET_OK;
 }