diff options
author | kate.ward <kate.ward@forestent.com> | 2009-04-01 03:30:22 +0000 |
---|---|---|
committer | kate.ward <kate.ward@forestent.com> | 2009-04-01 03:30:22 +0000 |
commit | bda3917a66a36c47a1ec9d2dcbd0705176e394fc (patch) | |
tree | f484bfd5b1cfdf08877c529f6c25dcb43a451dec | |
parent | 812aeaed18af8de804b7cf4c8b7edcf950345250 (diff) | |
download | shflags-bda3917a66a36c47a1ec9d2dcbd0705176e394fc.tar.gz |
removed extra 'x' chars in help output under solaris
-rw-r--r-- | source/1.0/doc/CHANGES-1.0.txt | 3 | ||||
-rw-r--r-- | source/1.0/src/shflags | 20 |
2 files changed, 12 insertions, 11 deletions
diff --git a/source/1.0/doc/CHANGES-1.0.txt b/source/1.0/doc/CHANGES-1.0.txt index 4bbcbd6..afeb08c 100644 --- a/source/1.0/doc/CHANGES-1.0.txt +++ b/source/1.0/doc/CHANGES-1.0.txt @@ -26,6 +26,9 @@ Took out the setting and restoration of the '-u' shell flag to treat unset variables as an error. No point in having it in this library as it is verified in the unit tests, and provides basically no benefit. +Fixed bug under Solaris where the generated help was adding extra 'x' +characters. + Changes with 1.0.2 ------------------ diff --git a/source/1.0/src/shflags b/source/1.0/src/shflags index 805b07a..b848453 100644 --- a/source/1.0/src/shflags +++ b/source/1.0/src/shflags @@ -890,6 +890,7 @@ flags_help() echo 'flags:' >&2 for flags_name_ in ${__flags_longNames}; do flags_flagStr_='' + flags_boolStr_='' flags_default_=`_flags_getFlagInfo \ "${flags_name_}" ${__FLAGS_INFO_DEFAULT_STR}` @@ -900,17 +901,14 @@ flags_help() flags_type_=`_flags_getFlagInfo \ "${flags_name_}" ${__FLAGS_INFO_TYPE_STR}` - [ "${flags_short_}" != "${__FLAGS_NULL}" ] && \ - flags_flagStr_="${flags_flagStr_}-${flags_short_}" + [ "${flags_short_}" != "${__FLAGS_NULL}" ] \ + && flags_flagStr_="-${flags_short_}" if [ ${__FLAGS_GETOPT_VERS} -eq ${__FLAGS_GETOPT_VERS_ENH} ]; then - [ "${flags_short_}" != "${__FLAGS_NULL}" ] && \ - flags_flagStr_="${flags_flagStr_}," - if [ ${flags_type_} -eq ${__FLAGS_TYPE_BOOLEAN} ]; then - flags_boolStr_='[no]' - else - flags_boolStr_='' - fi + [ "${flags_short_}" != "${__FLAGS_NULL}" ] \ + && flags_flagStr_="${flags_flagStr_}," + [ ${flags_type_} -eq ${__FLAGS_TYPE_BOOLEAN} ] \ + && flags_boolStr_='[no]' flags_flagStr_="${flags_flagStr_}--${flags_boolStr_}${flags_name_}:" fi @@ -938,8 +936,8 @@ flags_help() # note: the silliness with the x's is purely for ksh93 on Ubuntu 6.06. # the sed strips the x's back out, plus the zero byte at the end of the # string passed by echo (C strings are zero byte terminated). - flags_emptyStr_="`echo \"x${flags_flagStr_}x\" |tr -c '' ' ' \ - |sed 's/...$//'`" + flags_emptyStr_="`echo \"x${flags_flagStr_}x\" \ + |awk '{printf "%"length($0)-2"s", ""}'`" flags_helpStr_=" ${flags_emptyStr_} ${flags_defaultStr_}" flags_helpStrLen_=`expr "${flags_helpStr_}" : '.*'` if [ ${__FLAGS_GETOPT_VERS} -eq ${__FLAGS_GETOPT_VERS_STD} \ |