File: stream.h

package info (click to toggle)
fdclone 3.01b-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch
  • size: 4,772 kB
  • ctags: 8,674
  • sloc: ansic: 100,552; makefile: 4,497; sh: 1,480; sed: 224
file content (133 lines) | stat: -rw-r--r-- 3,274 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/*
 *	stream.h
 *
 *	definitions & function prototype declarations for "stream.c"
 */

#ifndef	__STREAM_H_
#define	__STREAM_H_

#include "depend.h"

#ifndef	XF_BUFSIZ
#define	XF_BUFSIZ		((ALLOC_T)BUFSIZ)
#endif

#if	MSDOS
#define	CH_EOF			'\032'
#else
#define	CH_EOF			'\004'
#endif

#ifdef	DEP_ORIGSTREAM
typedef struct _XFILE {
	int fd;
	int status;
	int flags;
	ALLOC_T ptr;
	ALLOC_T count;
	char buf[XF_BUFSIZ];
# ifdef	DEP_STREAMTIMEOUT
	int timeout;
# endif
# ifdef	DEP_STREAMLOG
	VOID_T (*dumpfunc)__P_((CONST u_char *, ALLOC_T, CONST char *));
	int debuglvl;
	CONST char *debugmes;
	char path[1];
# endif
} XFILE;
#else	/* !DEP_ORIGSTREAM */
#define	XFILE			FILE
#endif	/* !DEP_ORIGSTREAM */

#define	XS_EOF			000001
#define	XS_ERROR		000002
#define	XS_CLOSED		000004
#define	XS_READ			000010
#define	XS_WRITTEN		000020
#define	XS_BINARY		000040
#define	XS_RDONLY		000100
#define	XS_WRONLY		000200
#define	XS_LOCKED		000400
#define	XS_NOAHEAD		001000
#define	XS_CLEARBUF		002000
#define	XF_NOBUF		000001
#define	XF_LINEBUF		000002
#define	XF_CRNL			000004
#define	XF_NOCLOSE		000010
#define	XF_NONBLOCK		000020
#define	XF_CONNECTED		000040
#define	XF_TELNET		000100
#define	XF_NULLCONV		000200

#ifdef	DEP_ORIGSTREAM
extern XFILE *Xfopen __P_((CONST char *, CONST char *));
extern XFILE *Xfdopen __P_((int, CONST char *));
extern int Xfclose __P_((XFILE *));
extern VOID Xclearerr __P_((XFILE *));
extern int Xfeof __P_((XFILE *));
extern int Xferror __P_((XFILE *));
extern int Xfileno __P_((XFILE *));
extern VOID Xsetflags __P_((XFILE *, int));
# ifdef	DEP_STREAMTIMEOUT
extern VOID Xsettimeout __P_((XFILE *, int));
# endif
extern int Xfflush __P_((XFILE *));
extern int Xfpurge __P_((XFILE *));
extern int Xfread __P_((char *, ALLOC_T, XFILE *));
extern int Xfwrite __P_((CONST char *, ALLOC_T, XFILE *));
extern int Xfgetc __P_((XFILE *));
extern int Xfputc __P_((int, XFILE *));
extern char *Xfgets __P_((XFILE *));
extern int Xfputs __P_((CONST char *, XFILE *));
extern VOID Xsetbuf __P_((XFILE *));
extern VOID Xsetlinebuf __P_((XFILE *));
#else	/* !DEP_ORIGSTREAM */
#define	Xfopen			fopen
#define	Xfdopen			fdopen
#define	Xfclose			fclose
#define	Xclearerr		clearerr
#define	Xfeof			feof
#define	Xferror			ferror
#define	Xfileno			fileno
#define	Xfflush			fflush
#define	Xfpurge(f)
#define	Xfread(p, s, f)		fread(p, 1, s, f)
#define	Xfwrite(p, s, f)	fwrite(p, 1, s, f)
#define	Xfgetc			fgetc
#define	Xfputc			fputc
#define	Xfputs			fputs
# if	MSDOS
# define	Xsetbuf(f)	setbuf(f, NULL)
# define	Xsetlinebuf(f)
# else	/* !MSDOS */
#  ifdef	USESETVBUF
#  define	Xsetbuf(f)	setvbuf(f, NULL, _IONBF, 0)
#  define	Xsetlinebuf(f)	setvbuf(f, NULL, _IOLBF, 0)
#  else
#  define	Xsetbuf(f)	setbuf(f, NULL)
#  define	Xsetlinebuf(f)	setlinebuf(f)
#  endif
# endif	/* !MSDOS */
#endif	/* !DEP_ORIGSTREAM */
#if	defined (FD) && !defined (DEP_ORIGSHELL)
extern XFILE *Xpopen __P_((CONST char *, CONST char *));
extern int Xpclose __P_((XFILE *));
#endif
#ifndef	FD
extern char *gets2 __P_((CONST char *));
#endif

#ifdef	DEP_ORIGSTREAM
extern int (*stream_isnfsfunc)__P_((CONST char *));
extern XFILE *Xstdin;
extern XFILE *Xstdout;
extern XFILE *Xstderr;
#else
#define	Xstdin			stdin
#define	Xstdout			stdout
#define	Xstderr			stderr
#endif

#endif	/* !__STREAM_H_ */