svn commit: r272217 - head/usr.bin/mkimg

Marcel Moolenaar marcel at FreeBSD.org
Sat Sep 27 17:58:05 UTC 2014


Author: marcel
Date: Sat Sep 27 17:58:03 2014
New Revision: 272217
URL: http://svnweb.freebsd.org/changeset/base/272217

Log:
  Update the usage message and the man page to account for the new long
  options. Bump the version number to 20140927.
  While here, use explicit fputc() calls to skip a line in the output.
  This to avoid having to hunt for extra '\n' characters in the printf
  format strings.
  
  MFC after:	1 week
  Relnotes:	yes

Modified:
  head/usr.bin/mkimg/Makefile
  head/usr.bin/mkimg/mkimg.1
  head/usr.bin/mkimg/mkimg.c

Modified: head/usr.bin/mkimg/Makefile
==============================================================================
--- head/usr.bin/mkimg/Makefile	Sat Sep 27 17:11:51 2014	(r272216)
+++ head/usr.bin/mkimg/Makefile	Sat Sep 27 17:58:03 2014	(r272217)
@@ -6,7 +6,7 @@ PROG=	mkimg
 SRCS=	format.c image.c mkimg.c scheme.c
 MAN=	mkimg.1
 
-MKIMG_VERSION=20140926
+MKIMG_VERSION=20140927
 CFLAGS+=-DMKIMG_VERSION=${MKIMG_VERSION}
 CFLAGS+=-DSPARSE_WRITE
 

Modified: head/usr.bin/mkimg/mkimg.1
==============================================================================
--- head/usr.bin/mkimg/mkimg.1	Sat Sep 27 17:11:51 2014	(r272216)
+++ head/usr.bin/mkimg/mkimg.1	Sat Sep 27 17:58:03 2014	(r272217)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 12, 2014
+.Dd September 27, 2014
 .Dt MKIMG 1
 .Os
 .Sh NAME
@@ -44,6 +44,8 @@
 .Fl s Ar scheme
 .Fl p Ar partition
 .Op Fl p Ar partition ...
+.Nm
+.Ar --formats | --schemes | --version
 .Sh DESCRIPTION
 The
 .Nm
@@ -122,10 +124,32 @@ utility will generate predictable values
 .Nm
 utility will create images that are identical.
 .Pp
-For a complete list of supported partitioning schemes or supported output
-format, or for a detailed description of how to specify partitions, run the
+A set of long options exist to query about the
+.Nm
+utilty itself.
+Options in this set should be given by themselves because the
+.Nm
+utility exits immediately after providing the requested information.
+The version of the
+.Nm
+utility is printed when the
+.Ar --version
+option is given.
+The list of supported output formats is printed when the
+.Ar --formats
+option is given and the list of supported partitioning schemes is printed
+when the
+.Ar --schemes
+option is given.
+Both the format and scheme lists a space-separated lists for easy handling
+in scripts.
+.Pp
+For a more descriptive list of supported partitioning schemes or supported
+output format, or for a detailed description of how to specify partitions,
+run the
 .Nm
 utility without any arguments.
+This will print a usage message with all the necessary details.
 .Sh ENVIRONMENT
 .Bl -tag -width "TMPDIR" -compact
 .It Ev TMPDIR

Modified: head/usr.bin/mkimg/mkimg.c
==============================================================================
--- head/usr.bin/mkimg/mkimg.c	Sat Sep 27 17:11:51 2014	(r272216)
+++ head/usr.bin/mkimg/mkimg.c	Sat Sep 27 17:58:03 2014	(r272217)
@@ -79,7 +79,7 @@ print_formats(int usage)
 	const char *sep;
 
 	if (usage) {
-		fprintf(stderr, "\n    formats:\n");
+		fprintf(stderr, "    formats:\n");
 		SET_FOREACH(f_iter, formats) {
 			f = *f_iter;
 			fprintf(stderr, "\t%s\t-  %s\n", f->name,
@@ -103,7 +103,7 @@ print_schemes(int usage)
 	const char *sep;
 
 	if (usage) {
-		fprintf(stderr, "\n    schemes:\n");
+		fprintf(stderr, "    schemes:\n");
 		SET_FOREACH(s_iter, schemes) {
 			s = *s_iter;
 			fprintf(stderr, "\t%s\t-  %s\n", s->name,
@@ -138,9 +138,14 @@ usage(const char *why)
 {
 
 	warnx("error: %s", why);
-	fprintf(stderr, "\nusage: %s <options>\n", getprogname());
+	fputc('\n', stderr);
+	fprintf(stderr, "usage: %s <options>\n", getprogname());
 
 	fprintf(stderr, "    options:\n");
+	fprintf(stderr, "\t--formats\t-  list image formats\n");
+	fprintf(stderr, "\t--schemes\t-  list partition schemes\n");
+	fprintf(stderr, "\t--version\t-  show version information\n");
+	fputc('\n', stderr);
 	fprintf(stderr, "\t-b <file>\t-  file containing boot code\n");
 	fprintf(stderr, "\t-f <format>\n");
 	fprintf(stderr, "\t-o <file>\t-  file to write image into\n");
@@ -152,11 +157,12 @@ usage(const char *why)
 	fprintf(stderr, "\t-P <num>\t-  physical sector size\n");
 	fprintf(stderr, "\t-S <num>\t-  logical sector size\n");
 	fprintf(stderr, "\t-T <num>\t-  number of tracks to simulate\n");
-
+	fputc('\n', stderr);
 	print_formats(1);
+	fputc('\n', stderr);
 	print_schemes(1);
-
-	fprintf(stderr, "\n    partition specification:\n");
+	fputc('\n', stderr);
+	fprintf(stderr, "    partition specification:\n");
 	fprintf(stderr, "\t<t>[/<l>]::<size>\t-  empty partition of given "
 	    "size\n");
 	fprintf(stderr, "\t<t>[/<l>]:=<file>\t-  partition content and size "


More information about the svn-src-all mailing list