Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

open in text mode (O_TEXT) (Developers)

posted by kerravon E-mail, Sydney, Free World South, 24.02.2025, 04:19

So you're probably already familiar with Cygwin
adding an O_TEXT extension for Unix programs
so that when run under Windows the CRLF can be generated.

I have done the same thing with the Linux executables
I produce (by linking with PDPCLIB):

/* reserve 8000 0000 as a flag to indicate extension */
/* make sure O_TEXT hasn't been set to 0 by undefining */
/* and next available bit counting down is thus 4000 0000 */

#undef O_TEXT
#define O_TEXT 0x40000000

static int open(const char *a, int b, int *c)
{
int ret = -1;
int oflag = 0;

if (myfile->textMode)
{
oflag = O_TEXT;
}


And now I wish to do something similar with MSDOS open (21H 3DH).

https://www.ctyme.com/intr/rb-2779.htm


And this:

https://www.ctyme.com/intr/rb-2779.htm#Table1402

3 reserved (0)


looks like the most likely candidate. But as with Linux above,
I want to allow for more flags to be added. And it looks to
me like they are all in use (table 1402).

So what I would suggest is that bit 3 doesn't mean "O_TEXT",
it instead means "check register cx for more flags", and
then bit 0 of CX can mean O_TEXT.

Note that this is a more general question than just MSDOS.

Because I have the Pos wrappers, I actually call PosOpenFile,
which looks like this:

int PosOpenFile(const char *name, /* func 3d */
int mode,
int *handle);

So it is probably best for me to create a mode2 parameter
for the extended flags.

Although another option is to use the top 8 bits of the
existing mode parameter as the first 8 bits of the CX
extension.

However the spirit of the Pos functions was to match
directly onto the MSDOS registers.

Any thoughts on a "BTTR standard"?

Microsoft obviously don't care so it may as well be
BTTR that is the defacto "steering committee".

Thanks. Paul.

 

Complete thread:

Back to the forum
Board view  Mix view
22394 Postings in 2076 Threads, 400 registered users, 105 users online (2 registered, 103 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum