Allow repeatable file name length reduction on file names with underscore or
dash characters. This is done in order to better support libcurl's existing
source file names and allow OS/400 package to build out of the box again.
basename "${1}" |
tr 'a-z-' 'A-Z_' |
sed -e 's/\..*//' \
+ -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/'
}