From owner-svn-src-stable@freebsd.org Wed Jun 27 20:54:14 2018 Return-Path: Delivered-To: svn-src-stable@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 2387C1010988; Wed, 27 Jun 2018 20:54:14 +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 C1DFC728C4; Wed, 27 Jun 2018 20:54:13 +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 8A23539A; Wed, 27 Jun 2018 20:54:13 +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 w5RKsDgY095102; Wed, 27 Jun 2018 20:54:13 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w5RKsD9T095101; Wed, 27 Jun 2018 20:54:13 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201806272054.w5RKsD9T095101@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 27 Jun 2018 20:54:13 +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: r335736 - stable/11/usr.bin/seq X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/usr.bin/seq X-SVN-Commit-Revision: 335736 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.26 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: Wed, 27 Jun 2018 20:54:14 -0000 Author: kevans Date: Wed Jun 27 20:54:12 2018 New Revision: 335736 URL: https://svnweb.freebsd.org/changeset/base/335736 Log: MFC r333122: seq(1): Provide some long options These match GNU seq(1) names where applicable for compatibility purposes. Modified: stable/11/usr.bin/seq/seq.1 stable/11/usr.bin/seq/seq.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/seq/seq.1 ============================================================================== --- stable/11/usr.bin/seq/seq.1 Wed Jun 27 20:50:23 2018 (r335735) +++ stable/11/usr.bin/seq/seq.1 Wed Jun 27 20:54:12 2018 (r335736) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 12, 2016 +.Dd April 30, 2018 .Dt SEQ 1 .Os .Sh NAME @@ -72,7 +72,7 @@ The .Nm utility accepts the following options: .Bl -tag -width Ar -.It Fl f Ar format +.It Fl f Ar format , Fl -format Ar format Use a .Xr printf 3 style @@ -98,7 +98,7 @@ defined in .St -ansiC . The default is .Cm %g . -.It Fl s Ar string +.It Fl s Ar string , Fl -separator Ar string Use .Ar string to separate numbers. @@ -109,7 +109,7 @@ defined in .St -ansiC . The default is .Cm \en . -.It Fl t Ar string +.It Fl t Ar string , Fl -terminator Ar string Use .Ar string to terminate sequence of numbers. @@ -121,7 +121,7 @@ defined in This option is useful when the default separator does not contain a .Cm \en . -.It Fl w +.It Fl w , Fl -fixed-width Equalize the widths of all numbers by padding with zeros as necessary. This option has no effect with the .Fl f Modified: stable/11/usr.bin/seq/seq.c ============================================================================== --- stable/11/usr.bin/seq/seq.c Wed Jun 27 20:50:23 2018 (r335735) +++ stable/11/usr.bin/seq/seq.c Wed Jun 27 20:54:12 2018 (r335736) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -67,6 +68,15 @@ static int valid_format(const char *); static char *generate_format(double, double, double, int, char); static char *unescape(char *); +static const struct option long_opts[] = +{ + {"format", required_argument, NULL, 'f'}, + {"separator", required_argument, NULL, 's'}, + {"terminator", required_argument, NULL, 't'}, + {"equal-width", no_argument, NULL, 'w'}, + {NULL, no_argument, NULL, 0} +}; + /* * The seq command will print out a numeric sequence from 1, the default, * to a user specified upper limit by 1. The lower bound and increment @@ -97,7 +107,7 @@ main(int argc, char *argv[]) * least they trip up getopt(3). */ while ((optind < argc) && !numeric(argv[optind]) && - (c = getopt(argc, argv, "f:hs:t:w")) != -1) { + (c = getopt_long(argc, argv, "+f:hs:t:w", long_opts, NULL)) != -1) { switch (c) { case 'f': /* format (plan9) */