Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sq : input line too long, interactive console line = (1) column = (1) : error expression expected #292

Open
ryandesign opened this issue Jul 31, 2024 · 1 comment

Comments

@ryandesign
Copy link
Contributor

I've compiled and installed squirrel 3.2 on macOS. When I run sq I get a prompt:

% sq
Squirrel 3.2 stable Copyright (C) 2003-2022 Alberto Demichelis (64 bits)

sq>

Satisfied that the program was working, I wanted to exit. Many interactive programs let me exit by pressing Control-D but when I tried this at the sq> prompt I received a neverending stream of this message:

sq : input line too long
interactive console line = (1) column = (1) : error expression expected
sq>
sq : input line too long
interactive console line = (1) column = (1) : error expression expected
sq>
sq : input line too long
interactive console line = (1) column = (1) : error expression expected
sq>

The message comes from this code:

squirrel/sq/sq.c

Lines 268 to 271 in c02bf2d

else if (i >= MAXINPUT-1) {
scfprintf(stderr, _SC("sq : input line too long\n"));
break;
}

@Keith-S-Thompson
Copy link

Not surprisingly, I see the same issue on Ubuntu 22.04.5.

The following patch seems to correct the problem:

diff --git sq/sq.c sq/sq.c
index ee5eabb..ae7a664 100644
--- sq/sq.c
+++ sq/sq.c
@@ -248,7 +248,12 @@ void Interactive(HSQUIRRELVM v)
             int c;
             if(done)return;
             c = getchar();
-            if (c == _SC('\n')) {
+            if (c == EOF) {
+                done = true;
+                scprintf(_SC("\n"));
+                break;
+            }
+            else if (c == _SC('\n')) {
                 if (i>0 && buffer[i-1] == _SC('\\'))
                 {
                     buffer[i-1] = _SC('\n');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants