X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=sst.c;h=ee80b3fc878ba45048deeea559f9aae42f81b366;hb=bed74efa98d15a3f6497c9cc721785c6e7387c07;hp=c8ac356eda049da1ea740374e472d98172f8773b;hpb=dcf0ba85bdb6ca44ba8739cf69acca346f5e6a1a;p=super-star-trek.git diff --git a/sst.c b/sst.c index c8ac356..ee80b3f 100644 --- a/sst.c +++ b/sst.c @@ -1,6 +1,7 @@ #define INCLUDED // Define externs here -#include "sst.h" #include +#include +#include "sst.h" #ifndef SSTDOC #define SSTDOC "sst.doc" @@ -189,6 +190,7 @@ static void makemoves(void) { } else prout("UNRECOGNIZED COMMAND."); } + commandhook(commands[i], TRUE); switch (i) { /* command switch */ case 0: // srscan srscan(1); @@ -313,6 +315,7 @@ static void makemoves(void) { helpme(); // get help break; } + commandhook(commands[i], FALSE); for (;;) { if (alldone) break; // Game has ended #ifdef DEBUG @@ -344,20 +347,28 @@ static void makemoves(void) { int main(int argc, char **argv) { - int i; + int i, option, usecurses = TRUE; int hitme; char ch; - iostart(); + while ((option = getopt(argc, argv, "t")) != -1) { + switch (option) { + case 't': + usecurses = FALSE; + break; + default: + fprintf(stderr, "usage: sst [-t] [startcommand...].\n"); + exit(0); + } + } + + iostart(usecurses); prelim(); line[0] = '\0'; - if (argc > 1) { - while (--argc > 0) { - strcat(line, *(++argv)); - strcat(line, " "); - } + for (i = optind; i < argc; i++) { + strcat(line, argv[i]); + strcat(line, " "); } - while (TRUE) { /* Play a game */ setup(line[0] == '\0'); if (alldone) {