From 1717f9dc7d4282663cb5212af853819844b3e64c Mon Sep 17 00:00:00 2001 From: Mario Carneiro Date: Tue, 8 Feb 2022 02:40:58 -0500 Subject: [PATCH 1/3] use scrolling mode when used non-interactively --- src/metamath.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/metamath.c b/src/metamath.c index 696c3acb..6667d9ba 100644 --- a/src/metamath.c +++ b/src/metamath.c @@ -703,6 +703,7 @@ #include #include +#include #include "mmvstr.h" #include "mmdata.h" #include "mmcmdl.h" @@ -914,7 +915,8 @@ void command(int argc, char *argv[]) { double timeIncr = 0; flag printTime; /* Set by "/ TIME" in SAVE PROOF and others */ - flag defaultScrollMode = 1; /* Default to prompted mode */ + /* Default to prompted mode if run interactively, else continuous mode */ + flag defaultScrollMode = isatty(STDIN_FILENO); /* Initialization to avoid compiler warning (should not be theoretically necessary) */ From 2474919b86fde359d70ae57a56b74c100b766cc1 Mon Sep 17 00:00:00 2001 From: Mario Carneiro Date: Wed, 9 Feb 2022 01:48:32 -0500 Subject: [PATCH 2/3] fix for windows --- src/metamath.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/metamath.c b/src/metamath.c index 6667d9ba..c3b1c538 100644 --- a/src/metamath.c +++ b/src/metamath.c @@ -703,7 +703,6 @@ #include #include -#include #include "mmvstr.h" #include "mmdata.h" #include "mmcmdl.h" @@ -718,6 +717,14 @@ #include "mmword.h" #include "mmwtex.h" +// Windows doesn't have the header, but it has an isatty equivalent +#ifdef _WIN32 +#include +#define _isatty isatty +#else +#include +#endif + void command(int argc, char *argv[]); int main(int argc, char *argv[]) { From 08cb0f0ad5eeae83a5a23805a023549e19a84be8 Mon Sep 17 00:00:00 2001 From: Mario Carneiro Date: Wed, 9 Feb 2022 01:52:45 -0500 Subject: [PATCH 3/3] force to bool --- src/metamath.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/metamath.c b/src/metamath.c index c3b1c538..40169094 100644 --- a/src/metamath.c +++ b/src/metamath.c @@ -923,7 +923,7 @@ void command(int argc, char *argv[]) { flag printTime; /* Set by "/ TIME" in SAVE PROOF and others */ /* Default to prompted mode if run interactively, else continuous mode */ - flag defaultScrollMode = isatty(STDIN_FILENO); + flag defaultScrollMode = isatty(STDIN_FILENO) != 0; /* Initialization to avoid compiler warning (should not be theoretically necessary) */