summaryrefslogtreecommitdiffstats
path: root/substdio.h
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2013-02-04 00:08:53 +0100
committermanuel <manuel@mausz.at>2013-02-04 00:08:53 +0100
commit69aec538b456402170dc723af417ba5c05389c32 (patch)
treee6f34c543f17c6392447ea337b2e2868212424d1 /substdio.h
downloadqmail-69aec538b456402170dc723af417ba5c05389c32.tar.gz
qmail-69aec538b456402170dc723af417ba5c05389c32.tar.bz2
qmail-69aec538b456402170dc723af417ba5c05389c32.zip
qmail 1.03 import
Diffstat (limited to 'substdio.h')
-rw-r--r--substdio.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/substdio.h b/substdio.h
new file mode 100644
index 0000000..c3f7f7d
--- /dev/null
+++ b/substdio.h
@@ -0,0 +1,47 @@
1#ifndef SUBSTDIO_H
2#define SUBSTDIO_H
3
4typedef struct substdio {
5 char *x;
6 int p;
7 int n;
8 int fd;
9 int (*op)();
10} substdio;
11
12#define SUBSTDIO_FDBUF(op,fd,buf,len) { (buf), 0, (len), (fd), (op) }
13
14extern void substdio_fdbuf();
15
16extern int substdio_flush();
17extern int substdio_put();
18extern int substdio_bput();
19extern int substdio_putflush();
20extern int substdio_puts();
21extern int substdio_bputs();
22extern int substdio_putsflush();
23
24extern int substdio_get();
25extern int substdio_bget();
26extern int substdio_feed();
27
28extern char *substdio_peek();
29extern void substdio_seek();
30
31#define substdio_fileno(s) ((s)->fd)
32
33#define SUBSTDIO_INSIZE 8192
34#define SUBSTDIO_OUTSIZE 8192
35
36#define substdio_PEEK(s) ( (s)->x + (s)->n )
37#define substdio_SEEK(s,len) ( ( (s)->p -= (len) ) , ( (s)->n += (len) ) )
38
39#define substdio_BPUTC(s,c) \
40 ( ((s)->n != (s)->p) \
41 ? ( (s)->x[(s)->p++] = (c), 0 ) \
42 : substdio_bput((s),&(c),1) \
43 )
44
45extern int substdio_copy();
46
47#endif