diff mbox series

[rt-tests,v1,11/23] ssdd: Rename command line option --output to --json

Message ID 20210519170945.21941-12-dwagner@suse.de
State New
Headers show
Series Rename --output to --json | expand

Commit Message

Daniel Wagner May 19, 2021, 5:09 p.m. UTC
The initial idea was to have several different output format
supported but it turns out everyone is happy with JSON, so
there is no need to add another format.

Thus let's make the command line option more specific and
rename it to --json.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/ssdd/ssdd.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

Comments

John Kacur May 22, 2021, 3:34 a.m. UTC | #1
On Wed, 19 May 2021, Daniel Wagner wrote:

> The initial idea was to have several different output format

> supported but it turns out everyone is happy with JSON, so

> there is no need to add another format.

> 

> Thus let's make the command line option more specific and

> rename it to --json.

> 

> Signed-off-by: Daniel Wagner <dwagner@suse.de>

> ---

>  src/ssdd/ssdd.c | 16 ++++++++--------

>  1 file changed, 8 insertions(+), 8 deletions(-)

> 

> diff --git a/src/ssdd/ssdd.c b/src/ssdd/ssdd.c

> index 3ead14d0127e..421688c7f47c 100644

> --- a/src/ssdd/ssdd.c

> +++ b/src/ssdd/ssdd.c

> @@ -67,11 +67,11 @@ static const char *get_state_name(int state)

>  #define unused __attribute__((unused))

>  

>  static int quiet;

> -static char outfile[MAX_PATH];

> +static char jsonfile[MAX_PATH];

>  

>  static int got_sigchld;

>  

> -enum option_value { OPT_NFORKS=1, OPT_NITERS, OPT_HELP, OPT_OUTPUT, OPT_QUIET };

> +enum option_value { OPT_NFORKS=1, OPT_NITERS, OPT_HELP, OPT_JSON, OPT_QUIET };

>  

>  static void usage(int error)

>  {

> @@ -80,7 +80,7 @@ static void usage(int error)

>  	       "ssdd <options>\n\n"

>  	       "-f       --forks=NUM       number of forks\n"

>  	       "-h       --help            print this message\n"

> -	       "         --output=FILENAME write final results into FILENAME, JSON formatted\n"

> +	       "         --json=FILENAME   write final results into FILENAME, JSON formatted\n"

>  	       "-q       --quiet           suppress running output\n"

>  	       "-i       --iters=NUM       number of iterations\n"

>  	       );

> @@ -306,7 +306,7 @@ int main(int argc, char **argv)

>  		static struct option long_options[] = {

>  			{"forks",		required_argument,	NULL, OPT_NFORKS},

>  			{"help",		no_argument,		NULL, OPT_HELP},

> -			{"output",		required_argument,	NULL, OPT_OUTPUT},

> +			{"json",		required_argument,	NULL, OPT_JSON},

>  			{"quiet",		no_argument,		NULL, OPT_QUIET},

>  			{"iters",		required_argument,	NULL, OPT_NITERS},

>  			{NULL, 0, NULL, 0},

> @@ -323,8 +323,8 @@ int main(int argc, char **argv)

>  		case OPT_HELP:

>  			usage(0);

>  			break;

> -		case OPT_OUTPUT:

> -			strncpy(outfile, optarg, strnlen(optarg, MAX_PATH-1));

> +		case OPT_JSON:

> +			strncpy(jsonfile, optarg, strnlen(optarg, MAX_PATH-1));

>  			break;

>  		case OPT_QUIET:

>  		case 'q':

> @@ -374,8 +374,8 @@ int main(int argc, char **argv)

>  		"One or more tests FAILED" :

>  		"All tests PASSED");

>  

> -	if (strlen(outfile) != 0)

> -		rt_write_json(outfile, error, NULL, NULL);

> +	if (strlen(jsonfile) != 0)

> +		rt_write_json(jsonfile, error, NULL, NULL);

>  

>  	exit(error);

>  }

> -- 

> 2.31.1

> 

> 

Signed-off-by: John Kacur <jkacur@redhat.com>
diff mbox series

Patch

diff --git a/src/ssdd/ssdd.c b/src/ssdd/ssdd.c
index 3ead14d0127e..421688c7f47c 100644
--- a/src/ssdd/ssdd.c
+++ b/src/ssdd/ssdd.c
@@ -67,11 +67,11 @@  static const char *get_state_name(int state)
 #define unused __attribute__((unused))
 
 static int quiet;
-static char outfile[MAX_PATH];
+static char jsonfile[MAX_PATH];
 
 static int got_sigchld;
 
-enum option_value { OPT_NFORKS=1, OPT_NITERS, OPT_HELP, OPT_OUTPUT, OPT_QUIET };
+enum option_value { OPT_NFORKS=1, OPT_NITERS, OPT_HELP, OPT_JSON, OPT_QUIET };
 
 static void usage(int error)
 {
@@ -80,7 +80,7 @@  static void usage(int error)
 	       "ssdd <options>\n\n"
 	       "-f       --forks=NUM       number of forks\n"
 	       "-h       --help            print this message\n"
-	       "         --output=FILENAME write final results into FILENAME, JSON formatted\n"
+	       "         --json=FILENAME   write final results into FILENAME, JSON formatted\n"
 	       "-q       --quiet           suppress running output\n"
 	       "-i       --iters=NUM       number of iterations\n"
 	       );
@@ -306,7 +306,7 @@  int main(int argc, char **argv)
 		static struct option long_options[] = {
 			{"forks",		required_argument,	NULL, OPT_NFORKS},
 			{"help",		no_argument,		NULL, OPT_HELP},
-			{"output",		required_argument,	NULL, OPT_OUTPUT},
+			{"json",		required_argument,	NULL, OPT_JSON},
 			{"quiet",		no_argument,		NULL, OPT_QUIET},
 			{"iters",		required_argument,	NULL, OPT_NITERS},
 			{NULL, 0, NULL, 0},
@@ -323,8 +323,8 @@  int main(int argc, char **argv)
 		case OPT_HELP:
 			usage(0);
 			break;
-		case OPT_OUTPUT:
-			strncpy(outfile, optarg, strnlen(optarg, MAX_PATH-1));
+		case OPT_JSON:
+			strncpy(jsonfile, optarg, strnlen(optarg, MAX_PATH-1));
 			break;
 		case OPT_QUIET:
 		case 'q':
@@ -374,8 +374,8 @@  int main(int argc, char **argv)
 		"One or more tests FAILED" :
 		"All tests PASSED");
 
-	if (strlen(outfile) != 0)
-		rt_write_json(outfile, error, NULL, NULL);
+	if (strlen(jsonfile) != 0)
+		rt_write_json(jsonfile, error, NULL, NULL);
 
 	exit(error);
 }