Skip to content
Snippets Groups Projects
Commit 6675acf1 authored by Christian Engwer's avatar Christian Engwer
Browse files

* canonicalpath should be defined in the calling scripts, not in

  dunemodules.inc
* expand '~' before canonicalpath expansion

[[Imported from SVN: r5314]]
parent 6e5fe5fc
No related branches found
No related tags found
No related merge requests found
......@@ -21,7 +21,7 @@ canonicalname(){
echo Usage: canonicalname path >&2
return 1
fi
file="$1"
file="`eval echo $1`" # expand ~
if test ! -e "$file"; then
echo $file: file not found >&2
return 1
......@@ -58,7 +58,7 @@ canonicalpath(){
echo Usage: canonicalpath path >&2
return 1
fi
dirname $(canonicalname "$1")
dirname `canonicalname "$1"`
}
checkdebug () {
......@@ -444,7 +444,7 @@ while test $# -gt 0; do
echo >&2
exit 1;
fi
DUNE_OPTS_FILE=$(canonicalpath $arg)/$(basename $arg)
DUNE_OPTS_FILE=`canonicalname $arg`
if ! test -r "$DUNE_OPTS_FILE"; then
usage
echo "ERROR: could not read opts file \"$DUNE_OPTS_FILE\"" >&2
......@@ -455,7 +455,7 @@ while test $# -gt 0; do
--*-opts=*)
optcmd=`expr "x$option=" : 'x--\([^-]*\)-opts=.*'`
if is_command $optcmd; then
COMMAND=$(echo $optcmd | tr '[:lower:]' '[:upper:]')
COMMAND=`echo $optcmd | tr '[:lower:]' '[:upper:]'`
export ${COMMAND}_FLAGS="$arg"
else
usage
......
......@@ -20,53 +20,6 @@ if test -z $GREP; then
GREP=grep
fi
###############################################
canonicalname(){
if test $# -ne 1; then
echo Usage: canonicalname path >&2
return 1
fi
file="$1"
if test ! -e "$file"; then
echo $file: file not found >&2
return 1
fi
# if this is a symlink, then follow the symlink
if test -L "$file"; then
fdir="`dirname \"$file\"`"
flink="`readlink \"$file\"`"
if test -e "$flink"; then
# these are absolute links, or links in the CWD
canonicalname "$flink"
else
canonicalname "$fdir/$flink"
fi
else
# if this is a file, then remember the filename and
# canonicalize the directory name
if test -f "$file"; then
fdir="`dirname \"$file\"`"
fname="`basename \"$file\"`"
fdir="`canonicalname \"$fdir\"`"
echo "$fdir/$fname"
fi
# if this is a directory, then create an absolute
# directory name and we are done
if test -d "$file"; then
(cd "$file"; pwd)
fi
fi
}
canonicalpath(){
if test $# -ne 1; then
echo Usage: canonicalpath path >&2
return 1
fi
dirname $(canonicalname "$1")
}
#
# read paramters from a $CONTROL file
#
......
......@@ -14,7 +14,7 @@ canonicalname(){
echo Usage: canonicalname path >&2
return 1
fi
file="$1"
file="`eval echo $1`" # expand ~
if test ! -e "$file"; then
echo $file: file not found >&2
return 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment