Address GitLab issue #10: Spurious '>' characters appearing in console output
The prompt logic has become unpleasantly complicated.
This commit is contained in:
parent
9e08cba63e
commit
6a6d9ca14e
7 changed files with 18 additions and 11 deletions
17
misc.c
17
misc.c
|
@ -640,14 +640,14 @@ bool MAPLIN(FILE *fp)
|
||||||
* and is not changed thereafter unless the routines on this page choose
|
* and is not changed thereafter unless the routines on this page choose
|
||||||
* to do so. */
|
* to do so. */
|
||||||
|
|
||||||
if (prompt)
|
|
||||||
fputs("> ", stdout);
|
|
||||||
do {
|
do {
|
||||||
if (!editline) {
|
if (!editline) {
|
||||||
|
if (prompt)
|
||||||
|
fputs("> ", stdout);
|
||||||
IGNORE(fgets(rawbuf,sizeof(rawbuf)-1,fp));
|
IGNORE(fgets(rawbuf,sizeof(rawbuf)-1,fp));
|
||||||
eof = (feof(fp));
|
eof = (feof(fp));
|
||||||
} else {
|
} else {
|
||||||
char *cp = linenoise(prompt ? "> ": "");
|
char *cp = linenoise("> ");
|
||||||
eof = (cp == NULL);
|
eof = (cp == NULL);
|
||||||
if (!eof) {
|
if (!eof) {
|
||||||
strncpy(rawbuf, cp, sizeof(rawbuf)-1);
|
strncpy(rawbuf, cp, sizeof(rawbuf)-1);
|
||||||
|
@ -663,10 +663,17 @@ bool MAPLIN(FILE *fp)
|
||||||
fclose(logfp);
|
fclose(logfp);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
FILE *efp = NULL;
|
||||||
if (logfp && fp == stdin)
|
if (logfp && fp == stdin)
|
||||||
IGNORE(fputs(rawbuf, logfp));
|
efp = logfp;
|
||||||
else if (!isatty(0))
|
else if (!isatty(0))
|
||||||
IGNORE(fputs(rawbuf, stdout));
|
efp = stdout;
|
||||||
|
if (efp != NULL)
|
||||||
|
{
|
||||||
|
if (prompt)
|
||||||
|
fputs("> ", efp);
|
||||||
|
IGNORE(fputs(rawbuf, efp));
|
||||||
|
}
|
||||||
strcpy(INLINE+1, rawbuf);
|
strcpy(INLINE+1, rawbuf);
|
||||||
LNLENG=0;
|
LNLENG=0;
|
||||||
for (i=1; i<=(long)sizeof(INLINE) && INLINE[i]!=0; i++) {
|
for (i=1; i<=(long)sizeof(INLINE) && INLINE[i]!=0; i++) {
|
||||||
|
|
|
@ -1298,7 +1298,7 @@ OK
|
||||||
|
|
||||||
You have taken the vase and hurled it delicately to the ground.
|
You have taken the vase and hurled it delicately to the ground.
|
||||||
|
|
||||||
>
|
|
||||||
You scored 139 out of a possible 430, using 210 turns.
|
You scored 139 out of a possible 430, using 210 turns.
|
||||||
|
|
||||||
You have achieved the rating: "Experienced Adventurer".
|
You have achieved the rating: "Experienced Adventurer".
|
||||||
|
|
|
@ -1772,7 +1772,7 @@ There is a large nest here, full of golden eggs!
|
||||||
|
|
||||||
OK
|
OK
|
||||||
|
|
||||||
>
|
|
||||||
You scored 219 out of a possible 430, using 293 turns.
|
You scored 219 out of a possible 430, using 293 turns.
|
||||||
|
|
||||||
You may now consider yourself a "Seasoned Adventurer".
|
You may now consider yourself a "Seasoned Adventurer".
|
||||||
|
|
|
@ -1415,7 +1415,7 @@ Your lamp is now on.
|
||||||
|
|
||||||
You're at "Y2".
|
You're at "Y2".
|
||||||
|
|
||||||
>
|
|
||||||
You scored 167 out of a possible 430, using 230 turns.
|
You scored 167 out of a possible 430, using 230 turns.
|
||||||
|
|
||||||
You have achieved the rating: "Experienced Adventurer".
|
You have achieved the rating: "Experienced Adventurer".
|
||||||
|
|
|
@ -132,7 +132,7 @@ have no bird seed.
|
||||||
|
|
||||||
The little bird is now dead. Its body disappears.
|
The little bird is now dead. Its body disappears.
|
||||||
|
|
||||||
>
|
|
||||||
You scored 32 out of a possible 430, using 22 turns.
|
You scored 32 out of a possible 430, using 22 turns.
|
||||||
|
|
||||||
You are obviously a rank amateur. Better luck next time.
|
You are obviously a rank amateur. Better luck next time.
|
||||||
|
|
|
@ -505,7 +505,7 @@ With what? Your bare hands?
|
||||||
|
|
||||||
Feed what?
|
Feed what?
|
||||||
|
|
||||||
>
|
|
||||||
You scored 103 out of a possible 430, using 86 turns.
|
You scored 103 out of a possible 430, using 86 turns.
|
||||||
|
|
||||||
Your score qualifies you as a novice class adventurer.
|
Your score qualifies you as a novice class adventurer.
|
||||||
|
|
|
@ -2627,7 +2627,7 @@ It is now pitch dark. If you proceed you will likely fall into a pit.
|
||||||
|
|
||||||
You're in Plover Room.
|
You're in Plover Room.
|
||||||
|
|
||||||
>
|
|
||||||
You scored 342 out of a possible 430, using 423 turns.
|
You scored 342 out of a possible 430, using 423 turns.
|
||||||
|
|
||||||
Your score puts you in Master Adventurer Class C.
|
Your score puts you in Master Adventurer Class C.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue