File mc-extd-xdg.patch of Package mc

diff -ru1 misc/ext.d.orig/archive.sh misc/ext.d/archive.sh
--- misc/ext.d.orig/archive.sh	2012-12-27 12:13:20.000000000 +0400
+++ misc/ext.d/archive.sh	2013-03-10 09:01:31.154705008 +0400
@@ -173,3 +173,3 @@
 open)
-    ("${MC_XDG_OPEN}" "${MC_EXT_FILENAME}" >/dev/null 2>&1) || \
+    test -n "$DISPLAY" && ("${MC_XDG_OPEN}" "${MC_EXT_FILENAME}" >/dev/null 2>&1) || \
         do_open_action "${filetype}" "${pager}"
diff -ru1 misc/ext.d.orig/doc.sh.in misc/ext.d/doc.sh.in
--- misc/ext.d.orig/doc.sh.in	2012-12-27 12:13:20.000000000 +0400
+++ misc/ext.d/doc.sh.in	2013-03-10 09:01:48.230710602 +0400
@@ -190,3 +190,3 @@
 open)
-    ("${MC_XDG_OPEN}" "${MC_EXT_FILENAME}" >/dev/null 2>&1) || \
+    test -n "$DISPLAY" && ("${MC_XDG_OPEN}" "${MC_EXT_FILENAME}" >/dev/null 2>&1) || \
         do_open_action "${filetype}"
diff -ru1 misc/ext.d.orig/image.sh misc/ext.d/image.sh
--- misc/ext.d.orig/image.sh	2012-12-27 12:13:20.000000000 +0400
+++ misc/ext.d/image.sh	2013-03-10 09:02:00.086714848 +0400
@@ -57,3 +57,3 @@
 open)
-    ("${MC_XDG_OPEN}" "${MC_EXT_FILENAME}" >/dev/null 2>&1) || \
+    test -n "$DISPLAY" && ("${MC_XDG_OPEN}" "${MC_EXT_FILENAME}" >/dev/null 2>&1) || \
         do_open_action "${filetype}"
diff -ru1 misc/ext.d.orig/misc.sh.in misc/ext.d/misc.sh.in
--- misc/ext.d.orig/misc.sh.in	2012-12-27 12:13:20.000000000 +0400
+++ misc/ext.d/misc.sh.in	2013-03-10 09:02:13.470718625 +0400
@@ -96,3 +96,3 @@
 open)
-    ("${MC_XDG_OPEN}" "${MC_EXT_FILENAME}" >/dev/null 2>&1) || \
+    test -n "$DISPLAY" && ("${MC_XDG_OPEN}" "${MC_EXT_FILENAME}" >/dev/null 2>&1) || \
         do_open_action "${filetype}"
diff -ru1 misc/ext.d.orig/package.sh misc/ext.d/package.sh
--- misc/ext.d.orig/package.sh	2012-12-27 12:13:20.000000000 +0400
+++ misc/ext.d/package.sh	2013-03-10 09:02:23.630723087 +0400
@@ -53,3 +53,3 @@
 open)
-    ("${MC_XDG_OPEN}" "${MC_EXT_FILENAME}" >/dev/null 2>&1) || \
+    test -n "$DISPLAY" && ("${MC_XDG_OPEN}" "${MC_EXT_FILENAME}" >/dev/null 2>&1) || \
         do_open_action "${filetype}"
diff -ru1 misc/ext.d.orig/sound.sh misc/ext.d/sound.sh
--- misc/ext.d.orig/sound.sh	2012-12-27 12:13:20.000000000 +0400
+++ misc/ext.d/sound.sh	2013-03-10 09:02:31.222725342 +0400
@@ -105,3 +105,3 @@
 open)
-    ("${MC_XDG_OPEN}" "${MC_EXT_FILENAME}" >/dev/null 2>&1) || \
+    test -n "$DISPLAY" && ("${MC_XDG_OPEN}" "${MC_EXT_FILENAME}" >/dev/null 2>&1) || \
         do_open_action "${filetype}"
diff -ru1 misc/ext.d.orig/text.sh.in misc/ext.d/text.sh.in
--- misc/ext.d.orig/text.sh.in	2012-12-27 12:13:20.000000000 +0400
+++ misc/ext.d/text.sh.in	2013-03-10 09:02:39.018727707 +0400
@@ -143,3 +143,3 @@
 open)
-    ("${MC_XDG_OPEN}" "${MC_EXT_FILENAME}" >/dev/null 2>&1) || \
+    test -n "$DISPLAY" && ("${MC_XDG_OPEN}" "${MC_EXT_FILENAME}" >/dev/null 2>&1) || \
         do_open_action "${filetype}" "${pager}"
diff -ru1 misc/ext.d.orig/video.sh misc/ext.d/video.sh
--- misc/ext.d.orig/video.sh	2012-12-27 12:13:20.000000000 +0400
+++ misc/ext.d/video.sh	2013-03-10 09:02:48.414731630 +0400
@@ -62,3 +62,3 @@
 open)
-    ("${MC_XDG_OPEN}" "${MC_EXT_FILENAME}" >/dev/null 2>&1) || \
+    test -n "$DISPLAY" && ("${MC_XDG_OPEN}" "${MC_EXT_FILENAME}" >/dev/null 2>&1) || \
         do_open_action "${filetype}"
diff -ru1 misc/ext.d.orig/web.sh.in misc/ext.d/web.sh.in
--- misc/ext.d.orig/web.sh.in	2012-12-27 12:13:20.000000000 +0400
+++ misc/ext.d/web.sh.in	2013-03-10 09:02:56.670734093 +0400
@@ -48,3 +48,3 @@
 open)
-    ("${MC_XDG_OPEN}" "${MC_EXT_FILENAME}" >/dev/null 2>&1) || \
+    test -n "$DISPLAY" && ("${MC_XDG_OPEN}" "${MC_EXT_FILENAME}" >/dev/null 2>&1) || \
         do_open_action "${filetype}"