missing includes, intializers, consts
[apps/madmutt.git] / sendlib.c
index dd633de..7de69ea 100644 (file)
--- a/sendlib.c
+++ b/sendlib.c
@@ -1612,19 +1612,13 @@ int mutt_write_rfc822_header (FILE * fp, ENVELOPE * env, BODY * attach,
   }
 
   if (mode == 0 && !privacy && option (OPTXMAILER) && !has_agent) {
-    struct utsname un;
-    char *os;
+    const char *os;
 
     if (OperatingSystem != NULL) {
       os = OperatingSystem;
-    }
-    else {
-      if (uname (&un) == -1) {
-        os = "UNIX";
-      }
-      else {
-        os = un.sysname;
-      }
+    } else {
+      struct utsname un;
+      os = (uname(&un) == -1) ? "UNIX" : un.sysname;
     }
     /* Add a vanity header */
     fprintf (fp, "User-Agent: %s (%s)\n", mutt_make_version (0), os);
@@ -1812,7 +1806,7 @@ static RETSIGTYPE alarm_handler (int sig)
                        to the temporary file containing the stdout of the
                        child process */
 static int
-send_msg (const char *path, char **args, const char *msg, char **tempfile)
+send_msg(const char *path, const char **args, const char *msg, char **tempfile)
 {
   sigset_t set;
   int fd, st;
@@ -1950,8 +1944,8 @@ send_msg (const char *path, char **args, const char *msg, char **tempfile)
   return (st);
 }
 
-static char **add_args (char **args, size_t * argslen, size_t * argsmax,
-                        ADDRESS * addr)
+static const char **
+add_args(const char **args, size_t *argslen, size_t *argsmax, ADDRESS * addr)
 {
   for (; addr; addr = addr->next) {
     /* weed out group mailboxes, since those are for display only */
@@ -1964,13 +1958,14 @@ static char **add_args (char **args, size_t * argslen, size_t * argsmax,
   return (args);
 }
 
-static char **add_option (char **args, size_t * argslen, size_t * argsmax,
-                          char *s)
+static const char **
+add_option(const char **args, size_t *argslen, size_t *argsmax, const char *s)
 {
-  if (*argslen == *argsmax)
-    mem_realloc (&args, (*argsmax += 5) * sizeof (char *));
-  args[(*argslen)++] = s;
-  return (args);
+    if (*argslen == *argsmax) {
+        mem_realloc(&args, (*argsmax += 5) * sizeof (char *));
+    }
+    args[(*argslen)++] = s;
+    return (args);
 }
 
 static int mutt_invoke_sendmail (ADDRESS * from,        /* the sender */
@@ -1979,7 +1974,7 @@ static int mutt_invoke_sendmail (ADDRESS * from,        /* the sender */
                                  int eightbit)
 {                               /* message contains 8bit chars */
   char *ps = NULL, *path = NULL, *s = NULL, *childout = NULL;
-  char **args = NULL;
+  const char **args = NULL;
   size_t argslen = 0, argsmax = 0;
   int i;
 
@@ -2026,7 +2021,7 @@ static int mutt_invoke_sendmail (ADDRESS * from,        /* the sender */
   if (!option (OPTNEWSSEND)) {
 #endif
     if (eightbit && option (OPTUSE8BITMIME))
-      args = add_option (args, &argslen, &argsmax, "-B8BITMIME");
+      args = add_option(args, &argslen, &argsmax, "-B8BITMIME");
 
     if (option (OPTENVFROM)) {
       ADDRESS *f = NULL;
@@ -2503,7 +2498,7 @@ int mutt_write_fcc (const char *path, HEADER * hdr, const char *msgid,
     rewind (tempfp);
     while (fgets (sasha, sizeof (sasha), tempfp) != NULL)
       lines++;
-    fprintf (msg->fp, "Content-Length: " OFF_T_FMT "\n", ftello (tempfp));
+    fprintf (msg->fp, "Content-Length: %zd\n", ftello (tempfp));
     fprintf (msg->fp, "Lines: %d\n\n", lines);
 
     /* copy the body and clean up */