Commit | Line | Data |
---|---|---|
c9be6cfe KB |
1 | /*- |
2 | * Copyright (c) 1990 The Regents of the University of California. | |
3 | * 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 | * | |
466f0a37 | 10 | * @(#)local.h 5.2 (Berkeley) %G% |
c9be6cfe KB |
11 | */ |
12 | ||
13 | /* | |
14 | * Information local to this implementation of stdio, | |
15 | * in particular, macros and private variables. | |
16 | */ | |
17 | ||
466f0a37 CT |
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 _fwalk __P((int (*)(FILE *))); | |
30 | int __swsetup __P((FILE *)); | |
31 | int __sflags __P((const char *, int *)); | |
c9be6cfe KB |
32 | |
33 | extern int __sdidinit; | |
34 | ||
35 | /* | |
36 | * Return true iff the given FILE cannot be written now. | |
37 | */ | |
38 | #define cantwrite(fp) \ | |
39 | ((((fp)->_flags & __SWR) == 0 || (fp)->_bf._base == NULL) && \ | |
40 | __swsetup(fp)) | |
41 | ||
42 | /* | |
43 | * Test whether the given stdio file has an active ungetc buffer; | |
44 | * release such a buffer, without restoring ordinary unread data. | |
45 | */ | |
46 | #define HASUB(fp) ((fp)->_ub._base != NULL) | |
47 | #define FREEUB(fp) { \ | |
48 | if ((fp)->_ub._base != (fp)->_ubuf) \ | |
49 | free((char *)(fp)->_ub._base); \ | |
50 | (fp)->_ub._base = NULL; \ | |
51 | } | |
52 | ||
53 | /* | |
54 | * test for an fgetline() buffer. | |
55 | */ | |
56 | #define HASLB(fp) ((fp)->_lb._base != NULL) | |
57 | #define FREELB(fp) { \ | |
58 | free((char *)(fp)->_lb._base); \ | |
59 | (fp)->_lb._base = NULL; \ | |
60 | } |