Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Oct 2013 10:36:55 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        virtualization@freebsd.org
Subject:   [PATCH] Tidy usage messages for bhyve and bhyveload
Message-ID:  <201310231036.55620.jhb@freebsd.org>

next in thread | raw e-mail | index | archive | help
These are just some cosmetic nits to the usage messages for bhyve and
bhyveload so that they are more consistent with other tools in the base
system (spaces between options, wrapping at 80 cols, etc.)

Index: bhyve/bhyverun.c
===================================================================
--- bhyve/bhyverun.c	(revision 256946)
+++ bhyve/bhyverun.c	(working copy)
@@ -37,6 +37,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <err.h>
 #include <libgen.h>
 #include <unistd.h>
@@ -121,9 +122,8 @@
 {
 
         fprintf(stderr,
-                "Usage: %s [-aehAHIPW][-g <gdb port>][-s <pci>][-S <pci>]"
-		"[-c vcpus][-p pincpu][-m mem]"
-		" <vmname>\n"
+                "Usage: %s [-aehAHIPW] [-g <gdb port>] [-s <pci>] [-S <pci>]\n"
+		"       %*s [-c vcpus] [-p pincpu] [-m mem] <vmname>\n"
 		"       -a: local apic is in XAPIC mode (default is X2APIC)\n"
 		"       -A: create an ACPI table\n"
 		"       -g: gdb port\n"
@@ -132,13 +132,13 @@
 		"       -H: vmexit from the guest on hlt\n"
 		"       -I: present an ioapic to the guest\n"
 		"       -P: vmexit from the guest on pause\n"
-		"	-W: force virtio to use single-vector MSI\n"
-		"	-e: exit on unhandled i/o access\n"
+		"       -W: force virtio to use single-vector MSI\n"
+		"       -e: exit on unhandled I/O access\n"
 		"       -h: help\n"
 		"       -s: <slot,driver,configinfo> PCI slot config\n"
 		"       -S: <slot,driver,configinfo> legacy PCI slot config\n"
 		"       -m: memory size in MB\n",
-		progname);
+		progname, (int)strlen(progname), "");
 
 	exit(code);
 }
Index: bhyveload/bhyveload.c
===================================================================
--- bhyveload/bhyveload.c	(revision 256946)
+++ bhyveload/bhyveload.c	(working copy)
@@ -71,6 +71,7 @@
 #include <err.h>
 #include <fcntl.h>
 #include <getopt.h>
+#include <libgen.h>
 #include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -568,8 +569,9 @@
 {
 
 	fprintf(stderr,
-	    "usage: %s [-m mem-size][-d <disk-path>] [-h <host-path>] "
-	    "[-e <name=value>] <vmname>\n", progname);
+	    "usage: %s [-m mem-size] [-d <disk-path>] [-h <host-path>]\n"
+	    "       %*s [-e <name=value>] <vmname>\n", progname,
+	    (int)strlen(progname), "");
 	exit(1);
 }
 
@@ -582,7 +584,7 @@
 	int opt, error;
 	char *disk_image;
 
-	progname = argv[0];
+	progname = basename(argv[0]);
 
 	mem_size = 256 * MB;
 	disk_image = NULL;

-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201310231036.55620.jhb>