Differentiate Open



Hi!

In the current mc.ext you could often find something like this:
  Open=if [ "$DISPLAY" = "" ]; then dvisvga %f; else (xdvi %f &); fi

It's long and hungus. Thus I propose to split Open into two parts:
  Open=dvisvga %f
  XOpen=xdvi %f

Advantages:
- shorter and cleaner notation
- backward compatible
- faster execution
- patch is small

Regards
Michal


Index: src/ChangeLog
===================================================================
RCS file: /cvs/gnome/mc/src/ChangeLog,v
retrieving revision 1.751
diff -u -w -r1.751 ChangeLog
--- src/ChangeLog	10 Jul 2002 23:27:36 -0000	1.751
+++ src/ChangeLog	11 Jul 2002 07:59:02 -0000
@@ -1,3 +1,8 @@
+2002-04-13  Michal Svec  <rebel atrey karlin mff cuni cz>
+
+	* screen.c: differentiate Open if X are running (XOpen)
+	* ext.c: likewise
+
 2002-07-10  Pavel Roskin  <proski gnu org>

 	* utilunix.c: Cast argument for GUINT_TO_POINTER to int to fix
Index: src/ext.c
===================================================================
RCS file: /cvs/gnome/mc/src/ext.c,v
retrieving revision 1.37
diff -u -w -r1.37 ext.c
--- src/ext.c	21 Feb 2002 14:37:51 -0000	1.37
+++ src/ext.c	11 Jul 2002 07:59:02 -0000
@@ -604,6 +604,7 @@
 		    }
     	            if (action == NULL) {
     	                if (strcmp (p, "Open") &&
+    	                    strcmp (p, "XOpen") &&
     	                    strcmp (p, "View") &&
     	                    strcmp (p, "Edit") &&
     	                    strcmp (p, "Drop") &&
Index: src/screen.c
===================================================================
RCS file: /cvs/gnome/mc/src/screen.c,v
retrieving revision 1.110
diff -u -w -r1.110 screen.c
--- src/screen.c	27 Jun 2002 21:25:03 -0000	1.110
+++ src/screen.c	11 Jul 2002 07:59:03 -0000
@@ -1968,7 +1968,7 @@
 do_enter_on_file_entry (file_entry *fe)
 {
     char *full_name;
-    char *p;
+    char *p, *d;

     /* Directory or link to directory - change directory */
     if (S_ISDIR (fe->buf.st_mode) || link_isdir (fe)) {
@@ -1977,7 +1977,15 @@
     }

     /* Try associated command */
+    d = getenv("DISPLAY");
+    if (d && *d) {
+	p = regex_command (fe->fname, "XOpen", NULL, 0);
+	if (!p || strcmp (p, "Success"))
     p = regex_command (fe->fname, "Open", NULL, 0);
+    }
+    else
+	p = regex_command (fe->fname, "Open", NULL, 0);
+
     if (p && (strcmp (p, "Success") == 0))
 	return 1;





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