[Midnightbsd-cvs] src [11185] trunk/bin/rcp: sync with freebsd, add tests

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sat Jun 30 19:43:00 EDT 2018


Revision: 11185
          http://svnweb.midnightbsd.org/src/?rev=11185
Author:   laffer1
Date:     2018-06-30 19:42:59 -0400 (Sat, 30 Jun 2018)
Log Message:
-----------
sync with freebsd, add tests

Modified Paths:
--------------
    trunk/bin/rcp/Makefile
    trunk/bin/rcp/rcp.1
    trunk/bin/rcp/rcp.c

Added Paths:
-----------
    trunk/bin/rcp/tests/
    trunk/bin/rcp/tests/Makefile
    trunk/bin/rcp/tests/rcp_test.sh

Property Changed:
----------------
    trunk/bin/rcp/rcp.1

Modified: trunk/bin/rcp/Makefile
===================================================================
--- trunk/bin/rcp/Makefile	2018-06-30 23:40:36 UTC (rev 11184)
+++ trunk/bin/rcp/Makefile	2018-06-30 23:42:59 UTC (rev 11185)
@@ -1,6 +1,10 @@
 #	@(#)Makefile	8.1 (Berkeley) 7/19/93
+# $FreeBSD: stable/10/bin/rcp/Makefile 326332 2017-11-28 18:18:39Z asomers $
 # $MidnightBSD$
 
+.include <bsd.own.mk>
+
+PACKAGE=rcmds
 PROG=	rcp
 SRCS=	rcp.c util.c
 CFLAGS+=-DBINDIR=${BINDIR}
@@ -9,4 +13,7 @@
 BINMODE=4555
 PRECIOUSPROG=
 
+HAS_TESTS=
+SUBDIR.${MK_TESTS}+= tests
+
 .include <bsd.prog.mk>

Modified: trunk/bin/rcp/rcp.1
===================================================================
--- trunk/bin/rcp/rcp.1	2018-06-30 23:40:36 UTC (rev 11184)
+++ trunk/bin/rcp/rcp.1	2018-06-30 23:42:59 UTC (rev 11185)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\"-
 .\" Copyright (c) 1983, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -27,9 +28,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)rcp.1	8.1 (Berkeley) 5/31/93
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/bin/rcp/rcp.1 320646 2017-07-04 15:53:54Z allanjude $
 .\"
-.Dd October 16, 2002
+.Dd July 3, 2017
 .Dt RCP 1
 .Os
 .Sh NAME
@@ -43,6 +44,15 @@
 .Op Fl 46pr
 .Ar
 .Ar directory
+.Sh DEPRECATION NOTICE
+.Nm
+is deprecated and will be removed from future versions of the
+.Fx
+base system.
+If
+.Nm
+is still required, it can be installed from ports or packages
+(net/bsdrcmds).
 .Sh DESCRIPTION
 The
 .Nm


Property changes on: trunk/bin/rcp/rcp.1
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/bin/rcp/rcp.c
===================================================================
--- trunk/bin/rcp/rcp.c	2018-06-30 23:40:36 UTC (rev 11184)
+++ trunk/bin/rcp/rcp.c	2018-06-30 23:42:59 UTC (rev 11185)
@@ -47,7 +47,6 @@
 #endif
 #include <sys/cdefs.h>
 __MBSDID("$MidnightBSD$");
-
 #include <sys/param.h>
 #include <sys/stat.h>
 #include <sys/time.h>
@@ -61,7 +60,6 @@
 #include <err.h>
 #include <errno.h>
 #include <fcntl.h>
-#include <libutil.h>
 #include <limits.h>
 #include <netdb.h>
 #include <paths.h>
@@ -77,12 +75,13 @@
 
 #define	OPTIONS "46dfprt"
 
-struct passwd *pwd;
-u_short	port;
-uid_t	userid;
-int errs, rem;
-int pflag, iamremote, iamrecursive, targetshouldbedirectory;
-int family = PF_UNSPEC;
+static struct passwd *pwd;
+static u_short	port;
+static uid_t	userid;
+static int errs, rem;
+int iamremote;
+static int pflag, iamrecursive, targetshouldbedirectory;
+static int family = PF_UNSPEC;
 
 static int argc_copy;
 static const char **argv_copy;
@@ -90,7 +89,7 @@
 static char period[] = ".";
 
 #define	CMDNEEDS	64
-char cmd[CMDNEEDS];		/* must hold "rcp -r -p -d\0" */
+static char cmd[CMDNEEDS];	/* must hold "rcp -r -p -d\0" */
 
 int	 response(void);
 void	 rsource(char *, struct stat *);

Added: trunk/bin/rcp/tests/Makefile
===================================================================
--- trunk/bin/rcp/tests/Makefile	                        (rev 0)
+++ trunk/bin/rcp/tests/Makefile	2018-06-30 23:42:59 UTC (rev 11185)
@@ -0,0 +1,6 @@
+# $MidnightBSD$
+# $FreeBSD: stable/10/bin/rcp/tests/Makefile 323275 2017-09-07 16:54:47Z asomers $
+
+ATF_TESTS_SH+=  rcp_test
+
+.include <bsd.test.mk>


Property changes on: trunk/bin/rcp/tests/Makefile
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/bin/rcp/tests/rcp_test.sh
===================================================================
--- trunk/bin/rcp/tests/rcp_test.sh	                        (rev 0)
+++ trunk/bin/rcp/tests/rcp_test.sh	2018-06-30 23:42:59 UTC (rev 11185)
@@ -0,0 +1,60 @@
+#
+# Copyright 2017 Shivansh Rai
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD: stable/10/bin/rcp/tests/rcp_test.sh 323275 2017-09-07 16:54:47Z asomers $
+# $MidnightBSD$
+
+usage_output='usage: rcp'
+
+atf_test_case invalid_usage
+invalid_usage_head()
+{
+	atf_set "descr" "Verify that an invalid usage with a supported option produces a valid error message"
+}
+
+invalid_usage_body()
+{
+	atf_check -s not-exit:0 -e match:"$usage_output" rcp -4
+	atf_check -s not-exit:0 -e match:"$usage_output" rcp -6
+	atf_check -s not-exit:0 -e match:"$usage_output" rcp -p
+	atf_check -s not-exit:0 -e match:"$usage_output" rcp -r
+}
+
+atf_test_case no_arguments
+no_arguments_head()
+{
+	atf_set "descr" "Verify that rcp(1) fails and generates a valid usage message when no arguments are supplied"
+}
+
+no_arguments_body()
+{
+	atf_check -s not-exit:0 -e match:"$usage_output" rcp
+}
+
+atf_init_test_cases()
+{
+	atf_add_test_case invalid_usage
+	atf_add_test_case no_arguments
+}


Property changes on: trunk/bin/rcp/tests/rcp_test.sh
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property


More information about the Midnightbsd-cvs mailing list