Date: Wed, 11 Aug 1999 08:21:00 -0400 (EDT) From: James Howard <howardjp@wam.umd.edu> To: FreeBSD-gnats-submit@freebsd.org Subject: bin/13074: unlink(1) as required by Unix 98 Message-ID: <199908111221.IAA04673@rac10.wam.umd.edu>
next in thread | raw e-mail | index | archive | help
>Number: 13074 >Category: bin >Synopsis: unlink(1) as required by Unix 98 >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Wed Aug 11 06:00:03 PDT 1999 >Closed-Date: >Last-Modified: >Originator: James Howard >Release: FreeBSD 3.2-STABLE i386 >Organization: University of Maryland >Environment: FreeBSD byzantine 3.2-STABLE FreeBSD 3.2-STABLE #5: Sat Aug 7 23:43:54 GMT 1999 root@byzantine:/usr/src/sys/compile/BYZANTINE i386 >Description: After opening my big mouth on freebsd-advocacy about how Unix 98 compliance was a worthy goal, more than one person told me to go ahead and send in PRs with changes. Well, here is yet another :) This contains a shar of unlink(1). unlink accepts one argument and runs unlink(2) on it thus removing the object listed. NetBSD places this in /usr/sbin and puts the man page in section 8, but nothing in the standard dictates where it should be. I have the man page in section 1. If this is inappropriate, it can be changed without pain. This implementation contains no NetBSD code. >How-To-Repeat: Irrelevant. >Fix: # This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # Makefile # unlink.1 # unlink.c # echo x - Makefile sed 's/^X//' >Makefile << 'END-of-Makefile' XPROG= unlink X X.include <bsd.prog.mk> END-of-Makefile echo x - unlink.1 sed 's/^X//' >unlink.1 << 'END-of-unlink.1' X.\" Copyright (c) 1999 James Howard X.\" All rights reserved. X.\" X.\" Redistribution and use in source and binary forms, with or without X.\" modification, are permitted provided that the following conditions X.\" are met: X.\" 1. Redistributions of source code must retain the above copyright X.\" notice, this list of conditions and the following disclaimer. X.\" 2. Redistributions in binary form must reproduce the above copyright X.\" notice, this list of conditions and the following disclaimer in the X.\" documentation and/or other materials provided with the distribution. X.\" X.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND X.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE X.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE X.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE X.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL X.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS X.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) X.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT X.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY X.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF X.\" SUCH DAMAGE. X.\" X.\" X.\" $Id$ X.\" X.Dd August 10, 1999 X.Dt UNLINK 1 X.Os X.Sh NAME X.Nm unlink X.Nd call the X.Xr unlink 2 Xfunction X.Sh SYNOPSIS X.Nm unlink X.Ar file X.Sh DESCRIPTION X.Nm Unlink Xand remove X.Ar file Xfrom the file system. X.Sh USAGE XThe X.Nm Xutility will remove a single file or direectory entry Xand decrements the link count of the file which was Xreferenced by X.Ar file . XA directory may not be specified by X.Ar file . X.Sh SEE ALSO X.Xr link 1 , X.Xr rm 1 , X.Xr unlink 2 X.Sh STANDARDS XThe X.Nm Xutility is expected to be XPG5 compliant.END-of-unlink.1 echo x - unlink.c sed 's/^X//' >unlink.c << 'END-of-unlink.c' X/*- X * Copyright (c) 1999 James Howard X * All rights reserved. X * X * Redistribution and use in source and binary forms, with or without X * modification, are permitted provided that the following conditions X * are met: X * 1. Redistributions of source code must retain the above copyright X * notice, this list of conditions and the following disclaimer. X * 2. Redistributions in binary form must reproduce the above copyright X * notice, this list of conditions and the following disclaimer in the X * documentation and/or other materials provided with the distribution. X * X * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND X * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE X * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE X * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE X * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL X * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS X * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) X * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT X * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY X * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF X * SUCH DAMAGE. X * X * $Id$ X */ X X#include <err.h> X#include <stdio.h> X#include <unistd.h> X Xvoid help(void); X Xint main(int argc, char **argv) X{ X int e; X X if(argc != 2) X help(); X X if((e = unlink(argv[1])) != 0) X err(!e, "%s", argv[1]); X X return 0; X} X Xvoid help(void) X{ X X fprintf(stderr, "usage: unlink file\n"); X exit(1); X} END-of-unlink.c exit >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199908111221.IAA04673>