[z88dk-dev] Workaround for CP/M (legacy lib)

Bridge to the z88dk-developers mailing list
Post Reply
stefano
Well known member
Posts: 1534
Joined: Mon Jul 16, 2007 7:39 pm

[z88dk-dev] Workaround for CP/M (legacy lib)

Post by stefano »

The Legacy library (or "classic", if you prefer this latter term) makes the "gets()" function fail; the EOL is not managed correctly by the tiny implementation in ASM.
I vaguely recall we already discussed this topic but I couldn't find it in the forum archives.

This workaround seems to work fine:

Code: Select all

/* You shouldn't use gets. z88 gets() is limited to 255 characters */
#ifdef __STDIO_CRLF
#define gets(x) fgets_cons(x,255)
#else
extern char __LIB__ *gets(char *s);
#endif
__STDIO_CRLF is defined only in the MSX, CP/M or OSCA variants, presumably capable of a complete stdio/fcntl support.
In all the other cases the asm implementation of gets() works well.
The new versions of stdio won't be impacted because they're based on different "stdio.h" variants.

Opinions ?


I noticed also another problem with CP/M: the old file and directory related example programs are all failing.. I'm investigating. I suspect drive number definition connected to the filename specification is connected to the problem.



------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
Post Reply