Hiding size of "..", improvements for "bsize"



Hello!

I remember a discussion about mc loading the directory two levels above 
the current directory on VFS just to find the size of ".."

As the first step towards fixing this problem, the size of ".." will no be 
displayed even in the full listing.

While at this, I also changed the brief mode ("bsize" in the "User 
defined" listing) so that it shows "SUB-DIR" for symlinks to directories, 
not just for the directories.  Other symlinks will be shown as "SYMLINK".

===================================
--- ChangeLog
+++ ChangeLog
@@ -1 +1,10 @@
+2002-01-20  Pavel Roskin  <proski gnu org>
+
+	* screen.c (string_file_size): Don't display size of ".." - it
+	may take too much time to calculate it on VFS.  Show "UP--DIR"
+	instead.
+	(string_file_size_brief): Remove ".." handling - it's now done
+	in string_file_size().  Show "SUB-DIR" for links to directories,
+	"SYMLINK" for other links.
+
 2002-01-17  Pavel Roskin  <proski gnu org>
--- screen.c
+++ screen.c
@@ -172,6 +172,12 @@ string_file_size (file_entry *fe, int le
 {
     static char buffer [BUF_TINY];
 
+    /* Don't ever show size of ".." since we don't calculate it */
+    if (!strcmp (fe->fname, "..")) {
+       strcpy (buffer, N_("UP--DIR"));
+       return buffer;
+    }
+
 #ifdef HAVE_ST_RDEV
     if (S_ISBLK (fe->buf.st_mode) || S_ISCHR (fe->buf.st_mode))
         g_snprintf (buffer, sizeof (buffer), "%3d,%3d",
@@ -191,8 +197,13 @@ string_file_size_brief (file_entry *fe, 
 {
     static char buffer [BUF_TINY];
 
-    if (S_ISDIR (fe->buf.st_mode)){
-       strcpy (buffer, _(strcmp (fe->fname, "..") ? N_("SUB-DIR") : N_("UP--DIR")));
+    if (S_ISLNK (fe->buf.st_mode) && !fe->f.link_to_dir) {
+       strcpy (buffer, N_("SYMLINK"));
+       return buffer;
+    }
+
+    if ((S_ISDIR (fe->buf.st_mode) || fe->f.link_to_dir) && strcmp (fe->fname, "..")) {
+       strcpy (buffer, N_("SUB-DIR"));
        return buffer;
     }
 
===================================

-- 
Regards,
Pavel Roskin




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]