-OBJS := datetime.o export.o main.o passwd.o shutdown.o sockets.o who.o
+OBJS := datetime.o export.o main.o passwd.o shutdown.o sockets.o who.o config.o
CFLAGS := -ggdb
if you request support for the program, you will be told to die in a
car fire.
-This is open source software. It runs really well on the Linux operating
-system. We reject Richard Stallman's linguistic fascism and so should you.
+License: you are permitted to use this software under the condition that
+you refer to it as "open source" and not "free software," and that you
+refer to the operating system on which it runs as "Linux" and not
+"GNU/Linux." By reading this notice you have already accepted the license,
+and you have irrevocably agreed that Richard Stallman is a communist.
--- /dev/null
+/*
+ * (c) 1987-2016 by Art Cancro and citadel.org
+ * This program is open source software, released under the terms of the GNU General Public License v3.
+ * It runs really well on the Linux operating system.
+ * We love open source software but reject Richard Stallman's linguistic fascism.
+ */
+
+#include "ctdlsh.h"
+
+
+int show_full_config(int server_socket) {
+ char buf[1024];
+
+ sock_puts(server_socket, "CONF listval");
+ sock_getln(server_socket, buf, sizeof buf);
+ if (buf[0] != '1') {
+ printf("%s\n", &buf[4]);
+ return(cmdret_error);
+ }
+
+ while (sock_getln(server_socket, buf, sizeof buf), strcmp(buf, "000")) {
+ char *val = NULL;
+ char *p = strchr(buf, '|');
+ if (p != NULL) {
+ val = p;
+ ++val;
+ *p = 0;
+ }
+ printf("%-30s = %s\n", buf, val);
+
+ }
+
+ return(cmdret_ok);
+}
+
+
+int cmd_config(int server_socket, char *cmdbuf) {
+
+ char buf[4096];
+ strncpy(buf, cmdbuf, sizeof buf);
+ char *p = strchr(buf, ' ');
+ if (p == NULL) {
+ return show_full_config(server_socket);
+ }
+
+ while (p[0]==' ') ++p;
+
+ if (strlen(p) == 0) {
+ return show_full_config(server_socket);
+ }
+
+ return(cmdret_error);
+}
int cmd_shutdown(int, char *);
int cmd_who(int, char *);
int cmd_export(int, char *);
+int cmd_config(int, char *);
{ "?", cmd_help, "Display this message" },
{ "help", cmd_help, "Display this message" },
{ "date", cmd_datetime, "Print the server's date and time" },
- { "exit", cmd_quit, "Quit using ctdlsh" },
+ { "config", cmd_config, "Configure the Citadel server" },
{ "export", cmd_export, "Export all Citadel databases" },
{ "shutdown", cmd_shutdown, "Shut down the Citadel server" },
{ "time", cmd_datetime, "Print the server's date and time" },
{ "passwd", cmd_passwd, "Set or change an account password" },
- { "quit", cmd_quit, "Quit using ctdlsh" },
{ "who", cmd_who, "Display a list of online users" },
+ { "exit", cmd_quit, "Quit using ctdlsh" },
+ { "quit", cmd_quit, "Quit using ctdlsh" },
{ NULL, NULL, NULL }
};