diff src/text/textui.c @ 499:39e9945288ea

2004-7-13 Brian Masney <masneyb@gftp.org> * lib/gftp.h lib/local.c lib/misc.c lib/protocols.c lib/rfc2068.c lib/rfc959.c lib/sshv2.c src/gtk/chmod_dialog.c src/gtk/delete_dialog.c src/gtk/dnd.c src/gtk/gftp-gtk.c src/gtk/gtkui_transfer.c src/gtk/menu-items.c src/gtk/misc-gtk.c src/gtk/view_dialog.c src/text/textui.c src/uicommon/gftpui.c src/uicommon/gftpuicallbacks.c - represent the file attributes as a mode_t variable instead of a character string
author masneyb
date Tue, 13 Jul 2004 20:17:42 +0000
parents 632036c6e4a4
children e55d8b35d809
line wrap: on
line diff
--- a/src/text/textui.c	Tue Jul 13 02:44:35 2004 +0000
+++ b/src/text/textui.c	Tue Jul 13 20:17:42 2004 +0000
@@ -24,11 +24,13 @@
 gftpui_lookup_file_colors (gftp_file * fle, char **start_color,
                            char ** end_color)
 {
-  if (*fle->attribs == 'd')
+  if (S_ISDIR (fle->st_mode))
     *start_color = GFTPUI_COMMON_COLOR_BLUE;
-  else if (*fle->attribs == 'l')
+  else if (S_ISLNK (fle->st_mode))
     *start_color = GFTPUI_COMMON_COLOR_WHITE;
-  else if (strchr (fle->attribs, 'x') != NULL)
+  else if ((fle->st_mode & S_IXUSR) ||
+           (fle->st_mode & S_IXGRP) ||
+           (fle->st_mode & S_IXOTH))
     *start_color = GFTPUI_COMMON_COLOR_GREEN;
   else
     *start_color = GFTPUI_COMMON_COLOR_DEFAULT;
@@ -103,7 +105,7 @@
   for (templist = tdata->files; templist != NULL; templist = templist->next)
     {
       tempfle = templist->data;
-      if (tempfle->startsize == 0 || tempfle->isdir)
+      if (tempfle->startsize == 0 || S_ISDIR (tempfle->st_mode))
         continue;
 
       while (action == -1)