From: Eric S. Raymond Date: Fri, 5 Nov 2004 01:02:46 +0000 (+0000) Subject: We have the framework of the curses interface working. X-Git-Tag: 2.0~427 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=998ff9c48426dd89c25b56ab59a0c8e2b6986355;p=super-star-trek.git We have the framework of the curses interface working. --- diff --git a/makefile b/makefile index b2ae616..c9c42b1 100644 --- a/makefile +++ b/makefile @@ -23,7 +23,7 @@ sst: $(OFILES) $(OFILES): $(HFILES) sst.6: sst.xml - xmlto man sst.xml + xmlto --skip-validation man sst.xml sst-doc.txt: sst-doc.xml xmlto -m sst-layer.xsl --skip-validation txt sst-doc.xml diff --git a/sst.c b/sst.c index c8ac356..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; - 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) { diff --git a/sst.h b/sst.h index f9eb043..b0da117 100644 --- a/sst.h +++ b/sst.h @@ -423,6 +423,6 @@ void attakreport(void); void movetho(void); void probe(void); void clearscreen(void); -void iostart(void); +void iostart(int); void ioend(void); void getline(char *, int); diff --git a/sst.xml b/sst.xml index 3cc6e33..f838a1f 100644 --- a/sst.xml +++ b/sst.xml @@ -14,7 +14,10 @@ - sst + sst + -t + command + @@ -36,9 +39,13 @@ url='http://sst.berlios.de/sst-doc.html'>browseable. On systems where /usr/share/doc/sst/ is a legal filename, it will probably be installed there as well. -Input tokens for the setup prompts will be read from the command -line before standard input. Thus, for example, you can invoke the -program as +There is one option -t, which forces the original pure-tty mode. +Normally sst tries to come up in full-screen mode that assumes it is +running on a cursor-addressable terminal or terminal emulator. + +Input tokens for the setup prompts will be read from the +remainder of the command line before standard input. Thus, for +example, you can invoke the program as sst regular medium good foobar