Re: uglydir patch



Hi,

Spacing in the previous version was ugly, and also the code style for
function calls inconsistent. Cleaned up version attached.

Can we come to an agreement on coding style? People use both
function (params);
and
function(params);
sometimes both styles in one patch. This is ugly.

Leonard.

-- 
mount -t life -o ro /dev/dna /genetic/research

--- mc-4.6.1-20041020/src/screen.c.uglydir	2004-10-22 10:35:22.790664184 +0200
+++ mc-4.6.1-20041020/src/screen.c	2004-10-22 10:37:30.740212896 +0200
@@ -754,7 +754,15 @@ show_dir (WPanel *panel)
     tmp[panel->widget.cols] = '\0';
 
     trim (strip_home_and_password (panel->cwd), tmp,
-	  min (max (panel->widget.cols - 7, 0), panel->widget.cols) );
+	    min(max(panel->widget.cols - 7, 0), panel->widget.cols) );
+
+    if (tmp && *tmp) {
+	char *s = tmp;
+	do {
+	    if (!is_printable (*s))
+		*s = '?';
+	} while (*++s);
+    }
 
     addstr (tmp);
     g_free (tmp);
--- mc-4.6.1-20041020/src/subshell.c.uglydir	2004-09-25 15:46:23.000000000 +0200
+++ mc-4.6.1-20041020/src/subshell.c	2004-10-22 10:35:22.863653088 +0200
@@ -951,6 +951,22 @@ feed_subshell (int how, int fail_on_erro
 
 	    subshell_cwd[bytes - 1] = 0;	/* Squash the final '\n' */
 
+	    if (*subshell_cwd && current_panel && current_panel->cwd && strcmp(current_panel->cwd, subshell_cwd) &&
+			strchr(current_panel->cwd, '\n'))
+	    {
+		/* Expected CWD is diffrent and it contains line break. 
+		 * We need to read rest of CWD, because previous read() 
+		 * returns first line only.
+		 */
+		int rbytes;
+
+		subshell_cwd[bytes-1] = '\n';  
+		rbytes = read(subshell_pipe[READ], (subshell_cwd+bytes), 
+			MC_MAXPATHLEN-bytes);
+		if (rbytes)
+		    subshell_cwd[bytes+rbytes-1] = 0;  /* Squash the final '\n' */
+		}
+
 	    synchronize ();
 
 	    subshell_ready = TRUE;


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