From 2bf89afb2b390cf0e131c1d6b2f377b480f4bf21 Mon Sep 17 00:00:00 2001 From: marcel Date: Sat, 27 Sep 2014 17:58:03 +0000 Subject: 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 --- usr.bin/mkimg/Makefile | 2 +- usr.bin/mkimg/mkimg.1 | 30 +++++++++++++++++++++++++++--- usr.bin/mkimg/mkimg.c | 18 ++++++++++++------ 3 files changed, 40 insertions(+), 10 deletions(-) (limited to 'usr.bin/mkimg') diff --git a/usr.bin/mkimg/Makefile b/usr.bin/mkimg/Makefile index a0bc579..7745566 100644 --- a/usr.bin/mkimg/Makefile +++ b/usr.bin/mkimg/Makefile @@ -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 diff --git a/usr.bin/mkimg/mkimg.1 b/usr.bin/mkimg/mkimg.1 index db492ed..bfe05c0 100644 --- a/usr.bin/mkimg/mkimg.1 +++ b/usr.bin/mkimg/mkimg.1 @@ -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 for Universally Unique Identifiers .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 diff --git a/usr.bin/mkimg/mkimg.c b/usr.bin/mkimg/mkimg.c index 8c26c7e..d054423 100644 --- a/usr.bin/mkimg/mkimg.c +++ b/usr.bin/mkimg/mkimg.c @@ -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 \n", getprogname()); + fputc('\n', stderr); + fprintf(stderr, "usage: %s \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 \t- file containing boot code\n"); fprintf(stderr, "\t-f \n"); fprintf(stderr, "\t-o \t- file to write image into\n"); @@ -152,11 +157,12 @@ usage(const char *why) fprintf(stderr, "\t-P \t- physical sector size\n"); fprintf(stderr, "\t-S \t- logical sector size\n"); fprintf(stderr, "\t-T \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- empty partition of given " "size\n"); fprintf(stderr, "\t[/]:=\t- partition content and size " -- cgit v1.1