osaf/tools/safntf/ntfsend/ntfsend.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)


The command ntfsend says the --help option is not recognized,
even though it actually does print a help text when given this option.

This defect occurs as there is no options [--help|-h] supported.

Add [--help|-h] to support the option.

diff --git a/osaf/tools/safntf/ntfsend/ntfsend.c 
b/osaf/tools/safntf/ntfsend/ntfsend.c
--- a/osaf/tools/safntf/ntfsend/ntfsend.c
+++ b/osaf/tools/safntf/ntfsend/ntfsend.c
@@ -928,6 +928,7 @@ int main(int argc, char *argv[])
                {"eventTime", required_argument, 0, 'E'},
                {"burstTimeout", required_argument, 0, 'b'},
                {"additionalInfo", required_argument, 0, 'i'},
+               {"help", no_argument, 0, 'h'},
                {0, 0, 0, 0}
        };
 
@@ -943,7 +944,7 @@ int main(int argc, char *argv[])
 
        if (argc >= 1) {
                /* Check options */
-               while ((current_option = getopt_long(argc, argv, 
"a:c:e:E:N:n:p:r:s:b:T:i:", long_options, NULL)) != -1) {
+               while ((current_option = getopt_long(argc, argv, 
"a:c:e:E:N:n:p:r:s:b:T:i:h", long_options, NULL)) != -1) {
                        optionFlag = SA_TRUE;
                        switch (current_option) {
                        case 'a':
@@ -1055,15 +1056,20 @@ int main(int argc, char *argv[])
                                (void)printf("Invalid Option!!!!\n");
                                usage();
                                break;
+                       case 'h':
+                               usage();
+                               exit(EXIT_SUCCESS);
+                               break;
                        default:
                                usage();
                                break;
                        }
                }
                if (optind < argc) {
-                       fprintf(stderr, "non-option ARGV-elements: ");
+                       fprintf(stderr, "Invalid option: \n");
                        while (optind < argc)
                                fprintf(stderr, "%s \n", argv[optind++]);
+                       fprintf(stderr, "Try '%s -h' for more information. \n", 
argv[0]);
                        exit(EXIT_FAILURE);
                }
                if ((optionFlag == SA_FALSE) && (argc >= 3)) {

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to