new lua implementation.
[apps/madmutt.git] / sendlib.c
index 3bf9c91..ed4bbb9 100644 (file)
--- a/sendlib.c
+++ b/sendlib.c
@@ -12,6 +12,7 @@
 #include <signal.h>
 #include <sys/utsname.h>
 
+#include <lib-lua/lib-lua.h>
 #include <lib-sys/exit.h>
 #include <lib-sys/mutt_signal.h>
 #include <lib-mime/mime.h>
@@ -1505,7 +1506,7 @@ int mutt_write_rfc822_header (FILE * fp, ENVELOPE * env, BODY * attach,
       os = (uname(&un) == -1) ? "UNIX" : un.sysname;
     }
     /* Add a vanity header */
-    fprintf (fp, "User-Agent: %s (%s)\n", mutt_make_version (0), os);
+    fprintf (fp, "User-Agent: %s (%s)\n", mutt_make_version(), os);
   }
 
   return (ferror (fp) == 0 ? 0 : -1);
@@ -1831,31 +1832,29 @@ static int mutt_invoke_sendmail (address_t * from,        /* the sender */
                                  const char *msg,       /* file containing message */
                                  int eightbit)
 {                               /* message contains 8bit chars */
-  char *ps = NULL, *path = NULL, *s = NULL, *childout = NULL;
+  char cmd[LONG_STRING];
+  char *ps = NULL, *path = NULL, *childout = NULL;
   const char **args = NULL;
   ssize_t argslen = 0, argsmax = 0;
   int i;
 
 #ifdef USE_NNTP
   if (option (OPTNEWSSEND)) {
-    char cmd[LONG_STRING];
-
-    m_strformat(cmd, sizeof(cmd), Inews, nntp_format_str, 0, 0);
+    m_strformat(cmd, sizeof(cmd), 0, Inews, nntp_format_str, 0, 0);
     if (m_strisempty(cmd)) {
       i = nntp_post (msg);
       unlink (msg);
       return i;
     }
-
-    s = m_strdup(cmd);
-  }
-  else
+  } else
 #endif
-    s = m_strdup(Sendmail);
+  {
+    m_strcpy(cmd, sizeof(cmd), ml_core.sendmail);
+  }
 
-  ps = s;
+  ps = cmd;
   i = 0;
-  while ((ps = strtok (ps, " "))) {
+  while ((ps = strtok(ps, " "))) {
     if (argslen == argsmax)
       p_realloc(&args, argsmax += 5);
 
@@ -1930,7 +1929,6 @@ static int mutt_invoke_sendmail (address_t * from,        /* the sender */
 
   p_delete(&childout);
   p_delete(&path);
-  p_delete(&s);
   p_delete(&args);
 
   if (i == (EX_OK & 0xff))