Rev 5141 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
5141 | serge | 1 | /* |
2 | * Copyright (c) 1990 The Regents of the University of California. |
||
3 | * All rights reserved. |
||
4 | * |
||
5 | * Redistribution and use in source and binary forms are permitted |
||
6 | * provided that the above copyright notice and this paragraph are |
||
7 | * duplicated in all such forms and that any documentation, |
||
8 | * advertising materials, and other materials related to such |
||
9 | * distribution and use acknowledge that the software was developed |
||
10 | * by the University of California, Berkeley. The name of the |
||
11 | * University may not be used to endorse or promote products derived |
||
12 | * from this software without specific prior written permission. |
||
13 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR |
||
14 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED |
||
15 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
||
16 | */ |
||
17 | |||
18 | /* |
||
19 | FUNCTION |
||
6099 | serge | 20 | < |
5141 | serge | 21 | |
22 | INDEX |
||
23 | ferror |
||
6099 | serge | 24 | INDEX |
25 | ferror_unlocked |
||
5141 | serge | 26 | |
27 | ANSI_SYNOPSIS |
||
28 | #include |
||
29 | int ferror(FILE *<[fp]>); |
||
30 | |||
6099 | serge | 31 | #define _BSD_SOURCE |
32 | #include |
||
33 | int ferror_unlocked(FILE *<[fp]>); |
||
34 | |||
5141 | serge | 35 | TRAD_SYNOPSIS |
36 | #include |
||
37 | int ferror(<[fp]>) |
||
38 | FILE *<[fp]>; |
||
39 | |||
6099 | serge | 40 | #define _BSD_SOURCE |
41 | #include |
||
42 | int ferror_unlocked(<[fp]>) |
||
43 | FILE *<[fp]>; |
||
44 | |||
5141 | serge | 45 | DESCRIPTION |
46 | The < |
||
47 | pointer <[fp]>, to record whether any read or write errors have |
||
48 | occurred on the associated file or stream. |
||
49 | Use < |
||
50 | |||
51 | See < |
||
52 | |||
6099 | serge | 53 | < |
54 | < |
||
55 | protected by flockfile() (or ftrylockfile()) and funlockfile(). This |
||
56 | function may safely be used in a multi-threaded program if and only |
||
57 | if they are called while the invoking thread owns the (FILE *) |
||
58 | object, as is the case after a successful call to the flockfile() or |
||
59 | ftrylockfile() functions. If threads are disabled, then |
||
60 | < |
||
61 | |||
5141 | serge | 62 | RETURNS |
63 | < |
||
64 | nonzero value otherwise. |
||
65 | |||
66 | PORTABILITY |
||
67 | ANSI C requires < |
||
68 | |||
6099 | serge | 69 | < |
70 | |||
5141 | serge | 71 | No supporting OS subroutines are required. |
72 | */ |
||
73 | |||
74 | #if defined(LIBC_SCCS) && !defined(lint) |
||
75 | static char sccsid[] = "%W% (Berkeley) %G%"; |
||
76 | #endif /* LIBC_SCCS and not lint */ |
||
77 | |||
78 | #include <_ansi.h> |
||
79 | #include |
||
80 | #include "local.h" |
||
81 | |||
82 | /* A subroutine version of the macro ferror. */ |
||
83 | |||
84 | #undef ferror |
||
85 | |||
86 | int |
||
87 | _DEFUN(ferror, (fp), |
||
88 | FILE * fp) |
||
89 | { |
||
90 | int result; |
||
91 | CHECK_INIT(_REENT, fp); |
||
92 | _newlib_flockfile_start (fp); |
||
93 | result = __sferror (fp); |
||
94 | _newlib_flockfile_end (fp); |
||
95 | return result; |
||
96 | } |