diff options
author | Marc Kleine-Budde <mkl@pengutronix.de> | 2010-03-21 17:34:08 +0100 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2010-04-01 10:23:13 +0200 |
commit | 34212c17f68d8db93fb89abe48800f074a79ec13 (patch) | |
tree | a4d170f99d8cf19498b68e94d9d1e5584d8bfc88 /scripts | |
parent | d31c864cf06264943d0dfc67a286d22e3ec70c1f (diff) | |
download | ptxdist-34212c17f68d8db93fb89abe48800f074a79ec13.tar.gz ptxdist-34212c17f68d8db93fb89abe48800f074a79ec13.tar.xz |
[libptxdist] provide ptxd_print_path
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/libptxdist.sh | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/scripts/libptxdist.sh b/scripts/libptxdist.sh index 5850f74a3..8e12f8f55 100644 --- a/scripts/libptxdist.sh +++ b/scripts/libptxdist.sh @@ -465,6 +465,29 @@ ptxd_abspath() { export -f ptxd_abspath +# +# prints a path but removes non interesting prefixes +# +ptxd_print_path() { + + if [ $# -ne 1 ]; then + ptxd_bailout "number of arguments must be 1" + fi + + local path out + for path in ${PTXDIST_PATH//:/ }; do + path="${path%/*}/" + out="${1/#${path}}" + if [ "${out}" != "${1}" ]; then + break; + fi + done + + echo "${out}" + +} +export -f ptxd_print_path + # # convert a human readable number with [kM] suffix or 0x prefix into a number |