Subject: bin/18126: add the revoke program
To: None <gnats-bugs@gnats.netbsd.org>
From: None <jnilsson@ludd.luth.se>
List: netbsd-bugs
Date: 08/30/2002 18:07:15
>Number:         18126
>Category:       bin
>Synopsis:       add the revoke program
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Fri Aug 30 09:07:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     
>Release:        NetBSD 1.5
>Organization:
>Environment:
System: NetBSD speedy 1.5_BETA NetBSD 1.5_BETA (SPEEDY) #6: Sun Dec 6 17:15:55 CET 2020 root@:/usr/src/sys/arch/alpha/compile/SPEEDY alpha

>Description:
There doesn't exist any program to call the revoke(2) function
from the shell in a standard NetBSD distribution.  It's actually
quite handy to have such a program especially to force processes
that "forgets" to release the audio device to do so.

>How-To-Repeat:
>Fix:
The source to the proposed program follows here in a shell archive:

# 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
#       revoke.c
#       revoke.8
#
echo x - Makefile
sed 's/^X//' >Makefile << 'END-of-Makefile'
X#      $Id: Makefile,v 1.2 2002/08/30 12:18:35 jens Exp $
X
XPROG=  revoke
XMAN=   revoke.8
XWARNS?=        2
X
X.include <bsd.prog.mk>
END-of-Makefile
echo x - revoke.c
sed 's/^X//' >revoke.c << 'END-of-revoke.c'
X/*     $Id: revoke.c,v 1.3 2002/08/30 11:45:33 jens Exp $      */
X#include <sys/types.h>
X
X#include <err.h>
X#include <stdio.h>
X#include <unistd.h>
X
Xstatic void usage(void);
X
Xint
Xmain(int argc, char *argv[])
X{
X       if (argc != 2)
X               usage();
X
X       if (revoke(argv[1]) != 0)
X               err(1, "revoke(%s)", argv[1]);
X       return 0;
X}
X
Xstatic void
Xusage(void)
X{
X       fprintf(stderr, "usage: revoke <filename>\n");
X       exit(1);
X}
END-of-revoke.c
echo x - revoke.8
sed 's/^X//' >revoke.8 << 'END-of-revoke.8'
X.\"    $Id: revoke.8,v 1.1 2002/08/30 12:18:35 jens Exp $
X.Dd August 30, 2002
X.Dt REVOKE 8
X.Os
X.Sh NAME
X.Nm revoke
X.Nd call the revoke function
X.Sh SYNOPSIS
X.Nm
X.Ar file
X.Sh DESCRIPTION
XThe
X.Nm
Xutility performs the function call
X.Fn revoke file .
X.Pp
X.Ar file
Xmust be the pathname of an existing file.
X.Sh EXIT STATUS
XThe
X.Nm
Xutility exits 0 on success, and 1 if an error occurs.
X.Sh SEE ALSO
X.Xr revoke 2
END-of-revoke.8
exit


>Release-Note:
>Audit-Trail:
>Unformatted: