removed all of the gnu autofoo crap from ctdlsh
[citadel.git] / ctdlsh / shutdown.c
diff --git a/ctdlsh/shutdown.c b/ctdlsh/shutdown.c
new file mode 100644 (file)
index 0000000..a3c253f
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * (c) 2011 by Art Cancro and citadel.org
+ * This program is released under the terms of the GNU General Public License v3.
+ */
+
+#include "ctdlsh.h"
+
+int cmd_shutdown(int server_socket, char *cmdbuf) {
+       char buf[1024];
+
+       char *p1 = readline("Do you really want to shut down the Citadel server? ");
+
+       if (strncasecmp(p1, "y", 1)) {
+               return(cmdret_ok);
+       }
+
+       sock_puts("DOWN");
+       sock_getln(server_socket, buf, sizeof buf);
+       if (buf[0] != '2') {
+               fprintf(stderr, "%s\n", &buf[4]);
+               return(cmdret_error);
+       }
+
+       fprintf(stderr, "%s\n", &buf[4]);
+       return(cmdret_ok);
+}