Tidied up sed code for extracting the executable name

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/tools/make/trunk@12220 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Nicola Pero 2002-01-26 16:35:52 +00:00
parent 7c7c420fbe
commit 801e8e91f9

View file

@ -126,17 +126,18 @@ app=`basename $app`
appname=
if [ -f "$full_appname/Resources/Info-gnustep.plist" ]; then
# -n disable auto-print (for portability reasons)
# /^[ ]*NSExecutable[ ]*=/ matches every line beginning with
# /^ *NSExecutable *=/ matches every line beginning with
# zero or more spaces, followed by 'NSExecutable', followed by zero or
# more spaces, followed by '='
# to this line we apply the following commands:
# s/^[ ]*NSExecutable[ ]*=[ ]*"\?\([^ "]*\)"\?[ ]*;.*/\1/p;
# which replaces 'NSExecutable = "Gorm";' with 'Gorm', then, because
# s/"//g; which deletes all " in the line.
# s/^ *NSExecutable *= *\([^ ;]*\) *;.*/\1/p;
# which replaces 'NSExecutable = Gorm; ' with 'Gorm', then, because
# of the 'p' at the end, prints out the result
# q; which quits sed since we know there must be only a single line
# to replace.
appname=`sed -n -e '/^[ ]*NSExecutable[ ]*=/ \
{s/^[ ]*NSExecutable[ ]*=[ ]*"\?\([^ "]*\)"\?[ ]*;.*/\1/p; q;}' \
appname=`sed -n -e '/^ *NSExecutable *=/ \
{s/"//g; s/^ *NSExecutable *= *\([^ ;]*\) *;.*/\1/p; q;}' \
"$full_appname/Resources/Info-gnustep.plist"`
fi
if [ -z "$appname" ]; then