Page 1 of 1

open RDR: seems to have a problem.

Posted: Fri Mar 02, 2018 7:50 pm
by jacotton
Phys_in = open("RDR:",O_RDONLY,'r');
if(Phys_in < 0){
printf("Can't open phys_in %d\n",Phys_in);
return 1;
}

My test code always returns -1.
Reading the open code in libsrc, it looks like it can fail at setfcb
and from there cascade. This is another issue (maybe), in setfcb the
fc->use flag is set to I+U_CON in the read code we are checking for
U_RDR. Does that get changed somewhere behind the curtains.

N0% stat dev:
CON: is CRT:
RDR: is TTY:
PUN: is TTY:
LST: is TTY:

and pip con:=rdr:
seems to working fine.

Posted: Fri Mar 02, 2018 8:03 pm
by jacotton
Additional note: I see that #DEVICES needs to defined for any of this to work. Is that a standard flag for the library build ?

Posted: Fri Mar 02, 2018 9:16 pm
by jacotton
Solved the open problem by -DDEVICES in Makefile in z88dk/libsrc/fcntl/cpm

Have not figured out the read yet.

Posted: Fri Mar 02, 2018 9:29 pm
by jacotton
adding this snip of code to my program, got the read working.
I think there is a bug in the fc->use flag management.

fc = &_fcb[Phys_in];
fc->use = U_RDR;

Posted: Sun Mar 04, 2018 2:53 pm
by dom
Thanks for the investigation. DEVICES was disabled because it caused all sorts of problems with zxcc.

Having poked around in the CPM fcntl a few weeks ago I'm not happy with it at all and can feel a rewrite coming on.

Posted: Sun Mar 04, 2018 7:15 pm
by dom
jacotton wrote:This is another issue (maybe), in setfcb the
fc->use flag is set to I+U_CON in the read code we are checking for
U_RDR. Does that get changed somewhere behind the curtains.
This looks okay, i = 1 for RDR:, so that should be 1 + 4 = 5 = U_RDR

Posted: Sun Mar 04, 2018 10:47 pm
by dom
To make things easier, I've created a separate library for fileio with devices - just link with -lcpmdevice and that version of fileio will be used in preference to the simple version. I'm can't remember what the issue with zxcc was, but it seems to have disappeared now.

I'll test RDR etc with yaze in the next few days.