aboutsummaryrefslogtreecommitdiff
path: root/lib/objnames.inc
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2013-01-03 12:40:55 +0100
committerYang Tse <yangsita@gmail.com>2013-01-03 19:24:00 +0100
commit0b3180b4f53d8f101974d5f039a21f0529c15601 (patch)
tree1d5de8aceadba807c742e2d3da038c59c91c3c7f /lib/objnames.inc
parent8f13e3ddb98563db8e3965c894b2ad948e30b9e3 (diff)
test 1222: 8 chars object name generation && test 1221: adjustments
Diffstat (limited to 'lib/objnames.inc')
-rw-r--r--lib/objnames.inc22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/objnames.inc b/lib/objnames.inc
index 2ec8915b3..8778492b4 100644
--- a/lib/objnames.inc
+++ b/lib/objnames.inc
@@ -82,4 +82,26 @@ curl_10char_object_name() {
-e 's:^\(..........\).*:\1:'
}
+#
+# curl_8char_object_name
+#
+# Same as curl_10char_object_name() description and details above, except
+# that object name is limited to 8 charcters maximum.
+#
+
+curl_8char_object_name() {
+ echo "${1}" | \
+ sed -e 's:.*/::' \
+ -e 's:[.].*::' \
+ -e 'y:abcdefghijklmnopqrstuvwxyz:ABCDEFGHIJKLMNOPQRSTUVWXYZ:' \
+ -e 's:[^ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_]:_:g' \
+ -e 's:__*:_:g' \
+ -e 's:\([^_]\)[^_]*_\(.*\):\1\2:' \
+ -e 's:\([^_]\)\([^_]\)[^_]*_\(.*\):\1\2\3:' \
+ -e 's:\([^_]\)\([^_]\)\([^_]\)[^_]*_\(.*\):\1\2\3\4:' \
+ -e 's:\([^_]\)\([^_]\)\([^_]\)\([^_]\)[^_]*_\(.*\):\1\2\3\4\5:' \
+ -e 's:\([^_]\)\([^_]\)\([^_]\)\([^_]\)\([^_]\)[^_]*_\(.*\):\1\2\3\4\5\6:' \
+ -e 's:^\(........\).*:\1:'
+}
+
# end of objectname.inc