X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=uip%2Fspost.c;h=76478c87a93a49d91f9c5836b22061cd0c62bf1a;hb=b28e871ba874a53257b37eed94adfc365ed6ebf2;hp=7d65eadac6e374be4d0f55f9afa5c7f136b3b034;hpb=1691e80890e5d8ba258c51c214a3e91880e1db2b;p=mmh diff --git a/uip/spost.c b/uip/spost.c index 7d65ead..76478c8 100644 --- a/uip/spost.c +++ b/uip/spost.c @@ -14,6 +14,7 @@ #include #include #include +#include #define uptolow(c) ((isalpha(c) && isupper (c)) ? tolower (c) : c) @@ -54,7 +55,7 @@ struct swit switches[] = { #define VERSIONSW 15 { "version", 0 }, #define HELPSW 16 - { "help", 4 }, + { "help", 0 }, #define DEBUGSW 17 { "debug", -5 }, #define DISTSW 18 @@ -311,8 +312,15 @@ main (int argc, char **argv) continue; case LIBSW: + if (!(cp = *argp++) || *cp == '-') + adios (NULL, "missing argument to %s", argp[-2]); + /* create a minimal context */ + if (context_foil (cp) == -1) + done(1); + continue; + case ANNOSW: - /* -library & -idanno switch ignored */ + /* -idanno switch ignored */ if (!(cp = *argp++) || *cp == '-') adios (NULL, "missing argument to %s", argp[-2]); continue; @@ -339,10 +347,15 @@ main (int argc, char **argv) out = stdout; } else { +#ifdef HAVE_MKSTEMP + if ((out = fdopen( mkstemp (tmpfil), "w" )) == NULL ) + adios (tmpfil, "unable to create"); +#else mktemp (tmpfil); if ((out = fopen (tmpfil, "w")) == NULL) adios (tmpfil, "unable to create"); chmod (tmpfil, 0600); +#endif } hdrtab = (msgstate == normal) ? NHeaders : RHeaders; @@ -443,6 +456,7 @@ main (int argc, char **argv) } execv ( sendmail, sargv); adios ( sendmail, "can't exec"); + return 0; /* dead code to satisfy the compiler */ } /* DRAFT GENERATION */ @@ -478,7 +492,7 @@ putfmt (char *name, char *str, FILE *out) if (hdr->flags & HFCC) { if ((cp = strrchr(str, '\n'))) *cp = 0; - for (cp = pp = str; cp = strchr(pp, ','); pp = cp) { + for (cp = pp = str; (cp = strchr(pp, ',')); pp = cp) { *cp++ = 0; insert_fcc (hdr, pp); } @@ -493,7 +507,7 @@ putfmt (char *name, char *str, FILE *out) } #endif /* notdef */ - if (*str != '\n' && *str != '\0') + if (*str != '\n' && *str != '\0') { if (aliasflg && hdr->flags & HTRY) { /* this header contains address(es) that we have to do * alias expansion on. Because of the saved state in @@ -518,8 +532,21 @@ putfmt (char *name, char *str, FILE *out) f = mp->m_next; mp->m_next = 0; putadr( name, f ); } else { + /* The author(s) of spost decided that alias substitution wasn't + necessary for the non-HTRY headers. Unfortunately, one of those + headers is "From:", and having alias substitution work on that is + extremely useful for someone with a lot of POP3 email accounts or + aliases. post supports aliasing of "From:"... + + Since "From:"-processing is incompletely implemented in this + unsupported and undocumented spost backend, I'm not going to take + the time to implement my new draft-From:-based email address + masquerading. If I do ever implement it here, I'd almost + certainly want to implement "From:" line alias processing as + well. -- Dan Harkless */ fprintf (out, "%s: %s", name, str ); } + } }