svn commit: r322293 - head/bin/df

Kyle Evans kevans at FreeBSD.org
Wed Aug 9 01:24:53 UTC 2017


Author: kevans
Date: Wed Aug  9 01:24:52 2017
New Revision: 322293
URL: https://svnweb.freebsd.org/changeset/base/322293

Log:
  df(1): Add --si as an alias for -H
  
  Reviewed by:	cem (earlier version), emaste
  Approved by:	emaste (mentor)
  Differential Revision:	https://reviews.freebsd.org/D11749

Modified:
  head/bin/df/df.1
  head/bin/df/df.c

Modified: head/bin/df/df.1
==============================================================================
--- head/bin/df/df.1	Wed Aug  9 01:20:53 2017	(r322292)
+++ head/bin/df/df.1	Wed Aug  9 01:24:52 2017	(r322293)
@@ -29,7 +29,7 @@
 .\"     @(#)df.1	8.3 (Berkeley) 5/8/95
 .\" $FreeBSD$
 .\"
-.Dd December 1, 2015
+.Dd August 8, 2017
 .Dt DF 1
 .Os
 .Sh NAME
@@ -97,7 +97,7 @@ output.
 Use unit suffixes: Byte, Kibibyte, Mebibyte, Gibibyte, Tebibyte and
 Pebibyte (based on powers of 1024) in order to reduce the number of
 digits to four or fewer.
-.It Fl H
+.It Fl H , Fl Fl si
 .Dq Human-readable
 output.
 Use unit suffixes: Byte, Kilobyte, Megabyte,

Modified: head/bin/df/df.c
==============================================================================
--- head/bin/df/df.c	Wed Aug  9 01:20:53 2017	(r322292)
+++ head/bin/df/df.c	Wed Aug  9 01:24:52 2017	(r322293)
@@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$");
 #include <ufs/ufs/ufsmount.h>
 #endif
 #include <err.h>
+#include <getopt.h>
 #include <libutil.h>
 #include <locale.h>
 #ifdef MOUNT_CHAR_DEVS
@@ -107,6 +108,12 @@ static int	thousands;
 static struct	ufs_args mdev;
 #endif
 
+static const struct option long_options[] =
+{
+	{ "si", no_argument, NULL, 'H' },
+	{ NULL, no_argument, NULL, 0 },
+};
+
 int
 main(int argc, char *argv[])
 {
@@ -142,7 +149,8 @@ main(int argc, char *argv[])
 	if (argc < 0)
 		exit(1);
 
-	while ((ch = getopt(argc, argv, "abcgHhiklmnPt:T,")) != -1)
+	while ((ch = getopt_long(argc, argv, "+abcgHhiklmnPt:T,", long_options,
+	    NULL)) != -1)
 		switch (ch) {
 		case 'a':
 			aflag = 1;


More information about the svn-src-all mailing list