continue the include dance
[apps/madmutt.git] / browser.c
index 5544e5a..12c41a9 100644 (file)
--- a/browser.c
+++ b/browser.c
 # include "config.h"
 #endif
 
+#include <stdlib.h>
+#include <dirent.h>
+#include <string.h>
+#include <ctype.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include <pwd.h>
+#include <grp.h>
+
 #include <lib-lib/mem.h>
 #include <lib-lib/str.h>
 #include <lib-lib/macros.h>
 
 #include "lib/list.h"
 
-#include <stdlib.h>
-#include <dirent.h>
-#include <string.h>
-#include <ctype.h>
-#include <unistd.h>
-#include <sys/stat.h>
-#include <errno.h>
-
 static struct mapping_t FolderHelp[] = {
   {N_("Exit"), OP_EXIT},
   {N_("Chdir"), OP_CHANGE_DIRECTORY},
@@ -77,7 +79,7 @@ static char LastDirBackup[_POSIX_PATH_MAX] = "";
 /* Frees up the memory allocated for the local-global variables.  */
 static void destroy_state (struct browser_state *state)
 {
-  unsigned int c;
+  int c;
 
   for (c = 0; c < state->entrylen; c++) {
     p_delete(&((state->entry)[c].name));
@@ -160,7 +162,7 @@ static int link_is_dir (const char *folder, const char *path)
     return 0;
 }
 
-static const char *folder_format_str (char *dest, size_t destlen, char op,
+static const char *folder_format_str (char *dest, ssize_t destlen, char op,
                                       const char *src, const char *fmt,
                                       const char *ifstring,
                                       const char *elsestring,
@@ -324,7 +326,7 @@ static const char *folder_format_str (char *dest, size_t destlen, char op,
 }
 
 #ifdef USE_NNTP
-static const char *newsgroup_format_str (char *dest, size_t destlen, char op,
+static const char *newsgroup_format_str (char *dest, ssize_t destlen, char op,
                                          const char *src, const char *fmt,
                                          const char *ifstring,
                                          const char *elsestring,
@@ -466,7 +468,7 @@ static int examine_directory (MUTTMENU * menu, struct browser_state *state,
 {
 #ifdef USE_NNTP
   if (option (OPTNEWS)) {
-    LIST *tmp;
+    string_list_t *tmp;
     NNTP_DATA *data;
     NNTP_SERVER *news = CurrentNewsSrv;
 
@@ -567,7 +569,7 @@ static int examine_mailboxes (MUTTMENU * menu, struct browser_state *state)
 
 #ifdef USE_NNTP
   if (option (OPTNEWS)) {
-    LIST *tmp;
+    string_list_t *tmp;
     NNTP_DATA *data;
     NNTP_SERVER *news = CurrentNewsSrv;
 
@@ -653,7 +655,7 @@ static int select_file_search (MUTTMENU * menu, regex_t * re, int n)
           (re, ((struct folder_file *) menu->data)[n].name, 0, NULL, 0));
 }
 
-static void folder_entry (char *s, size_t slen, MUTTMENU * menu, int num)
+static void folder_entry (char *s, ssize_t slen, MUTTMENU * menu, int num)
 {
   FOLDER folder;
 
@@ -671,7 +673,7 @@ static void folder_entry (char *s, size_t slen, MUTTMENU * menu, int num)
 }
 
 static void init_menu (struct browser_state *state, MUTTMENU * menu,
-                       char *title, size_t titlelen, int buffy)
+                       char *title, ssize_t titlelen, int buffy)
 {
   char path[_POSIX_PATH_MAX];
 
@@ -729,7 +731,7 @@ static int file_tag (MUTTMENU * menu, int n, int m)
   return ff->tagged - ot;
 }
 
-void _mutt_select_file (char *f, size_t flen, int flags, char ***files,
+void _mutt_select_file (char *f, ssize_t flen, int flags, char ***files,
                         int *numfiles)
 {
   char buf[_POSIX_PATH_MAX];
@@ -756,7 +758,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files,
     if (*f)
       m_strcpy(prefix, sizeof(prefix), f);
     else {
-      LIST *list;
+      string_list_t *list;
 
       /* default state for news reader mode is browse subscribed newsgroups */
       buffy = 0;
@@ -918,7 +920,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files,
             url_parse_ciss (&url, state.entry[menu->current].name);
             if (url.path &&
                 (state.entry[menu->current].delim != '\0') &&
-                (n < sizeof (LastDir))) {
+                (n < ssizeof (LastDir))) {
               LastDir[n] = '\0';
               LastDir[n - 1] = state.entry[menu->current].delim;
             }
@@ -981,7 +983,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files,
       if (multiple) {
         char **tfiles;
         int j;
-        unsigned int h;
+        int h;
 
         if (menu->tagged) {
           *numfiles = menu->tagged;
@@ -1112,9 +1114,9 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files,
       if (!state.imap_browse)
       {
         /* add '/' at the end of the directory name if not already there */
-        size_t len = m_strlen(LastDir);
+        ssize_t len = m_strlen(LastDir);
 
-        if (len && LastDir[len - 1] != '/' && sizeof (buf) > len)
+        if (len && LastDir[len - 1] != '/' && ssizeof(buf) > len)
           buf[len] = '/';
       }
 
@@ -1384,7 +1386,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files,
         break;
 
       {
-        LIST *tmp;
+        string_list_t *tmp;
         NNTP_DATA *data;
 
         for (tmp = CurrentNewsSrv->list; tmp; tmp = tmp->next) {
@@ -1478,7 +1480,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files,
           }
         }
         if (i == OP_SUBSCRIBE_PATTERN) {
-          LIST *grouplist = NULL;
+          string_list_t *grouplist = NULL;
 
           if (news)
             grouplist = news->list;