#include <dos.h>\r
#endif\r
#include <time.h>\r
+\r
+#ifndef SSTDOC\r
+#define SSTDOC "sst.doc"\r
+#endif\r
\r
int getch(void);\r
\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
cmdbuf[j] = toupper(commands[i][j]);\r
cmdbuf[j] = '\0';\r
}\r
- fp = fopen("sst.doc", "r");\r
+ fp = fopen(SSTDOC, "r");\r
if (fp == NULL) {\r
prout("Spock- \"Captain, that information is missing from the");\r
prout(" computer. You need to find SST.DOC and put it in the");\r
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
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
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