Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
blaar
blibs
blc_program
Commits
ba30f447
Commit
ba30f447
authored
Jul 25, 2017
by
Arnaud Blanchard
Browse files
Update the result with title
parent
5ddeb016
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/blc_program.cpp
View file @
ba30f447
...
...
@@ -212,8 +212,6 @@ static void blc_program_option_interpret(int *argc, char **argv[])
type_program_option
*
program_option
;
char
pipe_name
[
PATH_MAX
+
1
];
blc_program_name
=
basename
(
*
argv
[
0
]);
//We store enough room for all the optional letters + ':' + terminating null char
optstring
=
MANY_ALLOCATIONS
(
blc_program_options_nb
*
2
+
1
,
char
);
...
...
@@ -364,13 +362,18 @@ static void blc_program_interpret_parameters(int *argc, char **argv[]){
}
void
blc_program_parse_args
(
int
*
argc
,
char
***
argv
){
if
(
blc_program_name
==
NULL
)
blc_program_name
=
basename
((
*
argv
)[
0
]);
blc_program_option_interpret
(
argc
,
argv
);
blc_program_interpret_parameters
(
argc
,
argv
);
}
void
blc_program_parse_args_and_print_title
(
int
*
argc
,
char
***
argv
){
if
(
blc_program_name
==
NULL
)
blc_program_name
=
basename
((
*
argv
)[
0
]);
underline_fprintf
(
'='
,
stderr
,
blc_program_name
);
blc_program_parse_args
(
argc
,
argv
);
}
/*Display format as python argparse*/
...
...
t_parse_args/test_result.log
View file @
ba30f447
t_parse_args
============
Display help:
usage: t_parse_args [-f] [-s string] string [string]
...
...
@@ -7,7 +7,9 @@ usage: t_parse_args [-f] [-s string] string [string]
Program to show how to parse arguments.
positional arguments:
string Required parameter string Show how to accept simple text as option
string Required parameter
string Show how to accept simple text as option
optional arguments:
-f, --flag Show how to read a flag
-s, --simple string Simple text as option (default: Default text)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment