[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: lynx-dev DOS newsposting - PATCH
From: |
Doug Kaufman |
Subject: |
Re: lynx-dev DOS newsposting - PATCH |
Date: |
Fri, 23 Jul 1999 19:14:09 -0700 (PDT) |
On Fri, 23 Jul 1999, T.E.Dickey wrote:
> > - if ((fd = LYOpenTemp(my_tempfile, HTML_SUFFIX, "w")) == NULL) {
> > +#ifdef __DJGPP__
> > + if ((fd = LYOpenTemp(my_tempfile, HTML_SUFFIX, "wb")) == NULL)
> > +#else
> > + if ((fd = LYOpenTemp(my_tempfile, HTML_SUFFIX, "w")) == NULL)
> > +#endif /* __DJGPP__ */
>
> can we use binary mode on all of these, or is DJGPP special?
I don't know if DJGPP is "special". I just wasn't sure what would
break on other systems. There may be a more general problem here,
though. Because of the effect of text mode on EOL, the DJGPP port
sets _fmode to O_BINARY, so that the default method of opening is
binary. Specific calls are made to temporarily switch to text mode
when necessary. LYOpenTemp is constructed to ignore this default and
open the temp files in text mode by default. I wondered if changing
LYOpenTemp to default to whatever _fmode specifies would be a better
change, but I wasn't sure what might break, or why it was set up
the way it was. It seems that in news posting there has to be a
0x0a between the headers and the body. Changing it to 0x0d 0x0a was
breaking the ability to post. Looking at the man pages for fopen,
SunOS 4.1.3_U1 doesn't mention "b" as an acceptable mode. FreeBSD
allows "b" but it is ignored. Excerpt from the DJGPP "open" info page
follows.
O_TEXT
The file is opened in text mode, meaning that Ctrl-M characters
are stripped on reading and added on writing as needed. The
default mode is specified by the _fmode variable section
_fmode.
O_BINARY
The file is opened in binary mode. When called to open the
console in binary mode, open will disable the generation of
SIGINT when you press Ctrl-C (Ctrl-Break will still cause
SIGINT), because many programs that use binary reads from the
console will also want to get the `^C' characters. You can use
the __djgpp_set_ctrl_c library function (see section
__djgpp_set_ctrl_c) if you want Ctrl-C to generate
interrupts while console is read in binary mode.
Doug
__
Doug Kaufman
Internet: address@hidden (preferred)
address@hidden