From 0b3180b4f53d8f101974d5f039a21f0529c15601 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Thu, 3 Jan 2013 12:40:55 +0100 Subject: test 1222: 8 chars object name generation && test 1221: adjustments --- lib/objnames.inc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'lib/objnames.inc') 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 -- cgit v1.2.3