From owner-svn-src-stable@freebsd.org Thu Jan 18 21:29:48 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 995A0EC4438; Thu, 18 Jan 2018 21:29:48 +0000 (UTC) (envelope-from kevans@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 5BEB582019; Thu, 18 Jan 2018 21:29:48 +0000 (UTC) (envelope-from kevans@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 832C4240BC; Thu, 18 Jan 2018 21:29:47 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0ILTlhF006589; Thu, 18 Jan 2018 21:29:47 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0ILTl3O006587; Thu, 18 Jan 2018 21:29:47 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201801182129.w0ILTl3O006587@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 18 Jan 2018 21:29:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328138 - stable/11/usr.bin/indent X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/usr.bin/indent X-SVN-Commit-Revision: 328138 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Jan 2018 21:29:48 -0000 Author: kevans Date: Thu Jan 18 21:29:46 2018 New Revision: 328138 URL: https://svnweb.freebsd.org/changeset/base/328138 Log: MFC r322177: Respect SIMPLE_BACKUP_SUFFIX environment variable in indent(1) Instead of using a non-configurable ".BAK" suffix, respect the SIMPLE_BACKUP_SUFFIX environment variable also used by patch(1). This simplifies cleanup operations in some patch/indent workflows. Modified: stable/11/usr.bin/indent/indent.1 stable/11/usr.bin/indent/indent.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/indent/indent.1 ============================================================================== --- stable/11/usr.bin/indent/indent.1 Thu Jan 18 21:19:57 2018 (r328137) +++ stable/11/usr.bin/indent/indent.1 Thu Jan 18 21:29:46 2018 (r328138) @@ -30,7 +30,7 @@ .\" @(#)indent.1 8.1 (Berkeley) 7/1/93 .\" $FreeBSD$ .\" -.Dd March 3, 2012 +.Dd August 7, 2017 .Dt INDENT 1 .Os .Sh NAME @@ -113,7 +113,10 @@ If is named .Sq Pa /blah/blah/file , the backup file is named -.Sq Pa file.BAK . +.Sq Pa file.BAK +by default. The extension used for the backup file may be overridden using the +.Ev SIMPLE_BACKUP_SUFFIX +environment variable. .Pp If .Ar output-file Modified: stable/11/usr.bin/indent/indent.c ============================================================================== --- stable/11/usr.bin/indent/indent.c Thu Jan 18 21:19:57 2018 (r328137) +++ stable/11/usr.bin/indent/indent.c Thu Jan 18 21:29:46 2018 (r328138) @@ -68,6 +68,8 @@ const char *in_name = "Standard Input"; /* will always * file */ const char *out_name = "Standard Output"; /* will always point to name * of output file */ +const char *simple_backup_suffix = ".BAK"; /* Suffix to use for backup + * files */ char bakfile[MAXPATHLEN] = ""; int @@ -94,8 +96,8 @@ main(int argc, char **argv) int type_code; /* the type of token, returned by lexi */ int last_else = 0; /* true iff last keyword was an else */ + const char *envval = NULL; - /*-----------------------------------------------*\ | INITIALIZATION | \*-----------------------------------------------*/ @@ -154,6 +156,10 @@ main(int argc, char **argv) output = 0; tabs_to_var = 0; + envval = getenv("SIMPLE_BACKUP_SUFFIX"); + if (envval) + simple_backup_suffix = envval; + /*--------------------------------------------------*\ | COMMAND LINE SCAN | \*--------------------------------------------------*/ @@ -1207,7 +1213,7 @@ bakcopy(void) p--; if (*p == '/') p++; - sprintf(bakfile, "%s.BAK", p); + sprintf(bakfile, "%s%s", p, simple_backup_suffix); /* copy in_name to backup file */ bakchn = creat(bakfile, 0600);