annotate lib/freading.h @ 12518:b5e42ef33b49

update nearly all FSF copyright year lists to include 2009 The files named by the following are exempted: grep -v '^#' config/srclist.txt|grep -v '^$' \ | while read src dst; do test -f "$dst" && { echo "$dst"; continue; } test -d "$dst" || continue echo "$dst"/$(basename "$src") done > exempt git ls-files tests/unictype >> exempt In the remaining files, convert to all-interval notation if - there is already at least one year interval like 2000-2003 - the file is maintained by me - the file is in lib/uni*/, where that style already prevails Otherwise, use update-copyright's default.
author Jim Meyering <meyering@redhat.com>
date Mon, 28 Dec 2009 10:50:36 +0100
parents d97d0dec622d
children c2cbabec01dd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8720
367787d55c9c Implement freading and fwriting.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
1 /* Retrieve information about a FILE stream.
12518
b5e42ef33b49 update nearly all FSF copyright year lists to include 2009
Jim Meyering <meyering@redhat.com>
parents: 9883
diff changeset
2 Copyright (C) 2007-2009 Free Software Foundation, Inc.
8720
367787d55c9c Implement freading and fwriting.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
3
9309
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 8753
diff changeset
4 This program is free software: you can redistribute it and/or modify
8720
367787d55c9c Implement freading and fwriting.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
5 it under the terms of the GNU General Public License as published by
9309
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 8753
diff changeset
6 the Free Software Foundation; either version 3 of the License, or
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 8753
diff changeset
7 (at your option) any later version.
8720
367787d55c9c Implement freading and fwriting.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
8
367787d55c9c Implement freading and fwriting.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
9 This program is distributed in the hope that it will be useful,
367787d55c9c Implement freading and fwriting.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
367787d55c9c Implement freading and fwriting.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
367787d55c9c Implement freading and fwriting.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
12 GNU General Public License for more details.
367787d55c9c Implement freading and fwriting.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
13
9309
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 8753
diff changeset
14 You should have received a copy of the GNU General Public License
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 8753
diff changeset
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
8720
367787d55c9c Implement freading and fwriting.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
16
367787d55c9c Implement freading and fwriting.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
17 #include <stdbool.h>
367787d55c9c Implement freading and fwriting.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
18 #include <stdio.h>
367787d55c9c Implement freading and fwriting.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
19
8731
2e1ecfc17762 * lib/freading.h: Improve comments.
Eric Blake <ebb9@byu.net>
parents: 8720
diff changeset
20 /* Return true if the stream STREAM is opened read-only, or if the
2e1ecfc17762 * lib/freading.h: Improve comments.
Eric Blake <ebb9@byu.net>
parents: 8720
diff changeset
21 last operation on the stream was a read operation. Return false if
2e1ecfc17762 * lib/freading.h: Improve comments.
Eric Blake <ebb9@byu.net>
parents: 8720
diff changeset
22 the stream is opened write-only or append-only, or if it supports
9883
d97d0dec622d Typo in comment.
Bruno Haible <bruno@clisp.org>
parents: 9337
diff changeset
23 writing and there is no current read operation (such as fgetc).
8731
2e1ecfc17762 * lib/freading.h: Improve comments.
Eric Blake <ebb9@byu.net>
parents: 8720
diff changeset
24
2e1ecfc17762 * lib/freading.h: Improve comments.
Eric Blake <ebb9@byu.net>
parents: 8720
diff changeset
25 freading and fwriting will never both be true. If STREAM supports
8753
10d7922803f5 freading has an undefined value after repositioning a read-write stream.
Bruno Haible <bruno@clisp.org>
parents: 8731
diff changeset
26 both reads and writes, then:
10d7922803f5 freading has an undefined value after repositioning a read-write stream.
Bruno Haible <bruno@clisp.org>
parents: 8731
diff changeset
27 - both freading and fwriting might be false when the stream is first
10d7922803f5 freading has an undefined value after repositioning a read-write stream.
Bruno Haible <bruno@clisp.org>
parents: 8731
diff changeset
28 opened, after read encounters EOF, or after fflush,
10d7922803f5 freading has an undefined value after repositioning a read-write stream.
Bruno Haible <bruno@clisp.org>
parents: 8731
diff changeset
29 - freading might be false or true and fwriting might be false
10d7922803f5 freading has an undefined value after repositioning a read-write stream.
Bruno Haible <bruno@clisp.org>
parents: 8731
diff changeset
30 after repositioning (such as fseek, fsetpos, or rewind),
10d7922803f5 freading has an undefined value after repositioning a read-write stream.
Bruno Haible <bruno@clisp.org>
parents: 8731
diff changeset
31 depending on the underlying implementation.
8731
2e1ecfc17762 * lib/freading.h: Improve comments.
Eric Blake <ebb9@byu.net>
parents: 8720
diff changeset
32
8720
367787d55c9c Implement freading and fwriting.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
33 STREAM must not be wide-character oriented. */
367787d55c9c Implement freading and fwriting.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
34
9337
8df9b5f6609e Enable the use of __freading for glibc >= 2.7.
Bruno Haible <bruno@clisp.org>
parents: 9309
diff changeset
35 #if HAVE___FREADING && (!defined __GLIBC__ || __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 7))
8df9b5f6609e Enable the use of __freading for glibc >= 2.7.
Bruno Haible <bruno@clisp.org>
parents: 9309
diff changeset
36 /* Solaris >= 7, not glibc >= 2.2, but glibc >= 2.7 */
8720
367787d55c9c Implement freading and fwriting.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
37
367787d55c9c Implement freading and fwriting.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
38 # include <stdio_ext.h>
367787d55c9c Implement freading and fwriting.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
39 # define freading(stream) (__freading (stream) != 0)
367787d55c9c Implement freading and fwriting.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
40
367787d55c9c Implement freading and fwriting.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
41 #else
367787d55c9c Implement freading and fwriting.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
42
367787d55c9c Implement freading and fwriting.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
43 # ifdef __cplusplus
367787d55c9c Implement freading and fwriting.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
44 extern "C" {
367787d55c9c Implement freading and fwriting.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
45 # endif
367787d55c9c Implement freading and fwriting.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
46
367787d55c9c Implement freading and fwriting.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
47 extern bool freading (FILE *stream);
367787d55c9c Implement freading and fwriting.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
48
367787d55c9c Implement freading and fwriting.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
49 # ifdef __cplusplus
367787d55c9c Implement freading and fwriting.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
50 }
367787d55c9c Implement freading and fwriting.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
51 # endif
367787d55c9c Implement freading and fwriting.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
52
367787d55c9c Implement freading and fwriting.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
53 #endif