Lines Matching refs:stream
50 fcheck(FILE *stream, int flags) in fcheck() argument
53 if ((stream->_flag & flags) != flags) { in fcheck()
61 fclose(FILE *stream) in fclose() argument
63 if (!fcheck(stream, F_OPEN)) in fclose()
66 (void) close(stream->_file); in fclose()
67 stream->_flag = 0; in fclose()
68 stream->_file = -1; in fclose()
69 stream->_name[0] = '\0'; in fclose()
74 feof(FILE *stream) in feof() argument
76 if (!fcheck(stream, F_OPEN)) in feof()
79 return (stream->_len == stream->_offset); in feof()
83 ferror(FILE *stream) in ferror() argument
85 if (!fcheck(stream, F_OPEN)) in ferror()
88 return ((stream->_flag & F_ERROR) != 0); in ferror()
92 clearerr(FILE *stream) in clearerr() argument
94 stream->_flag &= ~F_ERROR; in clearerr()
98 fflush(FILE *stream) in fflush() argument
100 if (!fcheck(stream, F_OPEN)) in fflush()
108 fgets(char *s, int n, FILE *stream) in fgets() argument
113 if (!fcheck(stream, F_OPEN)) in fgets()
117 cnt = read(stream->_file, &s[bytes], 1); in fgets()
123 stream->_flag |= F_ERROR; in fgets()
134 stream->_offset++; in fgets()
151 FILE *stream; in fopen() local
185 stream = &__iob[i]; in fopen()
186 if ((stream->_flag & F_OPEN) == 0) { in fopen()
191 stream->_file = fd; in fopen()
192 stream->_flag |= F_OPEN; in fopen()
193 (void) strlcpy(stream->_name, filename, in fopen()
194 sizeof (stream->_name)); in fopen()
195 return (stream); in fopen()
219 fprintf(FILE *stream, const char *format, ...) in fprintf() argument
224 if (!fcheck(stream, F_OPEN)) in fprintf()
231 if (stream != stdout && stream != stderr) { in fprintf()
248 fread(void *ptr, size_t size, size_t nitems, FILE *stream) in fread() argument
254 if (!fcheck(stream, F_OPEN)) in fread()
258 bytes = read(stream->_file, &strp[totbytes], size); in fread()
260 stream->_flag |= F_ERROR; in fread()
266 stream->_offset += bytes; in fread()
269 (void) lseek(stream->_file, stream->_offset, SEEK_SET); in fread()
281 fseek(FILE *stream, long offset, int whence) in fseek() argument
285 if (!fcheck(stream, F_OPEN | F_SEEKABLE)) in fseek()
293 new_offset = stream->_offset + (off_t)offset; in fseek()
296 new_offset = (off_t)stream->_len + (off_t)offset; in fseek()
303 if (new_offset > (off_t)stream->_len) { in fseek()
311 result = lseek(stream->_file, new_offset, SEEK_SET); in fseek()
313 stream->_offset = result; in fseek()
315 stream->_flag |= F_ERROR; in fseek()
321 ftell(FILE *stream) in ftell() argument
323 if (!fcheck(stream, F_OPEN | F_SEEKABLE)) in ftell()
326 return ((long)stream->_offset); in ftell()
330 fwrite(const void *ptr, size_t size, size_t nitems, FILE *stream) in fwrite() argument
332 if (!fcheck(stream, F_OPEN)) in fwrite()
339 if (stream != stdout && stream != stderr) { in fwrite()
350 setvbuf(FILE *stream, char *buf, int type, size_t size) in setvbuf() argument
352 if (!fcheck(stream, F_OPEN)) in setvbuf()