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