summaryrefslogtreecommitdiff
path: root/usr.bin/indent
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/indent')
-rw-r--r--usr.bin/indent/args.c8
-rw-r--r--usr.bin/indent/indent.17
2 files changed, 14 insertions, 1 deletions
diff --git a/usr.bin/indent/args.c b/usr.bin/indent/args.c
index 62cb3b620089..2a6d07ef54e5 100644
--- a/usr.bin/indent/args.c
+++ b/usr.bin/indent/args.c
@@ -58,6 +58,8 @@ __FBSDID("$FreeBSD$");
#include "indent_globs.h"
#include "indent.h"
+#define INDENT_VERSION "2.0"
+
/* profile types */
#define PRO_SPECIAL 1 /* special case */
#define PRO_BOOL 2 /* boolean */
@@ -76,6 +78,7 @@ __FBSDID("$FreeBSD$");
static void scan_profile(FILE *);
#define KEY_FILE 5 /* only used for args */
+#define VERSION 6 /* only used for args */
const char *option_source = "?";
@@ -97,6 +100,7 @@ struct pro {
{"T", PRO_SPECIAL, 0, KEY, 0},
{"U", PRO_SPECIAL, 0, KEY_FILE, 0},
+ {"-version", PRO_SPECIAL, 0, VERSION, 0},
{"P", PRO_SPECIAL, 0, IGN, 0},
{"bacc", PRO_BOOL, false, ON, &blanklines_around_conditional_compilation},
{"badp", PRO_BOOL, false, ON, &blanklines_after_declarations_at_proctop},
@@ -302,6 +306,10 @@ found:
add_typedefs_from_file(param_start);
break;
+ case VERSION:
+ printf("FreeBSD indent %s\n", INDENT_VERSION);
+ exit(0);
+
default:
errx(1, "set_option: internal error: p_special %d", p->p_special);
}
diff --git a/usr.bin/indent/indent.1 b/usr.bin/indent/indent.1
index 85c28dfb946e..6180b4baa9e9 100644
--- a/usr.bin/indent/indent.1
+++ b/usr.bin/indent/indent.1
@@ -30,7 +30,7 @@
.\" @(#)indent.1 8.1 (Berkeley) 7/1/93
.\" $FreeBSD$
.\"
-.Dd August 7, 2017
+.Dd June 4, 2018
.Dt INDENT 1
.Os
.Sh NAME
@@ -90,6 +90,7 @@
.Op Fl U Ns Ar file
.Op Fl ut | Fl nut
.Op Fl v | Fl \&nv
+.Op Fl -version
.Sh DESCRIPTION
The
.Nm
@@ -491,6 +492,10 @@ reports when it splits one line of input into two or more lines of output,
and gives some size statistics at completion.
The default is
.Fl \&nv .
+.It Fl -version
+Causes
+.Nm
+to print its version number and exit.
.El
.Pp
You may set up your own `profile' of defaults to