-This is unfinished. Don't use it. Don't touch it. Go away.
-
-Die in a car fire.
+Someday this will be a Citadel server administration/maintenance shell.
+Right now it is unfinished. You are welcome to tinker with it and
+submit patches, but if you attempt to use it in a production system or
+if you request support for the program, you will be told to die in a
+car fire.
##/
bin_PROGRAMS = ctdlsh
-ctdlsh_SOURCES = main.c sockets.c ctdlsh.h datetime.c passwd.c
+ctdlsh_SOURCES = main.c sockets.c ctdlsh.h datetime.c passwd.c shutdown.c
am__installdirs = "$(DESTDIR)$(bindir)"
PROGRAMS = $(bin_PROGRAMS)
am_ctdlsh_OBJECTS = main.$(OBJEXT) sockets.$(OBJEXT) \
- datetime.$(OBJEXT) passwd.$(OBJEXT)
+ datetime.$(OBJEXT) passwd.$(OBJEXT) shutdown.$(OBJEXT)
ctdlsh_OBJECTS = $(am_ctdlsh_OBJECTS)
ctdlsh_LDADD = $(LDADD)
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-ctdlsh_SOURCES = main.c sockets.c ctdlsh.h datetime.c passwd.c
+ctdlsh_SOURCES = main.c sockets.c ctdlsh.h datetime.c passwd.c shutdown.c
all: all-am
.SUFFIXES:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/datetime.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/passwd.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shutdown.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sockets.Po@am__quote@
.c.o:
int cmd_quit(int, char *);
int cmd_datetime(int, char *);
int cmd_passwd(int, char *);
+int cmd_shutdown(int, char *);
{ "date", cmd_datetime, "Print the server's date and time" },
{ "time", cmd_datetime, "Print the server's date and time" },
{ "passwd", cmd_passwd, "Set or change an account password" },
+ { "shutdown", cmd_shutdown, "Shut down the Citadel server" },
{ NULL, NULL, NULL }
};
--- /dev/null
+/*
+ * (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);
+}
+
+
+
+