usage();
case 'V':
- printf("%s %s compiled "__DATE__" "__TIME__"\n",
- program_name, VERSION BUILDNR);
+ OVS_PRINT_VERSION(0, 0);
exit(EXIT_SUCCESS);
DAEMON_OPTION_HANDLERS
usage();
case 'V':
- printf("%s %s compiled "__DATE__" "__TIME__"\n",
- program_name, VERSION BUILDNR);
+ OVS_PRINT_VERSION(OFP_VERSION, OFP_VERSION);
exit(EXIT_SUCCESS);
VLOG_OPTION_HANDLERS
program_name = slash ? slash + 1 : argv0;
}
+/* Print the version information for the program. */
+void
+ovs_print_version(char *date, char *time,
+ uint8_t min_ofp, uint8_t max_ofp)
+{
+ printf("%s (Open vSwitch) "VERSION BUILDNR"\n", program_name);
+ printf("Compiled %s %s\n", date, time);
+ if (min_ofp || max_ofp) {
+ printf("OpenFlow versions %#x:%#x\n", min_ofp, max_ofp);
+ }
+}
+
/* Writes the 'size' bytes in 'buf' to 'stream' as hex bytes arranged 16 per
* line. Numeric offsets are also included, starting at 'ofs' for the first
* byte in 'buf'. If 'ascii' is true then the corresponding ASCII characters
void set_program_name(const char *);
+void ovs_print_version(char *date, char *time,
+ uint8_t min_ofp, uint8_t max_ofp);
+#define OVS_PRINT_VERSION(min_ofp, max_ofp) \
+ ovs_print_version(__DATE__, __TIME__, (min_ofp), (max_ofp))
+
void out_of_memory(void) NO_RETURN;
void *xmalloc(size_t) MALLOC_LIKE;
void *xcalloc(size_t, size_t) MALLOC_LIKE;
usage();
case 'V':
- printf("%s %s compiled "__DATE__" "__TIME__"\n",
- program_name, VERSION BUILDNR);
+ OVS_PRINT_VERSION(OFP_VERSION, OFP_VERSION);
exit(EXIT_SUCCESS);
DAEMON_OPTION_HANDLERS
" LEVEL may be 'emer', 'err', 'warn', 'info', or 'dbg' (default)\n"
" -r, --reopen Make the program reopen its log file\n"
" -e, --execute=COMMAND Execute control COMMAND and print its output\n"
- " -h, --help Print this helpful information\n",
+ "Other options:\n"
+ " -h, --help Print this helpful information\n"
+ " -V, --version Display version information\n",
prog_name);
exit(exit_code);
}
/* Target options must come first. */
{"target", required_argument, NULL, 't'},
{"help", no_argument, NULL, 'h'},
+ {"version", no_argument, NULL, 'V'},
/* Action options come afterward. */
{"list", no_argument, NULL, 'l'},
if (option == -1) {
break;
}
- if (!strchr("th", option) && n_clients == 0) {
+ if (!strchr("thV", option) && n_clients == 0) {
ovs_fatal(0, "no targets specified (use --help for help)");
} else {
++n_actions;
usage(argv[0], EXIT_SUCCESS);
break;
+ case 'V':
+ OVS_PRINT_VERSION(0, 0);
+ exit(EXIT_SUCCESS);
+
case '?':
exit(EXIT_FAILURE);
" -D, --del-section=KEY delete section matching KEY\n"
" --del-match=PATTERN delete entries matching shell PATTERN\n"
" -q, --query=KEY return all entries matching KEY\n"
- " -c, --log-changes log changes up to this point\n",
+ " -c, --log-changes log changes up to this point\n"
+ "\nOther options:\n"
+ " -h, --help display this help message\n"
+ " -V, --version display version information\n",
prog_name);
exit(exit_code);
}
{"changes", no_argument, 0, 'c'},
{"verbose", optional_argument, 0, 'v'},
{"help", no_argument, 0, 'h'},
+ {"version", no_argument, 0, 'V'},
{0, 0, 0, 0},
};
char *short_options;
break;
}
- if ((option > UCHAR_MAX || !strchr("Fhv?", option))
+ if ((option > UCHAR_MAX || !strchr("FhVv?", option))
&& config_set == false) {
ovs_fatal(0, "no config file specified (use --help for help)");
}
usage(argv[0], EXIT_SUCCESS);
break;
+ case 'V':
+ OVS_PRINT_VERSION(0, 0);
+ exit(EXIT_SUCCESS);
+
case 'v':
vlog_set_verbosity(optarg);
break;
usage();
case 'V':
- printf("%s "VERSION" compiled "__DATE__" "__TIME__"\n", argv[0]);
+ OVS_PRINT_VERSION(OFP_VERSION, OFP_VERSION);
exit(EXIT_SUCCESS);
VLOG_OPTION_HANDLERS
usage();
case 'V':
- printf("%s %s compiled "__DATE__" "__TIME__"\n",
- program_name, VERSION BUILDNR);
+ OVS_PRINT_VERSION(0, 0);
exit(EXIT_SUCCESS);
case 'v':
usage();
case 'V':
- printf("%s %s compiled "__DATE__" "__TIME__"\n",
- program_name, VERSION BUILDNR);
+ OVS_PRINT_VERSION(0, 0);
exit(EXIT_SUCCESS);
case 'v':
usage();
case 'V':
- printf("%s %s compiled "__DATE__" "__TIME__"\n",
- program_name, VERSION BUILDNR);
+ OVS_PRINT_VERSION(0, 0);
exit(EXIT_SUCCESS);
case '?':
usage();
case 'V':
- printf("%s %s compiled "__DATE__" "__TIME__"\n",
- program_name, VERSION BUILDNR);
+ OVS_PRINT_VERSION(OFP_VERSION, OFP_VERSION);
exit(EXIT_SUCCESS);
case 'v':
usage();
case 'V':
- printf("%s "VERSION BUILDNR" compiled "__DATE__" "__TIME__"\n",
- argv[0]);
+ OVS_PRINT_VERSION(0, 0);
exit(EXIT_SUCCESS);
case OPT_LOCK_TIMEOUT:
usage();
case 'V':
- printf("%s "VERSION BUILDNR" compiled "__DATE__" "__TIME__"\n",
- argv[0]);
+ OVS_PRINT_VERSION(OFP_VERSION, OFP_VERSION);
exit(EXIT_SUCCESS);
case OPT_FAKE_PROC_NET: