Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin For XCU5's sake, and due to popular demand, add lin...



details:   https://anonhg.NetBSD.org/src/rev/83448a96b7fa
branches:  trunk
changeset: 474762:83448a96b7fa
user:      kleink <kleink%NetBSD.org@localhost>
date:      Mon Jul 19 09:11:25 1999 +0000

description:
For XCU5's sake, and due to popular demand, add link(8) and unlink(8)
utilities.  This addresses PR standards/8027 by Giles Lean, who also submitted
a different implementation along with; I chose to add those files I had written
a while ago for reasons of portability and not requiring being cleaned up wrt.
compile-time warnings.

diffstat:

 usr.sbin/Makefile        |   6 +-
 usr.sbin/link/Makefile   |   6 +++
 usr.sbin/link/link.8     |  74 +++++++++++++++++++++++++++++++++++++++++++
 usr.sbin/link/link.c     |  81 ++++++++++++++++++++++++++++++++++++++++++++++++
 usr.sbin/unlink/Makefile |   6 +++
 usr.sbin/unlink/unlink.8 |  67 +++++++++++++++++++++++++++++++++++++++
 usr.sbin/unlink/unlink.c |  81 ++++++++++++++++++++++++++++++++++++++++++++++++
 7 files changed, 318 insertions(+), 3 deletions(-)

diffs (truncated from 366 to 300 lines):

diff -r 107bb9921eba -r 83448a96b7fa usr.sbin/Makefile
--- a/usr.sbin/Makefile Mon Jul 19 08:02:07 1999 +0000
+++ b/usr.sbin/Makefile Mon Jul 19 09:11:25 1999 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.122 1999/07/17 14:06:24 itojun Exp $
+#      $NetBSD: Makefile,v 1.123 1999/07/19 09:11:25 kleink Exp $
 #      from: @(#)Makefile      5.20 (Berkeley) 6/12/93
 
 # XXX Temporary for NO_SENDMAIL and BUILD_POSTFIX
@@ -11,7 +11,7 @@
        chown chroot chrtbl config cron dbsym dev_mkdb \
        dhcp diskpart dumpfs dumplfs edquota eeprom eshconfig greconfig \
        grfconfig grfinfo gspa hilinfo inetd iostat ipf iteconfig kgmon \
-       kvm_mkdb lastlogin lpr mailwrapper map-mbone mbrlabel \
+       kvm_mkdb lastlogin link lpr mailwrapper map-mbone mbrlabel \
        mdconfig mdsetimage \
        memswitch mopd mountd mrinfo mrouted mtrace mtree \
        netgroup_mkdb nfsd nfsiod pkg_install portmap pppd pstat \
@@ -19,7 +19,7 @@
        repquota rmt rpc.bootparamd rpc.lockd rpc.pcnfsd \
        rpc.statd rpc.yppasswdd rwhod sa screenblank \
        sliplogin slstats spray sup sysctl syslogd tcpdchk \
-       tcpdmatch tcpdump timed traceroute trpt trsp update \
+       tcpdmatch tcpdump timed traceroute trpt trsp unlink update \
        usbdevs videomode vipw vnconfig wiconfig wsconscfg wsfontload xntp \
        ypbind yppoll ypserv ypset \
        zdump zic
diff -r 107bb9921eba -r 83448a96b7fa usr.sbin/link/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.sbin/link/Makefile    Mon Jul 19 09:11:25 1999 +0000
@@ -0,0 +1,6 @@
+#      $NetBSD: Makefile,v 1.1 1999/07/19 09:11:26 kleink Exp $
+
+PROG=  link
+MAN=   link.8
+
+.include <bsd.prog.mk>
diff -r 107bb9921eba -r 83448a96b7fa usr.sbin/link/link.8
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.sbin/link/link.8      Mon Jul 19 09:11:25 1999 +0000
@@ -0,0 +1,74 @@
+.\"    $NetBSD: link.8,v 1.1 1999/07/19 09:11:26 kleink Exp $
+.\"
+.\" Copyright (c) 1999 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Klaus Klein.
+.\"
+.\" 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.
+.\" 3. All advertising materials mentioning features or use of this software
+.\"    must display the following acknowledgement:
+.\"        This product includes software developed by the NetBSD
+.\"        Foundation, Inc. and its contributors.
+.\" 4. Neither the name of The NetBSD Foundation nor the names of its
+.\"    contributors may be used to endorse or promote products derived
+.\"    from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+.\"
+.Dd July 18, 1999
+.Dt LINK 8
+.Os
+.Sh NAME
+.Nm link
+.Nd call the
+.Fn link
+function
+.Sh SYNOPSIS
+.Nm
+.Ar file1
+.Ar file2
+.Sh DESCRIPTION
+The
+.Nm
+utility performs the function call
+.Fn link file1 file2 .
+.Pp
+.Ar file1
+must be the pathname of an existing file, and
+.Ar file2
+is the pathname of the new link to
+.Ar file1
+to be created.
+.Sh DIAGNOSTICS
+The
+.Nm
+utility
+exits 0 on success, and >0 if an error occurs.
+.Sh SEE ALSO
+.Xr ln 1 ,
+.Xr unlink 8 ,
+.Xr link 2
+.Sh STANDARDS
+The
+.Nm
+utility conforms to
+.St -xcu5 .
diff -r 107bb9921eba -r 83448a96b7fa usr.sbin/link/link.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.sbin/link/link.c      Mon Jul 19 09:11:25 1999 +0000
@@ -0,0 +1,81 @@
+/*     $NetBSD: link.c,v 1.1 1999/07/19 09:11:26 kleink Exp $  */
+
+/*-
+ * Copyright (c) 1999 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Klaus Klein.
+ *
+ * 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.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *        This product includes software developed by the NetBSD
+ *        Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
+#include <sys/cdefs.h>
+#ifndef lint
+__COPYRIGHT(
+"@(#) Copyright (c) 1999\
+       The NetBSD Foundation, Inc.  All rights reserved.");
+__RCSID("$NetBSD: link.c,v 1.1 1999/07/19 09:11:26 kleink Exp $");
+#endif
+
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+int            main __P((int, char *[]));
+static void    usage __P((void));
+
+int
+main(argc, argv)
+       int argc;
+       char *argv[];
+{
+
+       (void)setlocale(LC_ALL, "");
+
+       if (argc != 3)
+               usage();
+
+       if (link(argv[1], argv[2]) != 0) {
+               perror("link");
+               exit(EXIT_FAILURE);
+       }
+
+       exit(EXIT_SUCCESS);
+       /* NOTREACHED */
+}
+
+static void
+usage()
+{
+
+       (void)fprintf(stderr, "usage: link file1 file2");
+       exit(EXIT_FAILURE);
+}
diff -r 107bb9921eba -r 83448a96b7fa usr.sbin/unlink/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.sbin/unlink/Makefile  Mon Jul 19 09:11:25 1999 +0000
@@ -0,0 +1,6 @@
+#      $NetBSD: Makefile,v 1.1 1999/07/19 09:11:26 kleink Exp $
+
+PROG=  unlink
+MAN=   unlink.8
+
+.include <bsd.prog.mk>
diff -r 107bb9921eba -r 83448a96b7fa usr.sbin/unlink/unlink.8
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.sbin/unlink/unlink.8  Mon Jul 19 09:11:25 1999 +0000
@@ -0,0 +1,67 @@
+.\"    $NetBSD: unlink.8,v 1.1 1999/07/19 09:11:26 kleink Exp $
+.\"
+.\" Copyright (c) 1999 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Klaus Klein.
+.\"
+.\" 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.
+.\" 3. All advertising materials mentioning features or use of this software
+.\"    must display the following acknowledgement:
+.\"        This product includes software developed by the NetBSD
+.\"        Foundation, Inc. and its contributors.
+.\" 4. Neither the name of The NetBSD Foundation nor the names of its
+.\"    contributors may be used to endorse or promote products derived
+.\"    from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+.\"
+.Dd July 18, 1998
+.Dt UNLINK 8
+.Os
+.Sh NAME
+.Nm unlink
+.Nd call the unlink function
+.Sh SYNOPSIS
+.Nm
+.Ar file
+.Sh DESCRIPTION
+The
+.Nm
+utility performs the function call
+.Fn unlink file .
+.Pp
+.Ar file
+must be the pathname of an existing file.
+.Sh RETURN VALUES
+The
+.Nm
+utility exits 0 on success, and >0 if an error occurs.
+.Sh SEE ALSO
+.Xr link 8 ,
+.Xr rm 1 ,
+.Xr rmdir 1 ,
+.Xr unlink 2
+.Sh STANDARDS
+The
+.Nm
+utility conforms to
+.St -xcu5 .
diff -r 107bb9921eba -r 83448a96b7fa usr.sbin/unlink/unlink.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.sbin/unlink/unlink.c  Mon Jul 19 09:11:25 1999 +0000
@@ -0,0 +1,81 @@
+/*     $NetBSD: unlink.c,v 1.1 1999/07/19 09:11:26 kleink Exp $        */
+
+/*-
+ * Copyright (c) 1999 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Klaus Klein.
+ *
+ * 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



Home | Main Index | Thread Index | Old Index