Real zombies are undead, not the kind you see on TV.
authorArt Cancro <ajc@citadel.org>
Wed, 30 Oct 2019 01:08:00 +0000 (21:08 -0400)
committerArt Cancro <ajc@citadel.org>
Wed, 30 Oct 2019 01:08:00 +0000 (21:08 -0400)
ctdlsh/ctdlsh.h
ctdlsh/main.c
ctdlsh/shutdown.c

index 07ea1356244730b4405ecdd9d78c30a38da394eb..043d42b15b4cfe286c7e996e3e277148bb73d196 100644 (file)
@@ -49,3 +49,7 @@ int cmd_who(int, char *);
 int cmd_export(int, char *);
 int cmd_config(int, char *);
 int cmd_mailq(int, char *);
+int sock_puts(int, char *);
+int sock_getln(int, char *, int);
+void sock_printf(int, const char *, ...);
+int uds_connectsock(char *);
index cda33ec44c1fff20c562b3d02dc04576afbf815e..fd6663ecf6fb0a4e517ace1f6b38a0d42f3294dc 100644 (file)
@@ -38,6 +38,26 @@ COMMAND commands[] = {
 };
 
 
+
+struct wow {
+       char *cmd[5];                   // increase this if we need to have larger commands
+       char *description;
+};
+
+struct wow wows[] = {
+       {{ "show", "eggs" }                             , "show how many eggs are available for serving"        },
+       {{ "kill", "mark", "zuckerberg" }               , "die motherfucker die"                                },
+       {{ "show", "undead", "zombies", "real" }        , "show how many zombies are actually undead"           },
+       {{ "show", "undead", "zombies", "hollywood" }   , "show how many zombies are hollywood communists"      }
+};
+
+
+
+
+
+
+
+
 int cmd_help(int sock, char *cmdbuf)
 {
        int i;
@@ -110,6 +130,7 @@ void do_main_loop(int server_socket)
        int i;
        int ret = (-1);
 
+
        strcpy(prompt, "> ");
 
        /* Do an INFO command and learn the hostname for the prompt */
@@ -160,6 +181,25 @@ int main(int argc, char **argv)
        char cmd[1024] = { 0 };
        int exitcode = 0;
 
+
+       int num_wows = sizeof(wows) / sizeof(struct wow);
+       int j;
+       for (i=0; i<num_wows; ++i) {
+               printf("%s\n", wows[i].description);
+               for (j=0; j<5; ++j) {
+                       printf("%d '%s'\n", j, wows[i].cmd[j]);
+               }
+       }
+
+
+exit(0);
+
+
+
+
+
+
+
        for (i = 1; i < argc; ++i) {
                if (!strcmp(argv[i], "-h")) {
                        ctdldir = argv[++i];
index f15b23af47f82742ccf68f51596a6ee5dc71b5a5..04ec1f2ba13e69c6ca33d25dad8f80a9851645b3 100644 (file)
@@ -15,7 +15,7 @@ int cmd_shutdown(int server_socket, char *cmdbuf)
                return (cmdret_ok);
        }
 
-       sock_puts("DOWN");
+       sock_puts(server_socket, "DOWN");
        sock_getln(server_socket, buf, sizeof buf);
        if (buf[0] != '2') {
                fprintf(stderr, "%s\n", &buf[4]);