1 #ifndef IO_BUF__OBUF__H__ 2 #define IO_BUF__OBUF__H__ 6 #include "iobuf_common.h" 18 typedef int (*
obuf_fn)(int,
const void*,
unsigned long);
38 extern const char obuf_dec_digits[10] __DEPRECATED__;
39 extern const char obuf_hex_lcase_digits[16] __DEPRECATED__;
40 extern const char obuf_hex_ucase_digits[16] __DEPRECATED__;
43 #define OBUF_CREATE O_CREAT 45 #define OBUF_EXCLUSIVE O_EXCL 47 #define OBUF_TRUNCATE O_TRUNC 49 #define OBUF_APPEND O_APPEND 52 int obuf_open(
obuf* out,
const char* filename,
int oflags,
int mode,
unsigned bufsize);
55 #define obuf_error(out) iobuf_error(&(out)->io) 57 #define obuf_closed(out) iobuf_closed(&(out)->io) 59 #define obuf_timedout(out) iobuf_timedout(&((out)->io)) 66 #define obuf_rewind(out) obuf_seek(out,0) 68 #define obuf_tell(out) ((out)->io.offset+(out)->bufpos) 74 #define obuf_puts(out,str) obuf_write(out,str,strlen(str)) 76 int obuf_put3s(
obuf* out,
const char* s1,
const char* s2,
const char* s3);
77 int obuf_put4s(
obuf* out,
const char* s1,
const char* s2,
const char* s3,
79 int obuf_put5s(
obuf* out,
const char* s1,
const char* s2,
const char* s3,
80 const char* s4,
const char* s5);
81 int obuf_put6s(
obuf* out,
const char* s1,
const char* s2,
const char* s3,
82 const char* s4,
const char* s5,
const char* s6);
83 int obuf_put7s(
obuf* out,
const char* s1,
const char* s2,
const char* s3,
84 const char* s4,
const char* s5,
const char* s6,
const char* s7);
89 #define obuf_putstr(out,str) obuf_write(out,(str)->s,(str)->len) 94 int obuf_putuw(
obuf* out,
unsigned long data,
unsigned width,
char pad);
98 int obuf_putuwll(
obuf* out,
unsigned long long data,
unsigned width,
char pad);
100 int obuf_putxw(
obuf* out,
unsigned long data,
unsigned width,
char pad);
102 int obuf_putXw(
obuf* out,
unsigned long data,
unsigned width,
char pad);
104 int obuf_putxwll(
obuf* out,
unsigned long long data,
unsigned width,
char pad);
106 int obuf_putXwll(
obuf* out,
unsigned long long data,
unsigned width,
char pad);
108 unsigned base,
const char* digits);
110 unsigned base,
const char* digits);
112 unsigned base,
const char* digits);
114 unsigned base,
const char* digits);
int obuf_write_large(obuf *out, const char *data, unsigned datalen)
Definition: obuf_write.c:7
int obuf_pad(obuf *out, unsigned width, char ch)
Definition: obuf_pad.c:4
int obuf_putXll(obuf *out, unsigned long long data)
Definition: obuf_putullnumw.c:52
int obuf_put5s(obuf *out, const char *s1, const char *s2, const char *s3, const char *s4, const char *s5)
Definition: obuf_put5s.c:5
int obuf_put7s(obuf *out, const char *s1, const char *s2, const char *s3, const char *s4, const char *s5, const char *s6, const char *s7)
Definition: obuf_put7s.c:5
int obuf_put6s(obuf *out, const char *s1, const char *s2, const char *s3, const char *s4, const char *s5, const char *s6)
Definition: obuf_put6s.c:5
int obuf_seek(obuf *out, unsigned offset)
Definition: obuf_seek.c:7
int obuf_sign_pad(obuf *out, int sign, unsigned width, char pad)
Definition: obuf_sign_pad.c:10
int obuf_putill(obuf *out, long long data)
Definition: obuf_putsllnumw.c:21
int obuf_putullnumw(obuf *out, unsigned long long num, unsigned width, char pad, unsigned base, const char *digits)
Definition: obuf_putullnumw.c:6
int obuf_putu(obuf *out, unsigned long data)
Definition: obuf_putunumw.c:21
int obuf_putull(obuf *out, unsigned long long data)
Definition: obuf_putullnumw.c:24
int obuf_open(obuf *out, const char *filename, int oflags, int mode, unsigned bufsize)
Definition: obuf_open.c:4
unsigned count
Definition: obuf.h:28
int obuf_init(obuf *out, int fd, obuf_fn fn, unsigned flags, unsigned bufsize)
Definition: obuf_init.c:5
int obuf_putxwll(obuf *out, unsigned long long data, unsigned width, char pad)
Definition: obuf_putullnumw.c:31
int obuf_putf(obuf *out, const char *format,...)
Definition: obuf_putf.c:26
int obuf_putsnumw(obuf *out, long num, unsigned width, char pad, unsigned base, const char *digits)
Definition: obuf_putsnumw.c:5
int obuf_putsflush(obuf *out, const char *s)
Definition: obuf_putsflush.c:5
int(* obuf_fn)(int, const void *, unsigned long)
Definition: obuf.h:18
int obuf_putiwll(obuf *out, long long data, unsigned width, char pad)
Definition: obuf_putsllnumw.c:15
int obuf_putsllnumw(obuf *out, long long num, unsigned width, char pad, unsigned base, const char *digits)
Definition: obuf_putsllnumw.c:5
obuf_fn writefn
Definition: obuf.h:30
int obuf_put2s(obuf *out, const char *s1, const char *s2)
Definition: obuf_put2s.c:5
int obuf_putX(obuf *out, unsigned long data)
Definition: obuf_putunumw.c:47
int obuf_putuw(obuf *out, unsigned long data, unsigned width, char pad)
Definition: obuf_putunumw.c:15
unsigned bufpos
Definition: obuf.h:26
iobuf io
Definition: obuf.h:24
int obuf_putfv(obuf *out, const char *format, va_list ap)
Definition: obuf_putf.c:6
int obuf_putuwll(obuf *out, unsigned long long data, unsigned width, char pad)
Definition: obuf_putullnumw.c:18
int obuf_putc(obuf *out, char ch)
Definition: obuf_putc.c:4
int obuf_putXwll(obuf *out, unsigned long long data, unsigned width, char pad)
Definition: obuf_putullnumw.c:45
int obuf_putXw(obuf *out, unsigned long data, unsigned width, char pad)
Definition: obuf_putunumw.c:41
int obuf_putxw(obuf *out, unsigned long data, unsigned width, char pad)
Definition: obuf_putunumw.c:28
int obuf_puti(obuf *out, long data)
Definition: obuf_putsnumw.c:21
int obuf_putiw(obuf *out, long data, unsigned width, char pad)
Definition: obuf_putsnumw.c:15
obuf errbuf
Definition: obuf_stderr.c:7
int obuf_endl(obuf *out)
Definition: obuf_endl.c:4
Definition: iobuf_common.h:48
int obuf_close(obuf *out)
Definition: obuf_close.c:4
int obuf_flush(obuf *out)
Definition: obuf_flush.c:6
int obuf_putxll(obuf *out, unsigned long long data)
Definition: obuf_putullnumw.c:38
int obuf_sync(obuf *out)
Definition: obuf_sync.c:6
int obuf_write(obuf *out, const char *data, unsigned datalen)
Definition: obuf_write.c:30
int obuf_put3s(obuf *out, const char *s1, const char *s2, const char *s3)
Definition: obuf_put3s.c:5
obuf outbuf
Definition: obuf_stdout.c:7
int obuf_putns(obuf *out, unsigned int count,...)
Definition: obuf_putns.c:6
int obuf_putunumw(obuf *out, unsigned long num, unsigned width, char pad, unsigned base, const char *digits)
Definition: obuf_putunumw.c:5
int obuf_putx(obuf *out, unsigned long data)
Definition: obuf_putunumw.c:34
int obuf_putnetstring(obuf *out, const char *data, unsigned datalen)
Definition: obuf_putnetstring.c:4
int obuf_put4s(obuf *out, const char *s1, const char *s2, const char *s3, const char *s4)
Definition: obuf_put4s.c:5