use a proper "hack" for iconv functions:
[apps/madmutt.git] / init.c
diff --git a/init.c b/init.c
index c32e551..e8c3b0a 100644 (file)
--- a/init.c
+++ b/init.c
@@ -257,7 +257,7 @@ static void user_to_string (char* dst, size_t dstlen,
 
 static void sys_to_string (char* dst, size_t dstlen,
                            struct option_t* option) {
-  charval = NULL, *t = NULL;
+  char *val = NULL, *t = NULL;
   int clean = 0;
 
   /* get some $muttng_ values dynamically */
@@ -2220,7 +2220,7 @@ char *Matches[MAX (NUMVARS, NUMCOMMANDS) + 1];  /* all the matches + User_typed
        try == user entered data for completion.
        len == length of dest buffer.
 */
-static void candidate (char *dest, char *try, char *src, int len)
+static void candidate (char *dest, char *try, const char *src, int len)
 {
   int l;
 
@@ -2285,7 +2285,7 @@ int mutt_command_complete (char *buffer, size_t len, int pos, int numtabs)
            || !str_ncmp (buffer, "unset", 5)
            || !str_ncmp (buffer, "reset", 5)
            || !str_ncmp (buffer, "toggle", 6)) {    /* complete variables */
-    char *prefixes[] = { "no", "inv", "?", "&", 0 };
+    const char *prefixes[] = { "no", "inv", "?", "&", NULL };
 
     pt++;
     /* loop through all the possible prefixes (no, inv, ...) */
@@ -2408,7 +2408,7 @@ int mutt_var_value_complete (char *buffer, size_t len, int pos)
       char tmp[LONG_STRING], tmp2[LONG_STRING];
       char *s, *d;
       size_t dlen = buffer + len - pt - spaces;
-      char *vals[] = { "no", "yes", "ask-no", "ask-yes" };
+      const char *vals[] = { "no", "yes", "ask-no", "ask-yes" };
 
       tmp[0] = '\0';
 
@@ -2458,7 +2458,7 @@ int mutt_var_value_complete (char *buffer, size_t len, int pos)
                   "", p);
       } 
       else if (DTYPE (option->type) == DT_MAGIC) {
-        char *p;
+        const char *p;
         switch (DefaultMagic) {
           case M_MBOX:
             p = "mbox";
@@ -2529,7 +2529,7 @@ int mutt_query_variables (LIST * queries)
   return 0;
 }
 
-char *mutt_getnamebyvalue (int val, const struct mapping_t *map)
+const char *mutt_getnamebyvalue (int val, const struct mapping_t *map)
 {
   int i;
 
@@ -2573,7 +2573,8 @@ void mutt_init (int skip_sys_rc, LIST * commands)
 {
   struct passwd *pw;
   struct utsname utsname;
-  char *p, buffer[STRING], error[STRING];
+  const char *p;
+  char buffer[STRING], error[STRING];
   int i, default_rc = 0, need_pause = 0;
   BUFFER err;
 
@@ -2661,18 +2662,17 @@ void mutt_init (int skip_sys_rc, LIST * commands)
 #ifdef USE_NNTP
   {
     FILE *f;
-    char *i;
+    char *q;
 
     if ((f = safe_fopen (SYSCONFDIR "/nntpserver", "r"))) {
       buffer[0] = '\0';
       fgets (buffer, sizeof (buffer), f);
-      p = (char*) &buffer;
+      p = (char*)&buffer;
       SKIPWS (p);
-      i = p;
-      while (*i && (*i != ' ') && (*i != '\t') && (*i != '\r')
-             && (*i != '\n'))
-        i++;
-      *i = '\0';
+      q = p;
+      while (*q && !isspace(*q))
+        q++;
+      *q = '\0';
       NewsServer = str_dup (p);
       fclose (f);
     }