diff mbox series

[v2,04/12] pi_stress: Allow short command line arguments

Message ID 20190605160617.22987-5-wagi@monom.org
State New
Headers show
Series rt-tests: Add --duration argument to tests | expand

Commit Message

Daniel Wagner June 5, 2019, 4:06 p.m. UTC
Add optstring to getopt_long() command line parser to support the
short options as it documented in the man page and also in the usage
help text.

Signed-off-by: Daniel Wagner <wagi@monom.org>

---
 src/pi_tests/pi_stress.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

-- 
2.20.1

Comments

John Kacur June 13, 2019, 2:04 p.m. UTC | #1
On Wed, 5 Jun 2019, Daniel Wagner wrote:

> Add optstring to getopt_long() command line parser to support the

> short options as it documented in the man page and also in the usage

> help text.

> 

> Signed-off-by: Daniel Wagner <wagi@monom.org>

> ---

>  src/pi_tests/pi_stress.c | 3 +--

>  1 file changed, 1 insertion(+), 2 deletions(-)

> 

> diff --git a/src/pi_tests/pi_stress.c b/src/pi_tests/pi_stress.c

> index ac7646cd2613..543106be8e18 100644

> --- a/src/pi_tests/pi_stress.c

> +++ b/src/pi_tests/pi_stress.c

> @@ -1322,9 +1322,8 @@ int process_sched_line(const char *arg)

>  void process_command_line(int argc, char **argv)

>  {

>  	int opt;

> -	while ((opt = getopt_long(argc, argv, "+", options, NULL)) != -1) {

> +	while ((opt = getopt_long(argc, argv, "+ht:vqi:g:rs:pdVum", options, NULL)) != -1) {

>  		switch (opt) {

> -		case '?':

>  		case 'h':

>  			usage();

>  			exit(0);

> -- 

> 2.20.1

> 


I actually don't see short options in the usage help text, but I do see 
them in the manpage.

This could use some clean-up to make sure the manpage is current and the 
usage text is current and synced too, if you or anyone else reading cares 
to address this.

Signed-off-by: John Kacur <jkacur@redhat.com>
Daniel Wagner June 16, 2019, 4:29 p.m. UTC | #2
Hi John,

On 6/13/19 4:04 PM, John Kacur wrote:
>> index ac7646cd2613..543106be8e18 100644

>> --- a/src/pi_tests/pi_stress.c

>> +++ b/src/pi_tests/pi_stress.c

>> @@ -1322,9 +1322,8 @@ int process_sched_line(const char *arg)

>>   void process_command_line(int argc, char **argv)

>>   {

>>   	int opt;

>> -	while ((opt = getopt_long(argc, argv, "+", options, NULL)) != -1) {

>> +	while ((opt = getopt_long(argc, argv, "+ht:vqi:g:rs:pdVum", options, NULL)) != -1) {

>>   		switch (opt) {

>> -		case '?':

>>   		case 'h':

>>   			usage();

>>   			exit(0);

>> -- 

>> 2.20.1

>>

> 

> I actually don't see short options in the usage help text, but I do see

> them in the manpage.

> 

> This could use some clean-up to make sure the manpage is current and the

> usage text is current and synced too, if you or anyone else reading cares

> to address this.


pi_stress differs a bit in the handling of the options. Indeed it makes 
sense to streamline it with the other tools. Will look into it (but 
don't hold your breath :))

Thanks,
Daniel
diff mbox series

Patch

diff --git a/src/pi_tests/pi_stress.c b/src/pi_tests/pi_stress.c
index ac7646cd2613..543106be8e18 100644
--- a/src/pi_tests/pi_stress.c
+++ b/src/pi_tests/pi_stress.c
@@ -1322,9 +1322,8 @@  int process_sched_line(const char *arg)
 void process_command_line(int argc, char **argv)
 {
 	int opt;
-	while ((opt = getopt_long(argc, argv, "+", options, NULL)) != -1) {
+	while ((opt = getopt_long(argc, argv, "+ht:vqi:g:rs:pdVum", options, NULL)) != -1) {
 		switch (opt) {
-		case '?':
 		case 'h':
 			usage();
 			exit(0);