- sprintf(configfile, "%s/citadel.config", dirname);
- fd = open(configfile, O_RDONLY);
- if (fd < 0) {
- fprintf(stderr, "%s: %s\n", configfile, strerror(errno));
- return(-1);
+/*
+ * Commands understood by ctdlsh
+ */
+typedef struct {
+ char *name;
+ ctdlsh_cmdfunc_t *func;
+ char *doc;
+} COMMAND;
+
+COMMAND commands[] = {
+ { "?", cmd_help, "Display this message" },
+ { "help", cmd_help, "Display this message" },
+ { "quit", cmd_quit, "Quit using ctdlsh" },
+ { "exit", cmd_quit, "Quit using ctdlsh" },
+ { "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 }
+};
+
+
+int cmd_help(int sock, char *cmdbuf) {
+ int i;
+
+ for (i=0; commands[i].func != NULL; ++i) {
+ printf("%-10s %s\n", commands[i].name, commands[i].doc);