Hi,

this patch changes selection of files and dirs so that
symlinked dirs are not selected as files, but only
as directories (i.e. with "/" appended to file mask in selection dialog).

'Select', 'Unselect' and 'Reverse select' are consistent.

I think this i correct behaviour.

David
2003-06-11  David Sterba  <[EMAIL PROTECTED]>

        * cmd.c (select_cmd, unselect_cmd, reverse_selection_cmd):
        Handle symlinked directories as directories in file selections.

diff -X .diffignore -urNp mc/src/cmd.c mc-1ft/src/cmd.c
--- mc-sel/src/cmd.c	Tue Feb 18 06:25:45 2003
+++ mc/src/cmd.c	Wed Jun 11 12:46:03 2003
@@ -502,7 +502,8 @@ void reverse_selection_cmd (void)
 
     for (i = 0; i < cpanel->count; i++){
 	file = &cpanel->dir.list [i];
-	if (S_ISDIR (file->buf.st_mode))
+	if (S_ISDIR (file->buf.st_mode) ||
+	    link_isdir ( &(cpanel->dir.list [i]) ))
 	    continue;
 	do_file_mark (cpanel, i, !file->f.marked);
     }
@@ -535,7 +536,8 @@ void select_cmd (void)
     for (i = 0; i < cpanel->count; i++){
         if (!strcmp (cpanel->dir.list [i].fname, ".."))
             continue;
-	if (S_ISDIR (cpanel->dir.list [i].buf.st_mode)){
+	if (S_ISDIR (cpanel->dir.list [i].buf.st_mode) ||
+	    link_isdir ( &(cpanel->dir.list [i]) )) {
 	    if (!dirflag)
                 continue;
         } else {
@@ -579,9 +581,10 @@ void unselect_cmd (void)
         reg_exp_t [strlen(reg_exp_t) - 1] = 0;
     }
     for (i = 0; i < cpanel->count; i++){
-        if (!strcmp (cpanel->dir.list [i].fname, "..")) 
+        if (!strcmp (cpanel->dir.list [i].fname, ".."))
             continue;
-	if (S_ISDIR (cpanel->dir.list [i].buf.st_mode)){
+	if (S_ISDIR (cpanel->dir.list [i].buf.st_mode) ||
+	    link_isdir ( &(cpanel->dir.list [i]) )) {
 	    if (!dirflag)
 	        continue;
         } else {

Reply via email to