From d239da0ebc0028732dac2c8965b2227a9c1627af Mon Sep 17 00:00:00 2001 From: claudio Date: Thu, 27 Apr 2023 16:28:18 +0000 Subject: [PATCH] Implement -V as an alias to --version. From Martin Cracauer OK kn@ --- usr.bin/rsync/main.c | 19 +++++++++---------- usr.bin/rsync/rsync.1 | 9 ++++----- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/usr.bin/rsync/main.c b/usr.bin/rsync/main.c index dd175597914..60abf2719ff 100644 --- a/usr.bin/rsync/main.c +++ b/usr.bin/rsync/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.66 2023/02/14 17:15:15 job Exp $ */ +/* $OpenBSD: main.c,v 1.67 2023/04/27 16:28:18 claudio Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons * @@ -281,7 +281,6 @@ static struct opts opts; #define OP_PORT 1001 #define OP_RSYNCPATH 1002 #define OP_TIMEOUT 1003 -#define OP_VERSION 1004 #define OP_EXCLUDE 1005 #define OP_INCLUDE 1006 #define OP_EXCLUDE_FROM 1007 @@ -339,7 +338,7 @@ const struct option lopts[] = { { "no-times", no_argument, &opts.preserve_times, 0 }, { "verbose", no_argument, &verbose, 1 }, { "no-verbose", no_argument, &verbose, 0 }, - { "version", no_argument, NULL, OP_VERSION }, + { "version", no_argument, NULL, 'V' }, { NULL, 0, NULL, 0 } }; @@ -362,7 +361,7 @@ main(int argc, char *argv[]) opts.max_size = opts.min_size = -1; - while ((c = getopt_long(argc, argv, "Dae:ghlnoprtvxz", lopts, &lidx)) + while ((c = getopt_long(argc, argv, "aDe:ghlnoprtVvxz", lopts, &lidx)) != -1) { switch (c) { case 'D': @@ -406,6 +405,10 @@ main(int argc, char *argv[]) case 'v': verbose++; break; + case 'V': + fprintf(stderr, "openrsync: protocol version %u\n", + RSYNC_PROTOCOL); + exit(0); case 'x': opts.one_file_system++; break; @@ -495,10 +498,6 @@ basedir: if (scan_scaled(optarg, &opts.min_size) == -1) err(1, "bad min-size"); break; - case OP_VERSION: - fprintf(stderr, "openrsync: protocol version %u\n", - RSYNC_PROTOCOL); - exit(0); case 'h': default: goto usage; @@ -633,11 +632,11 @@ basedir: exit(rc); usage: fprintf(stderr, "usage: %s" - " [-aDglnoprtvx] [-e program] [--address=sourceaddr]\n" + " [-aDglnoprtVvx] [-e program] [--address=sourceaddr]\n" "\t[--contimeout=seconds] [--compare-dest=dir] [--del] [--exclude]\n" "\t[--exclude-from=file] [--include] [--include-from=file]\n" "\t[--no-motd] [--numeric-ids] [--port=portnumber]\n" - "\t[--rsync-path=program] [--timeout=seconds] [--version]\n" + "\t[--rsync-path=program] [--timeout=seconds]\n" "\tsource ... directory\n", getprogname()); exit(ERR_SYNTAX); diff --git a/usr.bin/rsync/rsync.1 b/usr.bin/rsync/rsync.1 index d96c4a0da25..664d4ee24b8 100644 --- a/usr.bin/rsync/rsync.1 +++ b/usr.bin/rsync/rsync.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: rsync.1,v 1.30 2022/08/02 18:09:20 job Exp $ +.\" $OpenBSD: rsync.1,v 1.31 2023/04/27 16:28:18 claudio Exp $ .\" .\" Copyright (c) 2019 Kristaps Dzonsons .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: August 2 2022 $ +.Dd $Mdocdate: April 27 2023 $ .Dt OPENRSYNC 1 .Os .Sh NAME @@ -22,7 +22,7 @@ .Nd synchronise local and remote files .Sh SYNOPSIS .Nm openrsync -.Op Fl aDglnoprtvx +.Op Fl aDglnoprtVvx .Op Fl e Ar program .Op Fl -address Ns = Ns Ar sourceaddr .Op Fl -compare-dest Ns = Ns Ar directory @@ -39,7 +39,6 @@ .Op Fl -port Ns = Ns Ar service .Op Fl -rsync-path Ns = Ns Ar program .Op Fl -timeout Ns = Ns Ar seconds -.Op Fl -version .Ar source ... .Ar directory .Sh DESCRIPTION @@ -220,7 +219,7 @@ Do not cross filesystem boundaries. If this option is repeated, all mount point directories from the copy are omitted. Otherwise, it includes an empty directory at each mount point it encounters. -.It Fl -version +.It Fl V , -version Print version and exit. .El .Pp -- 2.20.1