Commit dec0fa94 by Martin v. Löwis Committed by Martin v. Löwis

* filebuf.cc (open): Support ios::ate if _G_HAVE_IO_FILE_OPEN.

From-SVN: r31057
parent 74a7ea12
1999-12-21 Martin v. Lwis <loewis@informatik.hu-berlin.de>
* filebuf.cc (open): Support ios::ate if _G_HAVE_IO_FILE_OPEN.
1999-12-15 Jason Merrill <jason@casey.cygnus.com> 1999-12-15 Jason Merrill <jason@casey.cygnus.com>
* filedoalloc.c, floatio.h, iovfprintf.c, iovfscanf.c: Remove * filedoalloc.c, floatio.h, iovfprintf.c, iovfscanf.c: Remove
......
/* This is part of libio/iostream, providing -*- C++ -*- input/output. /* This is part of libio/iostream, providing -*- C++ -*- input/output.
Copyright (C) 1993, 1995 Free Software Foundation Copyright (C) 1993, 1995, 1999 Free Software Foundation
This file is part of the GNU IO Library. This library is free This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the software; you can redistribute it and/or modify it under the
...@@ -112,15 +112,23 @@ filebuf* filebuf::open(const char *filename, ios::openmode mode, int prot) ...@@ -112,15 +112,23 @@ filebuf* filebuf::open(const char *filename, ios::openmode mode, int prot)
if (mode & (int)ios::noreplace) if (mode & (int)ios::noreplace)
posix_mode |= O_EXCL; posix_mode |= O_EXCL;
#if _G_HAVE_IO_FILE_OPEN #if _G_HAVE_IO_FILE_OPEN
return (filebuf*)_IO_file_open (this, filename, posix_mode, prot, if (!_IO_file_open (this, filename, posix_mode, prot,
read_write, 0); read_write, 0))
return NULL;
if (mode & ios::ate) {
if (pubseekoff(0, ios::end) == EOF) {
_IO_un_link (this);
return NULL;
}
}
return this;
#else #else
int fd = ::open(filename, posix_mode, prot); int fd = ::open(filename, posix_mode, prot);
if (fd < 0) if (fd < 0)
return NULL; return NULL;
_fileno = fd; _fileno = fd;
xsetflags(read_write, _IO_NO_READS+_IO_NO_WRITES+_IO_IS_APPENDING); xsetflags(read_write, _IO_NO_READS+_IO_NO_WRITES+_IO_IS_APPENDING);
if (mode & (ios::ate|ios::app)) { if (mode & ios::ate) {
if (pubseekoff(0, ios::end) == EOF) if (pubseekoff(0, ios::end) == EOF)
return NULL; return NULL;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment