Some patches for mc

Philipp Thomas pthomas at suse.de
Mon Mar 3 09:32:15 UTC 2003


Here are some patches for mc that SuSE has been applying for some time now
and which could possibly be included in the official mc:

mc-4.5.51-palmsupport.patch
    Allows to transfer various files to a Palm by using pilot-xfer
    and install-memo.

mc-4.6.0-asmsyntax.patch
    Syntax highlighting for Intel style assembly language. This was
    done by a former collegue of mine.

mc-4.6.0-tempfile.patch
    Security fix that uses the external mktemp to make the use of
    temporyry files more secure.

mc-4.6.0-x11browser.diff
    This, together with the x11_browser script gets rid of hardcoding
    the webbrowser but instead use whatever's available.

    
-- 
Philipp Thomas <pthomas at suse.de>
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nuremberg, Germany
-------------- next part --------------
--- mc-4.5.55/lib/mc.menu
+++ mc-4.5.55/lib/mc.menu
@@ -186,6 +186,33 @@
 	fi
 	echo "Please test the output file before deleting anything"
 
++ & t r & ! t t
+m       Install as MEMO on palm pilot
+	echo "Installing MEMO..."
+	install-memo %f
+
+=+ f \.pdb$ | f \.prc$ | f \.pqa$ | f \.PDB$ | f \.PRC$ | f \.PQA$ & t r & ! t t
+p       Install on palm pilot (programs or databases)
+        echo "Installing file on PALM"
+	pilot-xfer -i %f
+
++ t t
+M       Install tagged files as MEMOs on palm pilot
+        for i in %t
+        do
+	  echo "Installing MEMO: $i"
+        done
+	install-memo -t %t
+
++ t t
+P       Install tagged files on palm pilot (programs or databases)
+        echo "Installing files on PALM"
+        for i in %t
+        do
+	  echo "Installing file: $i"
+        done
+	pilot-xfer -i %t
+
 =+ f \.tar\.gz$ | f \.tar\.z$ | f \.tgz$ | f \.tpz$ | f \.tar\.Z$| f \.tar\.bz2$ & t r
 x       Extract the contents of a compressed tar file
 	unset EXT
-------------- next part --------------
--- syntax/Makefile.am
+++ syntax/Makefile.am
@@ -3,6 +3,7 @@
 syntax_DATA =			\
 	Syntax			\
 	ada95.syntax		\
+	asm.syntax		\
 	c.syntax		\
 	changelog.syntax	\
 	diff.syntax		\
--- syntax/Syntax
+++ syntax/Syntax
@@ -56,6 +56,9 @@
 file ..\*\\.(sl|SL)$ S-Lang\sProgram
 include slang.syntax
 
+file ..\*\\.(asm|ASM|as|AS)$ Assembly\sLanguage
+include asm.syntax
+
 file ..\*\\.tex$ LaTeX\s2.09\sDocument
 include latex.syntax
 
--- syntax/asm.syntax
+++ syntax/asm.syntax
@@ -0,0 +1,167 @@
+# Syntax highlighting for Intel style assembly language
+# Author: Christian Steinruecken, 2000
+
+context default yellow/24
+#
+#   keywords common to all (or most) assemblers
+#
+
+    keyword whole db white/25
+    keyword whole dw white/25
+    keyword whole dd white/25
+    
+    keyword whole org white/25
+    
+    keyword whole macro brightred/25
+    keyword whole endm brightred/25
+
+#
+#   keywords for 8051 assembler
+#
+
+    keyword whole add white/25
+    keyword whole addc white/25
+    keyword whole subb white/25
+    keyword whole inc white/25
+    keyword whole dec white/25
+    keyword whole mul white/25
+    keyword whole div white/25
+    keyword whole da white/25
+    
+    keyword whole anl white/25
+    keyword whole orl white/25
+    keyword whole xrl white/25
+    keyword whole clr white/25
+    keyword whole cpl white/25
+    keyword whole rr white/25
+    keyword whole rrc white/25
+    keyword whole rl white/25
+    keyword whole rlc white/25
+    keyword whole swap white/25
+
+    keyword whole mov white/25
+    keyword whole movc white/25
+    keyword whole movx white/25
+    keyword whole push white/25
+    keyword whole pop white/25
+    keyword whole xch white/25
+    keyword whole xchd white/25
+    
+    keyword whole setb white/25
+    
+    keyword whole call white/25
+    keyword whole acall white/25
+    keyword whole lcall white/25
+    keyword whole ret white/25
+    keyword whole reti white/25
+    keyword whole jmp white/25
+    keyword whole ajmp white/25
+    keyword whole ljmp white/25
+    keyword whole sjmp white/25
+    
+    keyword whole jz white/25
+    keyword whole jnz white/25
+    keyword whole jc white/25
+    keyword whole jnc white/25
+    keyword whole jb white/25
+    keyword whole jnb white/25
+    keyword whole jbc white/25
+    keyword whole cjne white/25
+    keyword whole djnz white/25
+    
+    keyword whole nop white/25
+    keyword whole asm white/25
+
+#
+#   some keywords for 8086 assembler
+#   (note: please only include mnemonics not yet defined further above)
+#
+    keyword whole and white/25
+    keyword whole or white/25
+    keyword whole xor white/25
+    keyword whole not white/25
+
+    keyword whole mod white/25
+    keyword whole imul white/25
+    keyword whole idiv white/25
+    
+    keyword whole ror white/25
+    keyword whole rol white/25
+    keyword whole shl white/25
+    keyword whole shr white/25
+    
+    keyword whole int white/25
+    keyword whole iret white/25
+    
+    keyword whole rep white/25
+    keyword whole sub white/25
+    
+    keyword whole jc white/25
+    keyword whole jcxz white/25
+    keyword whole je white/25
+    keyword whole jne white/25
+    keyword whole jg white/25
+    keyword whole jge white/25
+    keyword whole jng white/25
+    keyword whole jl white/25
+    keyword whole jle white/25
+    keyword whole jnl white/25
+    
+    keyword whole setc white/25
+    keyword whole test white/25
+    keyword whole bound white/25
+    keyword whole stosb white/25
+    keyword whole stosw white/25
+    keyword whole movsb white/25
+    keyword whole movsw white/25
+
+#
+#   special keywords for the ASL assembler by Alfred Arnold
+#
+
+    keyword whole if brightgreen/25
+    keyword whole ifexist brightgreen/25
+    keyword whole ifnexist brightgreen/25
+    keyword whole endif brightgreen/25
+    keyword whole else brightgreen/25
+    keyword whole ifdef brightgreen/25
+    keyword whole ifndef brightgreen/25
+    keyword whole elseif brightgreen/25
+    keyword whole ifdefined brightgreen/25
+    keyword whole include brightgreen/25
+    
+    keyword whole section brightgreen/25
+    keyword whole endsection brightgreen/25
+    keyword whole SECTION brightgreen/25
+    keyword whole ENDSECTION brightgreen/25
+    
+    keyword > green/5
+    keyword < green/5
+    keyword \+ yellow/5
+    keyword - green/5
+    keyword / green/5
+    keyword % green/5
+    keyword = green/5
+    keyword [ yellow/5
+    keyword ] yellow/5
+    keyword ( yellow/5
+    keyword ) yellow/5
+    keyword , yellow/5
+    keyword . yellow/5
+    keyword : yellow/5
+    keyword {$*} brightred/19
+    
+    keyword whole +\: brightred/22
+    keyword whole @+ brightmagenta/22
+    keyword whole \#* cyan/25
+    
+#
+#   this is for comments (and smiley-highlighting!)
+#
+context \; \n lightgray/24
+    keyword ;-) white/25
+    keyword :-) white/25
+    keyword :-( brightblue/25
+spellcheck
+
+
-------------- next part --------------
--- doc/mc.1.in
+++ doc/mc.1.in
@@ -1385,8 +1385,9 @@
 	od -c %f
 
 B	Edit a bug report and send it to root
-	vi /tmp/mail.$$
-	mail -s "Midnight Commander bug" root < /tmp/mail.$$
+	I=`mktemp /tmp/mailXXXXXX`; export I
+	vi $I
+	mail -s "Midnight Commander bug" root < $I
 
 M	Read mail
 	emacs -f rmail
--- lib/mc.menu
+++ lib/mc.menu
@@ -14,9 +14,10 @@
 	
 
 0       Edit a bug report and send it to root
-        ${EDITOR-vi} /tmp/mail.$$
-	test -r /tmp/mail.$$ && mail root < /tmp/mail.$$
-	rm -f /tmp/mail.$$
+        I=`mktemp /tmp/mail.XXXXXX`; export I
+        ${EDITOR-vi} $I
+        test -r $I && mail root < $I
+        rm -f $I
 
 =+ f \.1$ | f \.3$ | f \.4$ | f \.5$ | f \.6$ | f \.7$ | f \.8$ | f \.man$ & t r
 1       Display the file with roff -man
@@ -112,8 +113,8 @@
 	CHECK=`awk '{print $1 ; exit}' %f` 2>/dev/null
 	case $CHECK in
 	  Newsgroups:|Path:)
-	      cp %f /tmp/%f.$$ && sed '/^'"$CHECK"' /,/^$/d' /tmp/%f.$$ > %f
-              [ "$?" = "0" ] && rm /tmp/%f.$$
+	      I=`mktemp /tmp/news.XXXXXX`; export I;cp %f $I && sed '/^'"$CHECK"' /,/^$/d' $I > %f
+	      [ "$?" = "0" ] && rm $I
 	      echo %f: header removed
 		;;
 	  *)
@@ -126,7 +127,7 @@
 	set %t
 	while [ -n "$1" ]; do
 	  CHECK=`awk '{print $1 ; exit}' $1` 2>/dev/null
-	  WFILE=/tmp/${1}.$$
+	  WFILE=`mktemp /tmp/news.XXXXXX`; export WFILE;
 	  case $CHECK in
 	    Newsgroups:|Path:)
 	      cp $1 $WFILE && sed '/^'"$CHECK"' /,/^$/d' $WFILE > $1
-------------- next part --------------
--- lib/Makefile.am
+++ lib/Makefile.am
@@ -21,7 +21,7 @@
 SCRIPTS_IN = mc.csh.in mc.sh.in mc-wrapper.csh.in mc-wrapper.sh.in
 SCRIPTS_OUT = mc.csh mc.sh mc-wrapper.csh mc-wrapper.sh
 
-suppbin_SCRIPTS = $(SCRIPTS_OUT)
+suppbin_SCRIPTS = $(SCRIPTS_OUT) x11_browser
 ti_DATA = README.xterm linux.ti xterm.ad xterm.ti ansi.ti vt100.ti xterm.tcap
 
 pkgdata_DATA = $(LIBFILES_CONST) $(LIBFILES_ADD) $(LIBFILES_OUT)
@@ -35,6 +35,7 @@
 	$(ti_DATA) \
 	$(noinst_DATA) \
 	$(noinst_SCRIPTS) \
+	x11_browser \
 	mc.charsets
 
 mc.csh: $(srcdir)/mc.csh.in
--- lib/mc.ext.in
+++ lib/mc.ext.in
@@ -300,8 +300,8 @@
 
 # html
 regex/\.([Hh]tml?|HTML?)$
-	Open=if test -n "@X11_WWW@" && test -n "$DISPLAY"; then (@X11_WWW@ file://%d/%p &) >/dev/null 2>&1; else links %f 2>/dev/null || lynx -force_html %f; fi
-	View=%view{ascii} lynx -dump -force_html %f
+        Open=(@libdir@/mc/bin/x11_browser %f &)
+        View=%view{ascii} w3m -dump -T text/html %f;
 
 # StarOffice 5.2
 shell/.sdw
-------------- next part --------------
#!/bin/bash
#
# Call appropriate brower
#
# Copyright (c) 2001 Philipp Thomas <pthomas at suse.de>
#
# Borrowed heavily from url_handler.sh by Werner Fink <werner at suse.de>
#

url="$1"
method="${1%%:*}"

if test "$url" = "$method" ; then
    case "${url%%.*}" in
	www|web|w3) method=http		;;
	*)
	    case "${url}" in
		*/*.htm|*/*.html) method=http	;;
		*/*.htmls)	  method=https	;;
		/*) if test -r "${url}" ; then
				  method=file
		    fi				;;
		*)				;;
	    esac
					;;
    esac
    case "$method" in
	file)		url="${method}:$url"	;;
	*)		url="${method}://$url"	;;
    esac
fi

shift

case "$method" in
    file|http|https)
	http=
	type -p lynx >& /dev/null && http=lynx
	type -p links >& /dev/null && http=links
	type -p w3m >& /dev/null && http=w3m
	test -n "$DISPLAY" && type -p netscape >& /dev/null && http=netscape
	test -n "$DISPLAY" && type -p Netscape >& /dev/null && http=Netscape
	test -n "$DISPLAY" && type -p opera >& /dev/null && http=opera
	test -n "$DISPLAY" && type -p mozilla >& /dev/null && http=mozilla
	case "$http" in
	    [nN]etscape|opera|mozilla) $http -remote "openURL($url)" || $http "$url" ;;
	    lynx|w3m|links)	 exec $http "$url" ;;
	    *)
		echo "No HTTP browser found."
		read -p "Press return to continue: "
		exit 0  # No error return
		;;
	esac
	;;
    *)
	echo "URL type \"$method\" not known"
	read -p "Press return to continue: "
	exit 0  # No error return
	;;
esac


More information about the mc-devel mailing list