Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/mit/ctwm/libexec ctwm_app_menu: Various shell scrip...



details:   https://anonhg.NetBSD.org/src/rev/91f2bb46fee3
branches:  trunk
changeset: 368646:91f2bb46fee3
user:      nia <nia%NetBSD.org@localhost>
date:      Sun Jul 24 07:38:15 2022 +0000

description:
ctwm_app_menu: Various shell script optimization suggestions by kre@.

diffstat:

 external/mit/ctwm/libexec/ctwm_app_menu |  18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diffs (46 lines):

diff -r 73b91e23c498 -r 91f2bb46fee3 external/mit/ctwm/libexec/ctwm_app_menu
--- a/external/mit/ctwm/libexec/ctwm_app_menu   Sat Jul 23 19:15:28 2022 +0000
+++ b/external/mit/ctwm/libexec/ctwm_app_menu   Sun Jul 24 07:38:15 2022 +0000
@@ -1,5 +1,5 @@
 #!/bin/sh
-#      $NetBSD: ctwm_app_menu,v 1.5 2022/07/22 17:06:46 nia Exp $
+#      $NetBSD: ctwm_app_menu,v 1.6 2022/07/24 07:38:15 nia Exp $
 #
 # Copyright (c) 2020-2022 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -96,27 +96,27 @@
                do
                        case $line in
                                Name=*)
-                                       if ! [ -n "$name" ];
+                                       if [ -z "$name" ];
                                        then
-                                               name=$(printf '%s' "$line" | cut -c6- | tr -d '\r' | tr -d '"')
+                                               name=$(printf '%s' "${line#Name=}" | tr -d '\r"')
                                        fi
                                ;;
                                Exec=*)
-                                       if ! [ -n "$exec" ];
+                                       if [ -z "$exec" ];
                                        then
-                                               exec=$(printf '%s' "$line" | cut -c6- | sed -e 's/ %.*//g' | tr -d '\r')
+                                               exec=$(printf '%s' "${line#Exec=}" | sed -e 's/ %.*//g' | tr -d '\r')
+                                               # results in malformed config file, better way
+                                               # to handle this...?
                                                if printf '%s' "$exec" | grep -q '"'; then
-                                                       # results in malformed config file, better way
-                                                       # to handle this...?
                                                        nodisplay="true"
                                                fi
                                        fi
                                ;;
                                Terminal=true)
-                                       terminal="true"
+                                       terminal=true
                                ;;
                                OnlyShowIn=*|NoDisplay=true)
-                                       nodisplay="true"
+                                       nodisplay=true
                                ;;
                        esac
                done < "$app"



Home | Main Index | Thread Index | Old Index