________________________________
From: [email protected]
[mailto:[email protected]] On Behalf Of Tzachi Dar
Sent: Thursday, August 19, 2010 8:08 AM
To: [email protected]
Subject: [ofw] patch: opensm - better handle bad command line parameters
The following patch helps opensm handle bad parameters, such as:
"opensm -"
K:\Users\Administrator>opensm -/
-------------------------------------------------
OpenSM 3.3.3
^C
K:\Users\Administrator>opensm -/\\
-------------------------------------------------
OpenSM 3.3.3
^C
K:\Users\Administrator>opensm -/\\jjj -h
Thanks
Tzachi
You want to be using the latest getopt() version.
Index: main.c
===================================================================
--- main.c (revision 6291)
+++ main.c (revision 6292)
@@ -723,9 +723,9 @@
default:
break;
}
- } while (next_option != -1);
+ } while (next_option != -1 && next_option != '?');
Adding
case '?':
to
case 'h':
case ':':
show_usage();
break;
Removes the need for "next_option != '?'" plus the standard windows help
request '/?' is supported.
if (config_file && osm_subn_parse_conf_file(config_file, &opt)
< 0)
printf("\nFail to parse config file \'%s\'\n",
config_file);
@@ -1077,7 +1077,8 @@
case -1:
break; /* done with option */
default: /* something wrong */
- abort();
+ show_usage();
+ exit(1);
}
} while (next_option != -1);
Yes, this makes sense.
_______________________________________________
ofw mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ofw