X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=sst.c;h=77fbeb826ba2b4f273df612835c408f13be1827b;hb=998ff9c48426dd89c25b56ab59a0c8e2b6986355;hp=f65a2a5e70aaabd347b0a44ce0920b63238a1080;hpb=a6c062d033c2cf9be1eb9e1164de84ba45379681;p=super-star-trek.git diff --git a/sst.c b/sst.c index f65a2a5..77fbeb8 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" @@ -344,20 +345,28 @@ static void makemoves(void) { int main(int argc, char **argv) { - int i; + int i, option, usecurses = TRUE; int hitme; char ch; + 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(); - iostart(); 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) { @@ -380,7 +389,8 @@ int main(int argc, char **argv) { if (!ja()) break; } skip(1); - prout("May the Great Bird of the Galaxy roost upon your home planet."); + ioend(); + puts("May the Great Bird of the Galaxy roost upon your home planet."); } @@ -479,7 +489,6 @@ int scan(void) { return IHEOL; } getline(line, sizeof(line)); - line[strlen(line)-1] = '\0'; linep = line; } // Skip leading white space