10 #define FATAL "forward: fatal: "
12 void die_nomem() { strerr_die2x(111,FATAL
,"out of memory"); }
16 int mywrite(fd
,buf
,len
) int fd
; char *buf
; int len
;
18 qmail_put(&qqt
,buf
,len
);
22 char inbuf
[SUBSTDIO_INSIZE
];
24 substdio ssin
= SUBSTDIO_FDBUF(read
,0,inbuf
,sizeof inbuf
);
25 substdio ssout
= SUBSTDIO_FDBUF(mywrite
,-1,outbuf
,sizeof outbuf
);
39 sender
= env_get("NEWSENDER");
41 strerr_die2x(100,FATAL
,"NEWSENDER not set");
42 dtline
= env_get("DTLINE");
44 strerr_die2x(100,FATAL
,"DTLINE not set");
46 if (qmail_open(&qqt
) == -1)
47 strerr_die2sys(111,FATAL
,"unable to fork: ");
48 qmail_puts(&qqt
,dtline
);
49 if (substdio_copy(&ssout
,&ssin
) != 0)
50 strerr_die2sys(111,FATAL
,"unable to read message: ");
51 substdio_flush(&ssout
);
53 num
[fmt_ulong(num
,qmail_qp(&qqt
))] = 0;
55 qmail_from(&qqt
,sender
);
56 while (*++argv
) qmail_to(&qqt
,*argv
);
57 qqx
= qmail_close(&qqt
);
58 if (*qqx
) strerr_die2x(*qqx
== 'D' ?
100 : 111,FATAL
,qqx
+ 1);
59 strerr_die2x(0,"forward: qp ",num
);