[Z88dk-users] Error report gets() @ ZX81

Bridge to the z88dk-users mailing list
Post Reply
siggi
Well known member
Posts: 344
Joined: Thu Jul 26, 2007 9:06 am

[Z88dk-users] Error report gets() @ ZX81

Post by siggi »

I wanted to report an error and were forwarded to GITHUB to create it there.
But I need to create an account there to enter there a new error report.
I want to share the error information, but I don't want to share additional personal information neither with GITHUB nor with the data sink (we have in German the less kinds words "Datenkrake" or "Datenfresser", but I don't know the English equivalent) Microsoft.
So I post the error report here.

I tried to compile my old USB filemanager using the current nightly build. But now the function "gets()" fails at ZX81.
This is part of the code to save a file on USB stick

Code: Select all

                  if (!*name)
{
printk("name= ");
gets(name);
}
if (*name)
This code asks for a name, if it is not given. Then it reads it using gets(). If the name is then "" (empty), the SAVE command is aborted.

The old compiler dated 15/Dec/2015 gives that behaviour of gets:
a cursor "_" (a ZX81 graphic symbol) is written to screen. If a character is entered, it is inserted before the cursor, which moves right.
If I use backspace, the char before the cursor is deleted and the cursor moves left. If I have deleted all chars and press return, an empty string is in name and the SAVE command is aborted. That is the expected behaviour.

Now the buggy behaviour is:
a cursor 'E' is written to screen. If a character is entered, the cursor is overwritten and never occurs again. When I delete all entered characters to get an empty name string, the string "L" is stored in name. Thus the command is not aborted and a file "L.P" is stored on USB stick.

Siggi

PS: 2nd attempt



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

I tried to compile my old USB filemanager using the current nightly build. But now the function "gets()" fails at ZX81.
This is part of the code to save a file on USB stick

Code: Select all

                  if (!*name)
{
printk("name= ");
gets(name);
}
if (*name)
This code asks for a name, if it is not given. Then it reads it using gets(). If the name is then "" (empty), the SAVE command is aborted.
That was me back in February, I tried to remove duplication (we had two routines reading a string from the console). It looks like I removed the cursor and additionally gets() returned the newline character as well. I've just repaired the behaviour and the next build should work as you expect.

dom



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
siggi
Well known member
Posts: 344
Joined: Thu Jul 26, 2007 9:06 am

Post by siggi »

Problem is solved, cursor is back again :)
Thanks
Siggi



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Post Reply