Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

O_TEXT

17 views
Skip to first unread message

Paul Edwards

unread,
Feb 19, 2024, 5:36:14 PMFeb 19
to
Some operating systems like MVS present a whole
block of a block device to the application (thus
C library), and the C library is responsible for
sorting things out. Unix instead converts that
into a byte stream for you.

Similarly, it seems that almost everyone expects
the application, thus C library, to be responsible
for getting the line endings of text files correct.

There is one exception that I know of, sort of,
which is Cygwin, which has this in fcntl.h:

/* For machines which care - */
#if defined (_WIN32) || defined (__CYGWIN__)
#define _FBINARY 0x10000
#define _FTEXT 0x20000
#define _FNOINHERIT 0x40000

#define O_BINARY _FBINARY
#define O_TEXT _FTEXT
#define O_NOINHERIT _FNOINHERIT


Now when I am running a Linux ELF binary on PDOS/386,
I would prefer that it "fits in" with the rest of the
system and gets CRLF endings. Basically the same as
Cygwin.

For that to work I need the open syscall to carry the
text/binary information. Binary is the default, so I
just need a text flag.

Is there a suitable bit I can use?

There seems to be lots of things currently in use
(here are some):

#ifndef __O_LARGEFILE
# define __O_LARGEFILE 0100000
#ifndef __O_DIRECTORY
# define __O_DIRECTORY 0200000
#ifndef __O_NOFOLLOW
# define __O_NOFOLLOW 0400000
#ifndef __O_CLOEXEC
# define __O_CLOEXEC 02000000
#ifndef __O_DIRECT
# define __O_DIRECT 040000
#ifndef __O_NOATIME
# define __O_NOATIME 01000000
#ifndef __O_PATH
# define __O_PATH 010000000


I don't know what those are, and I don't know if
there are spare bits that won't cause an issue.

Another possibility would be to have a combination
of bits, perhaps an unusual combination, like I
assume switching off the access time above, and
that will be a hint that it is actually a text
mode file. So on Linux access times are no longer
a thing for any application I produce - but I don't
care about that. What I care is that PDOS/386 has
an opportunity to insert CRs.

Any suggestions?

Thanks. Paul.
0 new messages