mailx/nail-11.25-toaddr.dif

54 lines
1.5 KiB
Plaintext

--- main.c
+++ main.c 2005-10-17 14:36:24.000000000 +0200
@@ -184,10 +184,27 @@
if (*argv) {
/*
+ * Be compatible with broken mail behaviour, which use direct
+ * sendmail options for sending mails if getopt is skiped
+ * by first argument which is non option like a mail address.
+ */
+ char **opt = argv;
+ while (*(++opt) && (**opt) && (**opt != '-')) {
+ char *cp;
+ while ((cp = strrchr(*opt, ','))) {
+ *cp++ = '\0';
+ if (cp && *cp)
+ to = checkaddrs(cat(to, nalloc(cp, GTO)));
+ }
+ to = checkaddrs(cat(to, nalloc(*opt, GTO)));
+ argc--, argv++;
+ }
+
+ /*
* Use -R option for send and folder mode. In folder mode -R is used
* for read only and in send mode for providing a reply-to address.
*/
- char **opt = argv;
+ opt = argv;
while (*(++opt) && (**opt)) {
char *cp = *opt;
if (*cp == '-' && *(cp+1) == 'R') {
@@ -386,8 +403,19 @@
ef = argv[optind];
}
} else {
- for (i = optind; argv[i]; i++)
- to = checkaddrs(cat(to, extract(argv[i], GTO|GFULL)));
+ for (i = optind; (argv[i]) && (*argv[i] != '-'); i++) {
+ char *cp;
+ while ((cp = strrchr(argv[i], ','))) {
+ *cp++ = '\0';
+ if (cp && *cp)
+ to = checkaddrs(cat(to, nalloc(cp, GTO|GFULL)));
+ }
+ to = checkaddrs(cat(to, nalloc(argv[i], GTO|GFULL)));
+ }
+ if (argv[i] && (strcmp(argv[i], "--") == 0))
+ i++;
+ for (; argv[i]; i++)
+ smopts = cat(smopts, nalloc(argv[i], 0));
}
/*
* Check for inconsistent arguments.