Re: [devel] [PATCH 1/1] log: corrected parsing of command logtest with option -e [#2121]
Hi Minh, Thank you for your comments, I will incorporate the comments and will push the file. Thank you Srinivas -Original Message- From: Vu Minh Nguyen [mailto:vu.m.ngu...@dektech.com.au] Sent: Tuesday, October 3, 2017 1:10 PM To: Srinivas Mangipudy ; lennart.l...@ericsson.com Cc: opensaf-devel@lists.sourceforge.net Subject: RE: [PATCH 1/1] log: corrected parsing of command logtest with option -e [#2121] Hi Srinivas, Ack with a minor comment, tagged [Vu]. Regards, Vu > -Original Message- > From: Srinivas Mangipudy [mailto:srinivas.mangip...@oracle.com] > Sent: Tuesday, October 3, 2017 2:04 PM > To: Vu Minh Nguyen ; > lennart.l...@ericsson.com > Cc: opensaf-devel@lists.sourceforge.net > Subject: RE: [PATCH 1/1] log: corrected parsing of command logtest > with option -e [#2121] > > Hi Minh, > > I have corrected the permissions of the file. > > Thank you > Srinivas > > -Original Message- > From: Vu Minh Nguyen [mailto:vu.m.ngu...@dektech.com.au] > Sent: Tuesday, October 3, 2017 7:21 AM > To: Srinivas ; > lennart.l...@ericsson.com > Cc: opensaf-devel@lists.sourceforge.net > Subject: RE: [PATCH 1/1] log: corrected parsing of command logtest > with option -e [#2121] > > Hi, > > > 1 file changed, 14 insertions(+), 26 deletions(-) mode change > > 100644 => 100755 src/log/apitest/logtest.c > > Any reason of changing the file permission? > > Regards, Vu > > > -Original Message- > > From: Srinivas [mailto:srinivas.mangip...@oracle.com] > > Sent: Thursday, September 21, 2017 5:38 PM > > To: lennart.l...@ericsson.com; vu.m.ngu...@dektech.com.au > > Cc: opensaf-devel@lists.sourceforge.net; Srinivas > > > > Subject: [PATCH 1/1] log: corrected parsing of command logtest with > > option -e [#2121] > > > > --- > > src/log/apitest/logtest.c | 40 > > ++-- > > 1 file changed, 14 insertions(+), 26 deletions(-) mode change > > 100644 => 100755 src/log/apitest/logtest.c > > > > diff --git a/src/log/apitest/logtest.c b/src/log/apitest/logtest.c > > old mode 100644 new mode 100755 index 2564957..6777549 > > --- a/src/log/apitest/logtest.c > > +++ b/src/log/apitest/logtest.c > > @@ -420,9 +420,6 @@ int main(int argc, char **argv) > > int suite = ALL_SUITES, tcase = ALL_TESTS; > > int opt_val = 0; > > bool etst_flg = false; > > - int i = 0; > > - char *opt_str_ptr; > > - char *tok_str_ptr = NULL; > > > > if (setenv("SA_ENABLE_EXTENDED_NAMES", "1", 1) != 0) { > > fprintf(stderr, "Failed to set SA_ENABLE_EXTENDED_NAMES > (%s)", @@ > > -468,31 +465,22 @@ int main(int argc, char **argv) > > test_list(); > > exit(0); > > case 'e': > > - opt_str_ptr = argv[optind - 1]; > > - > > - tok_str_ptr = strtok(opt_str_ptr, " "); > > - for (i = 0; i < 2; i++) { > > - if (tok_str_ptr == NULL) > > - break; > > - > > - if (i == 0) { > > - suite = atoi(tok_str_ptr); > > - if (suite == 0) { > > - /* Argument is not numeric > > or 0 > > -*/ > > - err_exit(); > > - } > > - } else { > > - tcase = atoi(tok_str_ptr); > > - if (tcase == 0) { > > - /* Argument is not numeric > > or 0 > > -*/ > > - err_exit(); > > - } > > + if (argv[optind - 1] != NULL) { > > + suite = atoi(argv[optind - 1]); > > + if (suite == 0) { > > + /* Argument is not numeric or 0 > > +*/ > > + err_exit(); > > } > > - tok_str_ptr = strtok(NULL, " "); > > + } else > > + err_exit(); [Vu] According to Linux coding rule, I think, we should have braces after `else`. > > + if (optind < argc && argv[optind] != NULL) > > + tcase = atoi(argv[optind]); > > + if (tcase == 0) { > > + /* Argument is not numeric or 0 > > +*/ > > + err_exit(); > > } > > - > > etst_flg = true; > > add_suite_9(); > > add_suite_10(); > > -- > > 2.7.4 > ---
Re: [devel] [PATCH 1/1] log: corrected parsing of command logtest with option -e [#2121]
Hi Srinivas, Ack with a minor comment, tagged [Vu]. Regards, Vu > -Original Message- > From: Srinivas Mangipudy [mailto:srinivas.mangip...@oracle.com] > Sent: Tuesday, October 3, 2017 2:04 PM > To: Vu Minh Nguyen ; > lennart.l...@ericsson.com > Cc: opensaf-devel@lists.sourceforge.net > Subject: RE: [PATCH 1/1] log: corrected parsing of command logtest with > option -e [#2121] > > Hi Minh, > > I have corrected the permissions of the file. > > Thank you > Srinivas > > -Original Message- > From: Vu Minh Nguyen [mailto:vu.m.ngu...@dektech.com.au] > Sent: Tuesday, October 3, 2017 7:21 AM > To: Srinivas ; lennart.l...@ericsson.com > Cc: opensaf-devel@lists.sourceforge.net > Subject: RE: [PATCH 1/1] log: corrected parsing of command logtest with > option -e [#2121] > > Hi, > > > 1 file changed, 14 insertions(+), 26 deletions(-) mode change 100644 > > => 100755 src/log/apitest/logtest.c > > Any reason of changing the file permission? > > Regards, Vu > > > -Original Message- > > From: Srinivas [mailto:srinivas.mangip...@oracle.com] > > Sent: Thursday, September 21, 2017 5:38 PM > > To: lennart.l...@ericsson.com; vu.m.ngu...@dektech.com.au > > Cc: opensaf-devel@lists.sourceforge.net; Srinivas > > > > Subject: [PATCH 1/1] log: corrected parsing of command logtest with > > option -e [#2121] > > > > --- > > src/log/apitest/logtest.c | 40 > > ++-- > > 1 file changed, 14 insertions(+), 26 deletions(-) mode change 100644 > > => 100755 src/log/apitest/logtest.c > > > > diff --git a/src/log/apitest/logtest.c b/src/log/apitest/logtest.c old > > mode 100644 new mode 100755 index 2564957..6777549 > > --- a/src/log/apitest/logtest.c > > +++ b/src/log/apitest/logtest.c > > @@ -420,9 +420,6 @@ int main(int argc, char **argv) > > int suite = ALL_SUITES, tcase = ALL_TESTS; > > int opt_val = 0; > > bool etst_flg = false; > > - int i = 0; > > - char *opt_str_ptr; > > - char *tok_str_ptr = NULL; > > > > if (setenv("SA_ENABLE_EXTENDED_NAMES", "1", 1) != 0) { > > fprintf(stderr, "Failed to set SA_ENABLE_EXTENDED_NAMES > (%s)", @@ > > -468,31 +465,22 @@ int main(int argc, char **argv) > > test_list(); > > exit(0); > > case 'e': > > - opt_str_ptr = argv[optind - 1]; > > - > > - tok_str_ptr = strtok(opt_str_ptr, " "); > > - for (i = 0; i < 2; i++) { > > - if (tok_str_ptr == NULL) > > - break; > > - > > - if (i == 0) { > > - suite = atoi(tok_str_ptr); > > - if (suite == 0) { > > - /* Argument is not numeric > > or 0 > > -*/ > > - err_exit(); > > - } > > - } else { > > - tcase = atoi(tok_str_ptr); > > - if (tcase == 0) { > > - /* Argument is not numeric > > or 0 > > -*/ > > - err_exit(); > > - } > > + if (argv[optind - 1] != NULL) { > > + suite = atoi(argv[optind - 1]); > > + if (suite == 0) { > > + /* Argument is not numeric or 0 > > +*/ > > + err_exit(); > > } > > - tok_str_ptr = strtok(NULL, " "); > > + } else > > + err_exit(); [Vu] According to Linux coding rule, I think, we should have braces after `else`. > > + if (optind < argc && argv[optind] != NULL) > > + tcase = atoi(argv[optind]); > > + if (tcase == 0) { > > + /* Argument is not numeric or 0 > > +*/ > > + err_exit(); > > } > > - > > etst_flg = true; > > add_suite_9(); > > add_suite_10(); > > -- > > 2.7.4 > -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 1/1] log: corrected parsing of command logtest with option -e [#2121]
Hi Minh, I have corrected the permissions of the file. Thank you Srinivas -Original Message- From: Vu Minh Nguyen [mailto:vu.m.ngu...@dektech.com.au] Sent: Tuesday, October 3, 2017 7:21 AM To: Srinivas ; lennart.l...@ericsson.com Cc: opensaf-devel@lists.sourceforge.net Subject: RE: [PATCH 1/1] log: corrected parsing of command logtest with option -e [#2121] Hi, > 1 file changed, 14 insertions(+), 26 deletions(-) mode change 100644 > => 100755 src/log/apitest/logtest.c Any reason of changing the file permission? Regards, Vu > -Original Message- > From: Srinivas [mailto:srinivas.mangip...@oracle.com] > Sent: Thursday, September 21, 2017 5:38 PM > To: lennart.l...@ericsson.com; vu.m.ngu...@dektech.com.au > Cc: opensaf-devel@lists.sourceforge.net; Srinivas > > Subject: [PATCH 1/1] log: corrected parsing of command logtest with > option -e [#2121] > > --- > src/log/apitest/logtest.c | 40 > ++-- > 1 file changed, 14 insertions(+), 26 deletions(-) mode change 100644 > => 100755 src/log/apitest/logtest.c > > diff --git a/src/log/apitest/logtest.c b/src/log/apitest/logtest.c old > mode 100644 new mode 100755 index 2564957..6777549 > --- a/src/log/apitest/logtest.c > +++ b/src/log/apitest/logtest.c > @@ -420,9 +420,6 @@ int main(int argc, char **argv) > int suite = ALL_SUITES, tcase = ALL_TESTS; > int opt_val = 0; > bool etst_flg = false; > - int i = 0; > - char *opt_str_ptr; > - char *tok_str_ptr = NULL; > > if (setenv("SA_ENABLE_EXTENDED_NAMES", "1", 1) != 0) { > fprintf(stderr, "Failed to set SA_ENABLE_EXTENDED_NAMES (%s)", > @@ > -468,31 +465,22 @@ int main(int argc, char **argv) > test_list(); > exit(0); > case 'e': > - opt_str_ptr = argv[optind - 1]; > - > - tok_str_ptr = strtok(opt_str_ptr, " "); > - for (i = 0; i < 2; i++) { > - if (tok_str_ptr == NULL) > - break; > - > - if (i == 0) { > - suite = atoi(tok_str_ptr); > - if (suite == 0) { > - /* Argument is not numeric > or 0 > - */ > - err_exit(); > - } > - } else { > - tcase = atoi(tok_str_ptr); > - if (tcase == 0) { > - /* Argument is not numeric > or 0 > - */ > - err_exit(); > - } > + if (argv[optind - 1] != NULL) { > + suite = atoi(argv[optind - 1]); > + if (suite == 0) { > + /* Argument is not numeric or 0 > + */ > + err_exit(); > } > - tok_str_ptr = strtok(NULL, " "); > + } else > + err_exit(); > + if (optind < argc && argv[optind] != NULL) > + tcase = atoi(argv[optind]); > + if (tcase == 0) { > + /* Argument is not numeric or 0 > + */ > + err_exit(); > } > - > etst_flg = true; > add_suite_9(); > add_suite_10(); > -- > 2.7.4 -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 1/1] log: corrected parsing of command logtest with option -e [#2121]
Hi, > 1 file changed, 14 insertions(+), 26 deletions(-) > mode change 100644 => 100755 src/log/apitest/logtest.c Any reason of changing the file permission? Regards, Vu > -Original Message- > From: Srinivas [mailto:srinivas.mangip...@oracle.com] > Sent: Thursday, September 21, 2017 5:38 PM > To: lennart.l...@ericsson.com; vu.m.ngu...@dektech.com.au > Cc: opensaf-devel@lists.sourceforge.net; Srinivas > > Subject: [PATCH 1/1] log: corrected parsing of command logtest with option > -e [#2121] > > --- > src/log/apitest/logtest.c | 40 ++-- > 1 file changed, 14 insertions(+), 26 deletions(-) > mode change 100644 => 100755 src/log/apitest/logtest.c > > diff --git a/src/log/apitest/logtest.c b/src/log/apitest/logtest.c > old mode 100644 > new mode 100755 > index 2564957..6777549 > --- a/src/log/apitest/logtest.c > +++ b/src/log/apitest/logtest.c > @@ -420,9 +420,6 @@ int main(int argc, char **argv) > int suite = ALL_SUITES, tcase = ALL_TESTS; > int opt_val = 0; > bool etst_flg = false; > - int i = 0; > - char *opt_str_ptr; > - char *tok_str_ptr = NULL; > > if (setenv("SA_ENABLE_EXTENDED_NAMES", "1", 1) != 0) { > fprintf(stderr, "Failed to set SA_ENABLE_EXTENDED_NAMES > (%s)", > @@ -468,31 +465,22 @@ int main(int argc, char **argv) > test_list(); > exit(0); > case 'e': > - opt_str_ptr = argv[optind - 1]; > - > - tok_str_ptr = strtok(opt_str_ptr, " "); > - for (i = 0; i < 2; i++) { > - if (tok_str_ptr == NULL) > - break; > - > - if (i == 0) { > - suite = atoi(tok_str_ptr); > - if (suite == 0) { > - /* Argument is not numeric > or 0 > - */ > - err_exit(); > - } > - } else { > - tcase = atoi(tok_str_ptr); > - if (tcase == 0) { > - /* Argument is not numeric > or 0 > - */ > - err_exit(); > - } > + if (argv[optind - 1] != NULL) { > + suite = atoi(argv[optind - 1]); > + if (suite == 0) { > + /* Argument is not numeric or 0 > + */ > + err_exit(); > } > - tok_str_ptr = strtok(NULL, " "); > + } else > + err_exit(); > + if (optind < argc && argv[optind] != NULL) > + tcase = atoi(argv[optind]); > + if (tcase == 0) { > + /* Argument is not numeric or 0 > + */ > + err_exit(); > } > - > etst_flg = true; > add_suite_9(); > add_suite_10(); > -- > 2.7.4 -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
Re: [devel] [PATCH 1/1] log: corrected parsing of command logtest with option -e [#2121]
Ack /Lennart > -Original Message- > From: Srinivas [mailto:srinivas.mangip...@oracle.com] > Sent: den 21 september 2017 12:38 > To: Lennart Lund ; Vu Minh Nguyen > > Cc: opensaf-devel@lists.sourceforge.net; Srinivas > > Subject: [PATCH 1/1] log: corrected parsing of command logtest with option - > e [#2121] > > --- > src/log/apitest/logtest.c | 40 ++-- > 1 file changed, 14 insertions(+), 26 deletions(-) > mode change 100644 => 100755 src/log/apitest/logtest.c > > diff --git a/src/log/apitest/logtest.c b/src/log/apitest/logtest.c > old mode 100644 > new mode 100755 > index 2564957..6777549 > --- a/src/log/apitest/logtest.c > +++ b/src/log/apitest/logtest.c > @@ -420,9 +420,6 @@ int main(int argc, char **argv) > int suite = ALL_SUITES, tcase = ALL_TESTS; > int opt_val = 0; > bool etst_flg = false; > - int i = 0; > - char *opt_str_ptr; > - char *tok_str_ptr = NULL; > > if (setenv("SA_ENABLE_EXTENDED_NAMES", "1", 1) != 0) { > fprintf(stderr, "Failed to set SA_ENABLE_EXTENDED_NAMES > (%s)", > @@ -468,31 +465,22 @@ int main(int argc, char **argv) > test_list(); > exit(0); > case 'e': > - opt_str_ptr = argv[optind - 1]; > - > - tok_str_ptr = strtok(opt_str_ptr, " "); > - for (i = 0; i < 2; i++) { > - if (tok_str_ptr == NULL) > - break; > - > - if (i == 0) { > - suite = atoi(tok_str_ptr); > - if (suite == 0) { > - /* Argument is not numeric > or 0 > - */ > - err_exit(); > - } > - } else { > - tcase = atoi(tok_str_ptr); > - if (tcase == 0) { > - /* Argument is not numeric > or 0 > - */ > - err_exit(); > - } > + if (argv[optind - 1] != NULL) { > + suite = atoi(argv[optind - 1]); > + if (suite == 0) { > + /* Argument is not numeric or 0 > + */ > + err_exit(); > } > - tok_str_ptr = strtok(NULL, " "); > + } else > + err_exit(); > + if (optind < argc && argv[optind] != NULL) > + tcase = atoi(argv[optind]); > + if (tcase == 0) { > + /* Argument is not numeric or 0 > + */ > + err_exit(); > } > - > etst_flg = true; > add_suite_9(); > add_suite_10(); > -- > 2.7.4 -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel
[devel] [PATCH 1/1] log: corrected parsing of command logtest with option -e [#2121]
--- src/log/apitest/logtest.c | 40 ++-- 1 file changed, 14 insertions(+), 26 deletions(-) mode change 100644 => 100755 src/log/apitest/logtest.c diff --git a/src/log/apitest/logtest.c b/src/log/apitest/logtest.c old mode 100644 new mode 100755 index 2564957..6777549 --- a/src/log/apitest/logtest.c +++ b/src/log/apitest/logtest.c @@ -420,9 +420,6 @@ int main(int argc, char **argv) int suite = ALL_SUITES, tcase = ALL_TESTS; int opt_val = 0; bool etst_flg = false; - int i = 0; - char *opt_str_ptr; - char *tok_str_ptr = NULL; if (setenv("SA_ENABLE_EXTENDED_NAMES", "1", 1) != 0) { fprintf(stderr, "Failed to set SA_ENABLE_EXTENDED_NAMES (%s)", @@ -468,31 +465,22 @@ int main(int argc, char **argv) test_list(); exit(0); case 'e': - opt_str_ptr = argv[optind - 1]; - - tok_str_ptr = strtok(opt_str_ptr, " "); - for (i = 0; i < 2; i++) { - if (tok_str_ptr == NULL) - break; - - if (i == 0) { - suite = atoi(tok_str_ptr); - if (suite == 0) { - /* Argument is not numeric or 0 -*/ - err_exit(); - } - } else { - tcase = atoi(tok_str_ptr); - if (tcase == 0) { - /* Argument is not numeric or 0 -*/ - err_exit(); - } + if (argv[optind - 1] != NULL) { + suite = atoi(argv[optind - 1]); + if (suite == 0) { + /* Argument is not numeric or 0 +*/ + err_exit(); } - tok_str_ptr = strtok(NULL, " "); + } else + err_exit(); + if (optind < argc && argv[optind] != NULL) + tcase = atoi(argv[optind]); + if (tcase == 0) { + /* Argument is not numeric or 0 +*/ + err_exit(); } - etst_flg = true; add_suite_9(); add_suite_10(); -- 2.7.4 -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel