projects
/
super-star-trek.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add the README and spec files
[super-star-trek.git]
/
sst.c
diff --git
a/sst.c
b/sst.c
index b06a82fade956d28bd2b9b4f6b32a250d39db369..ae209e2cb373ed7cf7ad8a156e1fbf01b55bc092 100644
(file)
--- a/
sst.c
+++ b/
sst.c
@@
-6,11
+6,16
@@
#include <dos.h>
\r
#endif
\r
#include <time.h>
\r
#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
\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
\r
static void clearscreen(void);
\r
\r
@@
-134,7
+139,7
@@
static void helpme(void) {
cmdbuf[j] = toupper(commands[i][j]);
\r
cmdbuf[j] = '\0';
\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
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
@@
-163,8
+168,8
@@
static void helpme(void) {
while (fgets(linebuf, sizeof(linebuf),fp)) {
\r
if (strstr(linebuf, "******"))
\r
break;
\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
}
\r
fclose(fp);
\r
}
\r
@@
-355,6
+360,10
@@
int main(int argc, char **argv) {
int hitme;
\r
char ch;
\r
prelim();
\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
\r
if (argc > 1) {
\r
fromcommandline = 1;
\r
@@
-577,7
+586,7
@@
void pause(int i) {
void skip(int i) {
\r
while (i-- > 0) {
\r
linecount++;
\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
pause(0);
\r
else
\r
putchar('\n');
\r