X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/1eedaf674c09aead10f12ec91f5e71d29924d642..ef1ba39e8dae81091b6c3e73e72825ef6edea3c6:/uip/viamail.c diff --git a/uip/viamail.c b/uip/viamail.c index e0143992..1514ef88 100644 --- a/uip/viamail.c +++ b/uip/viamail.c @@ -9,7 +9,6 @@ #include #include -#include #include #include #include @@ -57,12 +56,7 @@ main (int argc, char **argv) char *cp, buf[BUFSIZ]; char **argp, **arguments; -#ifdef LOCALE - setlocale(LC_ALL, ""); -#endif - invo_name = r1bindex (argv[0], '/'); - - context_read(); + if (nmh_init(argv[0], 2)) { return 1; } arguments = getarguments (invo_name, argc, argv, 0); argp = arguments; @@ -160,9 +154,9 @@ via_mail (char *mailsw, char *subjsw, char *parmsw, char *descsw, umask (~m_gmprot ()); - tfile = m_mktemp2(NULL, invo_name, NULL, &fp); - if (tfile == NULL) adios("viamail", "unable to create temporary file"); - chmod(tfile, 0600); + if ((tfile = m_mktemp2(NULL, invo_name, NULL, &fp)) == NULL) { + adios(NULL, "unable to create temporary file in %s", get_temp_dir()); + } strncpy (tmpfil, tfile, sizeof(tmpfil)); if (!strchr(mailsw, '@')) @@ -195,7 +189,7 @@ via_mail (char *mailsw, char *subjsw, char *parmsw, char *descsw, if (fflush (fp)) adios (tmpfil, "error writing to"); - writeBase64aux (stdin, fp); + writeBase64aux (stdin, fp, 0); if (fflush (fp)) adios (tmpfil, "error writing to"); @@ -219,7 +213,7 @@ via_mail (char *mailsw, char *subjsw, char *parmsw, char *descsw, vec[vecp++] = cp; } - switch (sendsbr (vec, vecp, program, tmpfil, &st, 0)) { + switch (sendsbr (vec, vecp, program, tmpfil, &st, 0, NULL)) { case DONE: case NOTOK: status++; @@ -229,8 +223,8 @@ via_mail (char *mailsw, char *subjsw, char *parmsw, char *descsw, } fclose (fp); - if (unlink (tmpfil) == -1) - advise (NULL, "unable to remove temp file %s", tmpfil); + if (m_unlink (tmpfil) == -1) + advise (tmpfil, "unable to remove temp file %s", tmpfil); done (status); return 1; }