8 static void usage(char* arg0
) {
9 puts("A wrapper script for smailq that mimics sendmail.\n"
11 printf(" %s [OPTIONS] [recipient ...]\n", arg0
);
12 printf(" %s -bp\n", arg0
);
16 " Calls `smailq --list`\n"
19 " Prints this help text\n"
21 " [OPTIONS] [recipient ...]\n"
22 " Calls `smailq --send -- [OPTIONS] [recipient ...]`.\n"
23 " It passes all options as MSA options to smailq.\n");
26 int main(int argc
, char* argv
[]) {
28 fputs("No arguments given.\n", stderr
);
33 if (strcmp(argv
[1], "-h") == 0) {
38 if (strcmp(argv
[1], "-bp") == 0) {
39 execlp("smailq", "smailq", "list", NULL
);
40 perror("Error calling smailq --list");
44 /* We have to add two more arguments: -- --send */
45 char** newargv
= malloc((argc
+2)*sizeof(char*));
46 if (newargv
== NULL
) {
51 /* Fill in the arguments for smailq. Note that argv[argc] is NULL and
52 * newargv must be termined by a NULL pointer for execvp(). */
53 newargv
[0] = "smailq";
54 newargv
[1] = "--send";
56 for (int i
=1; i
<= argc
; ++i
)
57 newargv
[2+i
] = argv
[i
];
59 execvp("smailq", newargv
);
60 perror("Error calling smailq --list");