Mail Archives: djgpp-workers/2000/09/15/03:50:06
On Thu, 14 Sep 2000, Martin Str|mberg wrote:
> Here's patch (pasted so might not apply cleanly) that fixes bug 000323.
>
> It's mostly for discussion. Am I overlooking/overdoing something?
I think it would be good to pass the append bit to the fsext mechanism.
Of course, open(filename, O_APPEND) should work like
fopen(filename, "a"), so if you feel like implementing that, it would
be nice; that's not so easy to do, though.
> Index: src/libc/ansi/stdio/fopen.c
> ===================================================================
> RCS file: /cvs/djgpp/djgpp/src/libc/ansi/stdio/fopen.c,v
> retrieving revision 1.1
> diff -p -u -r1.1 fopen.c
> --- fopen.c 1995/08/23 07:49:24 1.1
> +++ fopen.c 2000/09/14 18:46:14
> @@ -55,8 +55,8 @@ fopen(const char *file, const char *mode
> if (fd < 0)
> return NULL;
>
> - if (*mode == 'a')
> - lseek(fd, 0, SEEK_END);
> + /* if (*mode == 'a')
> + lseek(fd, 0, SEEK_END); */
>
> f->_cnt = 0;
> f->_file = fd;
Why would you want not to have the file pointer at the end of the
file? But if you pass O_APPEND to open (to let fsext know about the
append bit), it will seek to end anyway, so this really is redundant.
> Index: src/libc/ansi/stdio/freopen.c
> ===================================================================
> RCS file: /cvs/djgpp/djgpp/src/libc/ansi/stdio/freopen.c,v
> retrieving revision 1.3
> diff -p -u -r1.3 freopen.c
> --- freopen.c 1999/06/03 17:27:33 1.3
> +++ freopen.c 2000/09/14 18:46:14
> @@ -49,8 +49,8 @@ freopen(const char *file, const char *mo
> if (fd < 0)
> return NULL;
>
> - if (*mode == 'a')
> - lseek(fd, 0, SEEK_END);
> + /* if (*mode == 'a')
> + lseek(fd, 0, SEEK_END);*/
>
> f->_cnt = 0;
> f->_file = fd;
The above comment applies here, too.
--
Esa Peuha
student of mathematics at the University of Helsinki
http://www.helsinki.fi/~peuha/
- Raw text -