Module Name:    src
Committed By:   martin
Date:           Sun Jul 24 11:51:22 UTC 2022

Modified Files:
        src/external/mit/ctwm/libexec [netbsd-9]: ctwm_app_menu

Log Message:
Pull up following revision(s) (requested by nia in ticket #1481):

        external/mit/ctwm/libexec/ctwm_app_menu: revision 1.5 (via patch)

ctwm_app_menu: Work around "emacs being installed results in the
generated ctwmrc containing invalid syntax" problem. Emacs installs
a desktop file called "emacsclient" that contains "doublequotes"
in its exec string. Pending a better solution for dumping escaped
shell lines into the config file, hide or sanitize desktop entires
that might mess up the internal ctwmrc quoting rules.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/external/mit/ctwm/libexec/ctwm_app_menu

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/mit/ctwm/libexec/ctwm_app_menu
diff -u src/external/mit/ctwm/libexec/ctwm_app_menu:1.1.2.2 src/external/mit/ctwm/libexec/ctwm_app_menu:1.1.2.3
--- src/external/mit/ctwm/libexec/ctwm_app_menu:1.1.2.2	Thu Oct  8 16:04:07 2020
+++ src/external/mit/ctwm/libexec/ctwm_app_menu	Sun Jul 24 11:51:22 2022
@@ -1,12 +1,13 @@
 #!/bin/sh
-#	$NetBSD: ctwm_app_menu,v 1.1.2.2 2020/10/08 16:04:07 martin Exp $
+#	$NetBSD: ctwm_app_menu,v 1.1.2.3 2022/07/24 11:51:22 martin Exp $
 OFS=$IFS
 IFS='
 '
 printf 'menu "appmenu"\n'
 printf '{\n'
 printf '\t"Applications"\tf.title\n'
-for app in $(find /usr/pkg/share/applications -name '*.desktop');
+LOCALBASE=$(pkg_info -Q LOCALBASE pkg_install 2>/dev/null || echo /usr/pkg)
+for app in $(find $LOCALBASE/share/applications -name '*.desktop')
 do
 	name=""
 	exec=""
@@ -18,13 +19,18 @@ do
 			Name=*)
 				if ! [ -n "$name" ];
 				then
-					name=$(printf '%s' "$line" | cut -c6- | tr -d '\r')
+					name=$(printf '%s' "$line" | cut -c6- | tr -d '\r"')
 				fi
 			;;
 			Exec=*)
 				if ! [ -n "$exec" ];
 				then
 					exec=$(printf '%s' "$line" | cut -c6- | sed -e 's/ %.*//g' | tr -d '\r')
+					if printf '%s' "$exec" | grep -q '"'; then
+						# results in malformed config file, better way
+						# to handle this...?
+						nodisplay="true"
+					fi
 				fi
 			;;
 			Terminal=true)

Reply via email to