summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--scripts/patchfns.in24
1 files changed, 14 insertions, 10 deletions
diff --git a/scripts/patchfns.in b/scripts/patchfns.in
index d9862fb..1148c97 100644
--- a/scripts/patchfns.in
+++ b/scripts/patchfns.in
@@ -41,16 +41,20 @@ quote_re()
echo "$1" | sed -e 's:\([][?{(|)}^$/.+*\\]\):\\\1:g'
}
-#basename()
-#{
-# local path=${1%/}
-# echo "${path/*\/}"
-#}
-
-#dirname()
-#{
-# local path=${1%/}
-#}
+basename()
+{
+ local path="${1%%/}"
+ echo "${path##*/}"
+}
+
+dirname()
+{
+ local path="${1%%/}"
+ local basename="${path##*/}"
+ path="${path:0:${#path}-${#basename}}"
+ [ x"$path" != x"/" ] && path="${path%/}"
+ echo "${path:-.}"
+}
patch_file_name()
{