From owner-svn-src-all@freebsd.org Mon Jun 4 21:05:58 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0483FFF394F; Mon, 4 Jun 2018 21:05:58 +0000 (UTC) (envelope-from pstef@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A0C92868AF; Mon, 4 Jun 2018 21:05:57 +0000 (UTC) (envelope-from pstef@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7979212B89; Mon, 4 Jun 2018 21:05:57 +0000 (UTC) (envelope-from pstef@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w54L5vNI075609; Mon, 4 Jun 2018 21:05:57 GMT (envelope-from pstef@FreeBSD.org) Received: (from pstef@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w54L5vJm075607; Mon, 4 Jun 2018 21:05:57 GMT (envelope-from pstef@FreeBSD.org) Message-Id: <201806042105.w54L5vJm075607@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pstef set sender to pstef@FreeBSD.org using -f From: Piotr Pawel Stefaniak Date: Mon, 4 Jun 2018 21:05:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334636 - head/usr.bin/indent X-SVN-Group: head X-SVN-Commit-Author: pstef X-SVN-Commit-Paths: head/usr.bin/indent X-SVN-Commit-Revision: 334636 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jun 2018 21:05:58 -0000 Author: pstef Date: Mon Jun 4 21:05:56 2018 New Revision: 334636 URL: https://svnweb.freebsd.org/changeset/base/334636 Log: indent(1): add --version option There exist multi-platform programs that check indent's version in order to know what they can expect from it. GNU indent provides that via --version, so implement the same option here. Modified: head/usr.bin/indent/args.c head/usr.bin/indent/indent.1 Modified: head/usr.bin/indent/args.c ============================================================================== --- head/usr.bin/indent/args.c Mon Jun 4 20:55:25 2018 (r334635) +++ head/usr.bin/indent/args.c Mon Jun 4 21:05:56 2018 (r334636) @@ -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}, @@ -301,6 +305,10 @@ found: goto need_param; 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); Modified: head/usr.bin/indent/indent.1 ============================================================================== --- head/usr.bin/indent/indent.1 Mon Jun 4 20:55:25 2018 (r334635) +++ head/usr.bin/indent/indent.1 Mon Jun 4 21:05:56 2018 (r334636) @@ -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 m 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