# HG changeset patch # User Olaf Hering <o...@aepfle.de> # Date 1306149750 -7200 # Branch HEAD # Node ID 4d73cc1a137c98a9b75bc40065b94f58f1b5e6ce # Parent a6fb39a7847a1d27ecb6896fe6df3f8902a8ca22 folder_file: introduce and use new ->local flag
Add and use new flag to indicate the folder is on local filesystem. This is a prereq before removing struct stat in struct folder_file. Update years in copyright line. Signed-off-by: Olaf Hering <o...@aepfle.de> diff -r a6fb39a7847a -r 4d73cc1a137c browser.c --- a/browser.c Mon May 23 12:59:14 2011 +0200 +++ b/browser.c Mon May 23 13:22:30 2011 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (C) 1996-2000,2007 Michael R. Elkins <m...@mutt.org> + * Copyright (C) 1996-2000,2007,2011 Michael R. Elkins <m...@mutt.org> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -163,7 +163,7 @@ folder_format_str (char *dest, size_t de case 'd': case 'D': - if (folder->ff->st != NULL) + if (folder->ff->local) { int do_locales = TRUE; @@ -200,7 +200,7 @@ folder_format_str (char *dest, size_t de s = NONULL (folder->ff->name); snprintf (fn, sizeof (fn), "%s%s", s, - folder->ff->st ? (S_ISLNK (folder->ff->st->st_mode) ? "@" : + folder->ff->local ? (S_ISLNK (folder->ff->st->st_mode) ? "@" : (S_ISDIR (folder->ff->st->st_mode) ? "/" : ((folder->ff->st->st_mode & S_IXUSR) != 0 ? "*" : ""))) : ""); @@ -208,7 +208,7 @@ folder_format_str (char *dest, size_t de break; } case 'F': - if (folder->ff->st != NULL) + if (folder->ff->local) { snprintf (permission, sizeof (permission), "%c%c%c%c%c%c%c%c%c%c", S_ISDIR(folder->ff->st->st_mode) ? 'd' : (S_ISLNK(folder->ff->st->st_mode) ? 'l' : '-'), @@ -237,7 +237,7 @@ folder_format_str (char *dest, size_t de break; case 'g': - if (folder->ff->st != NULL) + if (folder->ff->local) { if ((gr = getgrgid (folder->ff->st->st_gid))) mutt_format_s (dest, destlen, fmt, gr->gr_name); @@ -252,7 +252,7 @@ folder_format_str (char *dest, size_t de break; case 'l': - if (folder->ff->st != NULL) + if (folder->ff->local) { snprintf (tmp, sizeof (tmp), "%%%sd", fmt); snprintf (dest, destlen, tmp, folder->ff->st->st_nlink); @@ -280,7 +280,7 @@ folder_format_str (char *dest, size_t de break; case 's': - if (folder->ff->st != NULL) + if (folder->ff->local) { mutt_pretty_size(fn, sizeof(fn), folder->ff->st->st_size); snprintf (tmp, sizeof (tmp), "%%%ss", fmt); @@ -296,7 +296,7 @@ folder_format_str (char *dest, size_t de break; case 'u': - if (folder->ff->st != NULL) + if (folder->ff->local) { if ((pw = getpwuid (folder->ff->st->st_uid))) mutt_format_s (dest, destlen, fmt, pw->pw_name); @@ -346,7 +346,10 @@ static void add_folder (MUTTMENU *m, str (state->entry)[state->entrylen].st = safe_malloc (sizeof (struct stat)); memcpy ((state->entry)[state->entrylen].st, s, sizeof (struct stat)); + (state->entry)[state->entrylen].local = 1; } + else + (state->entry)[state->entrylen].local = 0; (state->entry)[state->entrylen].new = new; (state->entry)[state->entrylen].name = safe_strdup (name); diff -r a6fb39a7847a -r 4d73cc1a137c browser.h --- a/browser.h Mon May 23 12:59:14 2011 +0200 +++ b/browser.h Mon May 23 13:22:30 2011 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (C) 1996-2000 Michael R. Elkins <m...@mutt.org> + * Copyright (C) 1996-2000,2011 Michael R. Elkins <m...@mutt.org> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -37,6 +37,7 @@ struct folder_file unsigned selectable : 1; unsigned inferiors : 1; #endif + unsigned local : 1; /* folder is on local filesystem */ unsigned tagged : 1; };