nightmaremail

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

substdio.h (1315B)


      1 #ifndef SUBSTDIO_H
      2 #define SUBSTDIO_H
      3 
      4 #include <sys/types.h>
      5 
      6 #include "deprecated.h"
      7 
      8 typedef struct substdio {
      9   char *x;
     10   int p;
     11   int n;
     12   int fd;
     13   ssize_t (*op)();
     14 } substdio;
     15 
     16 #define SUBSTDIO_FDBUF(o,f,buf,len) { (buf), 0, (len), (f), (o) }
     17 
     18 extern void substdio_fdbuf(substdio *s, ssize_t (*op)(), int fd, char *buf, int len);
     19 
     20 extern int substdio_flush();
     21 extern int substdio_put(substdio *s, char *buf, size_t len);
     22 extern int substdio_bput(substdio *s, char *buf, size_t len);
     23 extern int substdio_putflush(substdio *s, char *buf, size_t len);
     24 extern int substdio_puts();
     25 extern int substdio_bputs();
     26 extern int substdio_putsflush();
     27 
     28 extern ssize_t substdio_get(substdio *s, char *buf, size_t len);
     29 #ifdef DEPRECATED_FUNCTIONS_AVAILABLE
     30 extern ssize_t substdio_bget(substdio *s, char *buf, size_t len);
     31 #endif
     32 extern ssize_t substdio_feed(substdio *s);
     33 
     34 extern char *substdio_peek();
     35 extern void substdio_seek();
     36 
     37 #define substdio_fileno(s) ((s)->fd)
     38 
     39 #define SUBSTDIO_INSIZE 8192
     40 #define SUBSTDIO_OUTSIZE 8192
     41 
     42 #define substdio_PEEK(s) ( (s)->x + (s)->n )
     43 #define substdio_SEEK(s,len) ( ( (s)->p -= (len) ) , ( (s)->n += (len) ) )
     44 
     45 #define substdio_BPUTC(s,c) \
     46   ( ((s)->n != (s)->p) \
     47     ? ( (s)->x[(s)->p++] = (c), 0 ) \
     48     : substdio_bput((s),&(c),1) \
     49   )
     50 
     51 extern int substdio_copy();
     52 
     53 #endif