Knows how to use LINES now.
[super-star-trek.git] / sst.c
diff --git a/sst.c b/sst.c
index b06a82fade956d28bd2b9b4f6b32a250d39db369..b3a0202663bd5d6760366c82f8a1bf73d4f24545 100644 (file)
--- a/sst.c
+++ b/sst.c
@@ -11,6 +11,7 @@ int getch(void);
 \r
 static char line[128], *linep = line;\r
 static int linecount;  /* for paging */\r
+static int screenheight = 24;\r
 \r
 static void clearscreen(void);\r
 \r
@@ -163,8 +164,8 @@ static void helpme(void) {
        while (fgets(linebuf, sizeof(linebuf),fp)) {\r
                if (strstr(linebuf, "******"))\r
                        break;\r
-               linebuf[strlen(linebuf)-1] = '\0'; // No \n at end\r
-               prout(linebuf);\r
+               /* use fputs here to avoid % expansion */\r
+               fputs(linebuf, stdout);\r
        }\r
        fclose(fp);\r
 }\r
@@ -355,6 +356,10 @@ int main(int argc, char **argv) {
        int hitme;\r
        char ch;\r
        prelim();\r
+       char *LINES = getenv("LINES");\r
\r
+       if (LINES)\r
+           screenheight = atoi(LINES);\r
 \r
        if (argc > 1) {\r
                fromcommandline = 1;\r
@@ -577,7 +582,7 @@ void pause(int i) {
 void skip(int i) {\r
        while (i-- > 0) {\r
                linecount++;\r
-               if (linecount >= 23)\r
+               if (linecount >= screenheight)\r
                        pause(0);\r
                else\r
                        putchar('\n');\r