5 #include "auto_qmail.h"
12 substdio_putsflush(subfderr
,"sendmail: fatal: out of memory\n");
18 substdio_putsflush(subfderr
,"sendmail: usage: sendmail [ -t ] [ -fsender ] [ -Fname ] [ -bp ] [ -bs ] [ arg ... ]\n");
22 char *smtpdarg
[] = { "bin/qmail-smtpd", 0 };
25 if (!env_get("PROTO")) {
26 if (!env_put("RELAYCLIENT=")) nomem();
27 if (!env_put("DATABYTES=0")) nomem();
28 if (!env_put("PROTO=TCP")) nomem();
29 if (!env_put("TCPLOCALIP=127.0.0.1")) nomem();
30 if (!env_put("TCPLOCALHOST=localhost")) nomem();
31 if (!env_put("TCPREMOTEIP=127.0.0.1")) nomem();
32 if (!env_put("TCPREMOTEHOST=localhost")) nomem();
33 if (!env_put("TCPREMOTEINFO=sendmail-bs")) nomem();
35 execv(*smtpdarg
,smtpdarg
);
36 substdio_putsflush(subfderr
,"sendmail: fatal: unable to run qmail-smtpd\n");
40 char *qreadarg
[] = { "bin/qmail-qread", 0 };
43 execv(*qreadarg
,qreadarg
);
44 substdio_putsflush(subfderr
,"sendmail: fatal: unable to run qmail-qread\n");
60 if (chdir(auto_qmail
) == -1) {
61 substdio_putsflush(subfderr
,"sendmail: fatal: unable to switch to qmail home directory\n");
67 while ((opt
= getopt(argc
,argv
,"vimte:f:p:o:B:F:EJxb:")) != opteof
)
70 case 't': flagh
= 1; break;
71 case 'f': sender
= optarg
; break;
72 case 'F': if (!env_put2("MAILNAME",optarg
)) nomem(); break;
73 case 'p': break; /* could generate a Received line from optarg */
75 case 'i': break; /* what an absurd concept */
76 case 'x': break; /* SVR4 stupidity */
77 case 'm': break; /* twisted-paper-path blindness, incompetent design */
78 case 'e': break; /* qmail has only one error mode */
81 case 'd': break; /* qmail has only one delivery mode */
82 case 'e': break; /* see 'e' above */
83 case 'i': break; /* see 'i' above */
84 case 'm': break; /* see 'm' above */
87 case 'E': case 'J': /* Sony NEWS-OS */
88 while (argv
[optind
][optpos
]) ++optpos
; /* skip optional argument */
104 if (str_equal(optprogname
,"mailq"))
107 if (str_equal(optprogname
,"newaliases")) {
108 substdio_putsflush(subfderr
,"sendmail: fatal: please use fastforward/newaliases instead\n");
112 qiargv
= (char **) alloc((argc
+ 10) * sizeof(char *));
113 if (!qiargv
) nomem();
116 *arg
++ = "bin/qmail-inject";
117 *arg
++ = (flagh ?
"-H" : "-a");
123 for (i
= 0;i
< argc
;++i
) *arg
++ = argv
[i
];
126 execv(*qiargv
,qiargv
);
127 substdio_putsflush(subfderr
,"sendmail: fatal: unable to run qmail-inject\n");