1 /*- 2 * Copyright (c) 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Chris Torek. 7 * 8 * %sccs.include.redist.c% 9 * 10 * @(#)local.h 8.1 (Berkeley) 06/04/93 11 */ 12 13 /* 14 * Information local to this implementation of stdio, 15 * in particular, macros and private variables. 16 */ 17 18 int __sflush __P((FILE *)); 19 FILE *__sfp __P((void)); 20 int __srefill __P((FILE *)); 21 int __sread __P((void *, char *, int)); 22 int __swrite __P((void *, char const *, int)); 23 fpos_t __sseek __P((void *, fpos_t, int)); 24 int __sclose __P((void *)); 25 void __sinit __P((void)); 26 void _cleanup __P((void)); 27 void (*__cleanup) __P((void)); 28 void __smakebuf __P((FILE *)); 29 int __swhatbuf __P((FILE *, size_t *, int *)); 30 int _fwalk __P((int (*)(FILE *))); 31 int __swsetup __P((FILE *)); 32 int __sflags __P((const char *, int *)); 33 34 extern int __sdidinit; 35 36 /* 37 * Return true iff the given FILE cannot be written now. 38 */ 39 #define cantwrite(fp) \ 40 ((((fp)->_flags & __SWR) == 0 || (fp)->_bf._base == NULL) && \ 41 __swsetup(fp)) 42 43 /* 44 * Test whether the given stdio file has an active ungetc buffer; 45 * release such a buffer, without restoring ordinary unread data. 46 */ 47 #define HASUB(fp) ((fp)->_ub._base != NULL) 48 #define FREEUB(fp) { \ 49 if ((fp)->_ub._base != (fp)->_ubuf) \ 50 free((char *)(fp)->_ub._base); \ 51 (fp)->_ub._base = NULL; \ 52 } 53 54 /* 55 * test for an fgetline() buffer. 56 */ 57 #define HASLB(fp) ((fp)->_lb._base != NULL) 58 #define FREELB(fp) { \ 59 free((char *)(fp)->_lb._base); \ 60 (fp)->_lb._base = NULL; \ 61 } 62