comparison 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
comparison
equal deleted inserted replaced
498:76c4e4cd108e 499:39e9945288ea
22 22
23 void 23 void
24 gftpui_lookup_file_colors (gftp_file * fle, char **start_color, 24 gftpui_lookup_file_colors (gftp_file * fle, char **start_color,
25 char ** end_color) 25 char ** end_color)
26 { 26 {
27 if (*fle->attribs == 'd') 27 if (S_ISDIR (fle->st_mode))
28 *start_color = GFTPUI_COMMON_COLOR_BLUE; 28 *start_color = GFTPUI_COMMON_COLOR_BLUE;
29 else if (*fle->attribs == 'l') 29 else if (S_ISLNK (fle->st_mode))
30 *start_color = GFTPUI_COMMON_COLOR_WHITE; 30 *start_color = GFTPUI_COMMON_COLOR_WHITE;
31 else if (strchr (fle->attribs, 'x') != NULL) 31 else if ((fle->st_mode & S_IXUSR) ||
32 (fle->st_mode & S_IXGRP) ||
33 (fle->st_mode & S_IXOTH))
32 *start_color = GFTPUI_COMMON_COLOR_GREEN; 34 *start_color = GFTPUI_COMMON_COLOR_GREEN;
33 else 35 else
34 *start_color = GFTPUI_COMMON_COLOR_DEFAULT; 36 *start_color = GFTPUI_COMMON_COLOR_DEFAULT;
35 37
36 *end_color = GFTPUI_COMMON_COLOR_DEFAULT; 38 *end_color = GFTPUI_COMMON_COLOR_DEFAULT;
101 action = newaction = -1; 103 action = newaction = -1;
102 104
103 for (templist = tdata->files; templist != NULL; templist = templist->next) 105 for (templist = tdata->files; templist != NULL; templist = templist->next)
104 { 106 {
105 tempfle = templist->data; 107 tempfle = templist->data;
106 if (tempfle->startsize == 0 || tempfle->isdir) 108 if (tempfle->startsize == 0 || S_ISDIR (tempfle->st_mode))
107 continue; 109 continue;
108 110
109 while (action == -1) 111 while (action == -1)
110 { 112 {
111 insert_commas (tempfle->size, srcsize, sizeof (srcsize)); 113 insert_commas (tempfle->size, srcsize, sizeof (srcsize));