[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Probs with MiNTLib



Hi all!

As I played around with the MiNTLibs (PL 42, but the diffs to 43 and 44 show
no differences in the files concerning my problems) I recognized two things:

- scanf doesn't work properly with plain TOS
- on TOS 4.01 stderr won't work

The first problem is due to the function _read (in read.c). Fread (which is
called in there) doesn't add the linefeed/cr to the buffer when the user
completed the input by pressing return. So scanf still waits for the whitespace
to end the input line, and you have to press return twice.
As said before, this only happens *without* MiNT running. I solved the problem
by always adding a linefeed to the buffer when MiNT is not running and the
file read from is a tty. Is that OK?

The second problem is due to an error(?) in the Falcon-TOS: Fforce(2, -1)
returns EINHNDL, so anything written to stderr never appears on the screen.
As far as I know, this Fforce-call was documented by ATARI, so I wondered why
it didn't work. I then tried calling Fopen("CON:", 2) and *suprise*: I get
handle 6, instead of -1 (as said in the german 'Profibuch'). So one solution
(useable for all TOS-versions) would be calling Fforce(2, Fdup(1)), but since
Fdup has some severe problems, I didn't use this way. Instead, I tried calling
Fforce(2, Fopen("CON:", 2)), this works very nice. On old TOSes, the Fopen-
call returns -1, on newer ones 6 (or higher), and Fforce will work again. The
only disadvantage of this method is the the handle returned by the Fopen-call
has to be closed (if it is >= 6), but that can easily be done in function
exit. What do you think about that?


If this suggestions are useable, I'll post the diffs later (could take some
time).


Ciao

Thomas


--
/----------------------------------------------------------------------------\
| Thomas Binder (IRCNick: Gryf)                | "It all seems so stupid, it |
| Hauptstrasse 43b                             |  makes me want to give up,  |
| 61169 Friedberg                              |  but why should I give up,  |
| Germany                                      |  when it all seems so       |
| Email: binder@rbg.informatik.th-darmstadt.de |  stupid?" M. L. Gore        |
|----------------------------------------------------------------------------|
|       Auf frischer Tat ertappt - Dunkelheit bei Einbruch verhaftet!        |
\----------------------------------------------------------------------------/