nightmaremail

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

commit 7b0205f00d883bf0c4b752e94c493251f1e40fd5
parent ac7b99eb0c8f24cb54babd03f206ccad6b150ed1
Author: Rolf Eike Beer <eike@sf-mail.de>
Date:   Mon,  9 Nov 2020 17:46:29 +0100

add generator macro for substdio wrappers around qmail_put()

Diffstat:
Mcondredirect.c | 8++------
Mforward.c | 8++------
Mqmail.h | 7+++++++
3 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/condredirect.c b/condredirect.c @@ -15,16 +15,12 @@ struct qmail qqt; -ssize_t mywrite(int fd, const void *buf, size_t len) -{ - qmail_put(&qqt,buf,len); - return len; -} +GEN_QMAILPUT_WRITE(&qqt) char inbuf[SUBSTDIO_INSIZE]; char outbuf[1]; substdio ssin = SUBSTDIO_FDBUF(read,0,inbuf,sizeof inbuf); -substdio ssout = SUBSTDIO_FDBUF(mywrite,-1,outbuf,sizeof outbuf); +substdio ssout = SUBSTDIO_FDBUF(qmail_put_write,-1,outbuf,sizeof outbuf); char num[FMT_ULONG]; diff --git a/forward.c b/forward.c @@ -12,16 +12,12 @@ void die_nomem() { strerr_die2x(111,FATAL,"out of memory"); } struct qmail qqt; -ssize_t mywrite(int fd, const void *buf, size_t len) -{ - qmail_put(&qqt,buf,len); - return len; -} +GEN_QMAILPUT_WRITE(&qqt) char inbuf[SUBSTDIO_INSIZE]; char outbuf[1]; substdio ssin = SUBSTDIO_FDBUF(read,0,inbuf,sizeof inbuf); -substdio ssout = SUBSTDIO_FDBUF(mywrite,-1,outbuf,sizeof outbuf); +substdio ssout = SUBSTDIO_FDBUF(qmail_put_write,-1,outbuf,sizeof outbuf); char num[FMT_ULONG]; diff --git a/qmail.h b/qmail.h @@ -23,4 +23,11 @@ extern void qmail_fail(); extern char *qmail_close(); extern unsigned long qmail_qp(); +#define GEN_QMAILPUT_WRITE(qq) \ +ssize_t qmail_put_write(int fd, const void *buf, size_t len) \ +{ \ + qmail_put(qq,buf,len); \ + return len; \ +} + #endif