Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-common
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lasse Hinrichsen-Bischoff
dune-common
Commits
3e61921f
Commit
3e61921f
authored
16 years ago
by
Christian Engwer
Browse files
Options
Downloads
Patches
Plain Diff
better implementation of canonicalname
[[Imported from SVN: r5179]]
parent
cd207d73
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bin/dunecontrol
+35
-18
35 additions, 18 deletions
bin/dunecontrol
bin/duneproject
+35
-18
35 additions, 18 deletions
bin/duneproject
with
70 additions
and
36 deletions
bin/dunecontrol
+
35
−
18
View file @
3e61921f
...
...
@@ -17,23 +17,40 @@ fi
###
canonicalname
(){
if
test
$#
-ne
1
;
then
echo
Usage: canonicalname path
>
&2
return
1
fi
name
=
"
$1
"
while
test
-L
"
$name
"
;
do
if
!
test
-e
"
$name
"
;
then
echo
$name
: file not found
>
&2
return
1
fi
if
newname
=
"
`
readlink
$name
`
"
;
then
name
=
"
$newname
"
else
echo
"
$(
dirname
$name
)
/
$(
basename
$name
)
"
fi
done
echo
$name
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
(){
...
...
@@ -41,7 +58,7 @@ canonicalpath(){
echo
Usage: canonicalpath path
>
&2
return
1
fi
(
cd
$(
dirname
$(
canonicalname
$1
))
&&
pwd
)
dirname
$(
canonicalname
"
$1
"
)
}
if
test
"x
$1
"
=
"x--debug"
;
then
...
...
This diff is collapsed.
Click to expand it.
bin/duneproject
+
35
−
18
View file @
3e61921f
...
...
@@ -10,23 +10,40 @@
set
-e
canonicalname
(){
if
test
$#
-ne
1
;
then
echo
Usage: canonicalname path
>
&2
return
1
fi
name
=
"
$1
"
while
test
-L
"
$name
"
;
do
if
!
test
-e
"
$name
"
;
then
echo
$name
: file not found
>
&2
return
1
fi
if
newname
=
"
`
readlink
$name
`
"
;
then
name
=
"
$newname
"
else
echo
"
$(
dirname
$name
)
/
$(
basename
$name
)
"
fi
done
echo
$name
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
(){
...
...
@@ -34,7 +51,7 @@ canonicalpath(){
echo
Usage: canonicalpath path
>
&2
return
1
fi
(
cd
$(
dirname
$(
canonicalname
$1
))
&&
pwd
)
dirname
$(
canonicalname
"
$1
"
)
}
pkg_config_dependencies
(){
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment