[Opalvoip-svn] SF.net SVN: opalvoip:[31529] ptlib/branches/v2_14/src/ptlib/common/osutils. cxx
Brought to you by:
csoutheren,
rjongbloed
From: <rjo...@us...> - 2014-02-19 00:18:22
|
Revision: 31529 http://sourceforge.net/p/opalvoip/code/31529 Author: rjongbloed Date: 2014-02-19 00:18:19 +0000 (Wed, 19 Feb 2014) Log Message: ----------- Fixed PArgList "usage" when have only single letter versions of options. Modified Paths: -------------- ptlib/branches/v2_14/src/ptlib/common/osutils.cxx Modified: ptlib/branches/v2_14/src/ptlib/common/osutils.cxx =================================================================== --- ptlib/branches/v2_14/src/ptlib/common/osutils.cxx 2014-02-18 22:37:58 UTC (rev 31528) +++ ptlib/branches/v2_14/src/ptlib/common/osutils.cxx 2014-02-19 00:18:19 UTC (rev 31529) @@ -1282,7 +1282,8 @@ if (maxNameLength < len) maxNameLength = len; } - maxNameLength += 6; + if (maxNameLength > 0) + maxNameLength += 6; for (i = 0; i < m_options.size(); ++i) { const OptionSpec & opt = m_options[i]; @@ -1295,15 +1296,19 @@ else strm << " "; - if (opt.m_letter == '\0' || opt.m_name.IsEmpty()) - strm << " "; - else - strm << " or "; - strm << left << "--"; - if (opt.m_type == NoString) - strm << setw(maxNameLength) << opt.m_name; - else - strm << opt.m_name << setw(maxNameLength-opt.m_name.GetLength()) << " <arg>"; + strm << (maxNameLength > 0 ? opt.m_letter == '\0' || opt.m_name.IsEmpty() ? " ": " or " : " ") + << left; + + if (opt.m_name.IsEmpty()) + strm << setw(maxNameLength+5) << (opt.m_type == NoString ? " " : "<arg>"); + else { + strm << "--"; + if (opt.m_type == NoString) + strm << setw(maxNameLength) << opt.m_name; + else + strm << opt.m_name << setw(maxNameLength - opt.m_name.GetLength()) << " <arg>"; + } + PStringArray lines = opt.m_usage.Lines(); if (lines.IsEmpty()) strm << '\n'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |