1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-24 11:29:10 +00:00

units(1): make -V print version instead of -v

The units program is likely little used.  It is even less likely that a script
will want the units program to print out its version number by passing -v.

GNU units uses -V for version and -v for verbosity.

Increase compatibility between these two versions (written by the same author)
by switching our flag as well.

Take this opportunity to remove bogus information about the version number and
just call it 'FreeBSD units'.

Discussed with:	cperciva, rwatson
This commit is contained in:
Eitan Adler 2014-04-07 02:31:10 +00:00
parent b4b139b109
commit 6d12a83408
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=264216
2 changed files with 8 additions and 12 deletions

View File

@ -8,7 +8,7 @@
.Sh SYNOPSIS .Sh SYNOPSIS
.Nm .Nm
.Op Fl f Ar filename .Op Fl f Ar filename
.Op Fl qv .Op Fl qV
.Op Ar from-unit to-unit .Op Ar from-unit to-unit
.Sh OPTIONS .Sh OPTIONS
The following options are available: The following options are available:
@ -18,8 +18,8 @@ Specify the name of the units data file to load.
.It Fl q .It Fl q
Suppress prompting of the user for units and the display of statistics Suppress prompting of the user for units and the display of statistics
about the number of units loaded. about the number of units loaded.
.It Fl v .It Fl V
Print the version number. Print the version number, usage, and then exit.
.It Ar from-unit to-unit .It Ar from-unit to-unit
Allow a single unit conversion to be done directly from the command Allow a single unit conversion to be done directly from the command
line. line.

View File

@ -32,8 +32,6 @@ static const char rcsid[] =
#include "pathnames.h" #include "pathnames.h"
#define VERSION "1.0"
#ifndef UNITSFILE #ifndef UNITSFILE
#define UNITSFILE _PATH_UNITSLIB #define UNITSFILE _PATH_UNITSLIB
#endif #endif
@ -689,7 +687,7 @@ main(int argc, char **argv)
char *userfile = 0; char *userfile = 0;
int quiet = 0; int quiet = 0;
while ((optchar = getopt(argc, argv, "vqf:")) != -1) { while ((optchar = getopt(argc, argv, "Vqf:")) != -1) {
switch (optchar) { switch (optchar) {
case 'f': case 'f':
userfile = optarg; userfile = optarg;
@ -697,14 +695,12 @@ main(int argc, char **argv)
case 'q': case 'q':
quiet = 1; quiet = 1;
break; break;
case 'v': case 'V':
fprintf(stderr, "\n units version %s Copyright (c) 1993 by Adrian Mariano\n", fprintf(stderr, "FreeBSD units\n");
VERSION);
fprintf(stderr, " This program may be freely distributed\n");
usage();
default:
usage(); usage();
break; break;
default:
usage();
} }
} }