Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
K
KWSys
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Kevin Fitch
KWSys
Commits
88d4dd4b
Commit
88d4dd4b
authored
7 years ago
by
Rolf Eike Beer
Browse files
Options
Downloads
Patches
Plain Diff
CommandLineArguments: use std::string in GenerateHelp()
parent
239bc737
Branches
master
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
CommandLineArguments.cxx
+7
-13
7 additions, 13 deletions
CommandLineArguments.cxx
with
7 additions
and
13 deletions
CommandLineArguments.cxx
+
7
−
13
View file @
88d4dd4b
...
...
@@ -529,10 +529,7 @@ void CommandLineArguments::GenerateHelp()
}
}
// Create format for that string
char
format
[
80
];
sprintf
(
format
,
" %%-%us "
,
static_cast
<
unsigned
int
>
(
maxlen
));
CommandLineArguments
::
Internal
::
String
::
size_type
maxstrlen
=
maxlen
;
maxlen
+=
4
;
// For the space before and after the option
// Print help for each option
...
...
@@ -540,27 +537,24 @@ void CommandLineArguments::GenerateHelp()
CommandLineArguments
::
Internal
::
SetOfStrings
::
iterator
sit
;
for
(
sit
=
mpit
->
second
.
begin
();
sit
!=
mpit
->
second
.
end
();
sit
++
)
{
str
<<
std
::
endl
;
char
argument
[
100
];
sprintf
(
argument
,
"%s"
,
sit
->
c_str
());
std
::
string
argument
=
*
sit
;
switch
(
this
->
Internals
->
Callbacks
[
*
sit
].
ArgumentType
)
{
case
CommandLineArguments
::
NO_ARGUMENT
:
break
;
case
CommandLineArguments
::
CONCAT_ARGUMENT
:
strcat
(
argument
,
"opt"
)
;
argument
+=
"opt"
;
break
;
case
CommandLineArguments
::
SPACE_ARGUMENT
:
strcat
(
argument
,
" opt"
)
;
argument
+=
" opt"
;
break
;
case
CommandLineArguments
::
EQUAL_ARGUMENT
:
strcat
(
argument
,
"=opt"
)
;
argument
+=
"=opt"
;
break
;
case
CommandLineArguments
::
MULTI_ARGUMENT
:
strcat
(
argument
,
" opt opt ..."
)
;
argument
+=
" opt opt ..."
;
break
;
}
char
buffer
[
80
];
sprintf
(
buffer
,
format
,
argument
);
str
<<
buffer
;
str
<<
" "
<<
argument
.
substr
(
0
,
maxstrlen
)
<<
" "
;
}
const
char
*
ptr
=
this
->
Internals
->
Callbacks
[
mpit
->
first
].
Help
;
size_t
len
=
strlen
(
ptr
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment